hltv-async-api 0.4.1__tar.gz → 0.4.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hltv_async_api-0.4.2/PKG-INFO +288 -0
- hltv_async_api-0.4.2/README.md +272 -0
- {hltv_async_api-0.4.1 → hltv_async_api-0.4.2}/hltv_async_api/__init__.py +1 -1
- {hltv_async_api-0.4.1 → hltv_async_api-0.4.2}/hltv_async_api/aiohltv.py +121 -38
- hltv_async_api-0.4.2/hltv_async_api.egg-info/PKG-INFO +288 -0
- {hltv_async_api-0.4.1 → hltv_async_api-0.4.2}/pyproject.toml +1 -1
- {hltv_async_api-0.4.1 → hltv_async_api-0.4.2}/setup.py +1 -1
- hltv_async_api-0.4.1/PKG-INFO +0 -211
- hltv_async_api-0.4.1/README.md +0 -195
- hltv_async_api-0.4.1/hltv_async_api.egg-info/PKG-INFO +0 -211
- {hltv_async_api-0.4.1 → hltv_async_api-0.4.2}/LICENSE +0 -0
- {hltv_async_api-0.4.1 → hltv_async_api-0.4.2}/hltv_async_api.egg-info/SOURCES.txt +0 -0
- {hltv_async_api-0.4.1 → hltv_async_api-0.4.2}/hltv_async_api.egg-info/dependency_links.txt +0 -0
- {hltv_async_api-0.4.1 → hltv_async_api-0.4.2}/hltv_async_api.egg-info/top_level.txt +0 -0
- {hltv_async_api-0.4.1 → hltv_async_api-0.4.2}/setup.cfg +0 -0
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: hltv_async_api
|
|
3
|
+
Version: 0.4.2
|
|
4
|
+
Summary: Hltv-aio An unofficial asynchronous HLTV API Wrapper for Python
|
|
5
|
+
Home-page: https://github.com/akimerslys/aiohltv
|
|
6
|
+
Author: akimerslys
|
|
7
|
+
Author-email: Akim Slys <akimslys2003@gmail.com>
|
|
8
|
+
Project-URL: Homepage, https://github.com/akimerslys/aiohltv
|
|
9
|
+
Project-URL: Issues, https://github.com/akimerslys/aiohltv/issues
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Requires-Python: >=3.9
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
|
|
17
|
+
# hltv-async-api an unofficial asynchronous HLTV API Wrapper for Python
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
**This page not completed, not all methods and configs are written**
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
# Features
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
* **Simple Usage** (its realy simple)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
* **New and modern fully async library**
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
* **Supports proxy usage with huge amount of options**
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
# Installation
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
pip install hltv-async-api
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
# Simple Usage
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
from hltv_async_api import Hltv
|
|
50
|
+
|
|
51
|
+
hltv = Hltv()
|
|
52
|
+
live_matches = await hltv.get_live_matches()
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
# Proxy Usage
|
|
58
|
+
|
|
59
|
+
**Load Proxies from list**
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
proxy_list = ['http://120.234.203.171:9002', 'http://110.38.68.38:80']
|
|
63
|
+
|
|
64
|
+
hltv = Hltv(use_proxy=True, proxy_list=proxy_list)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**Load Proxies from file**
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
hltv = Hltv(use_proxy=True, proxy_path='PATH_TO_PROXY.TXT')
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
**One-time proxy**
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
hltv = Hltv(use_proxy=True, proxy_path='PATH_TO_PROXY.TXT', proxy_one_time=True)
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**Protocol usage**
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
proxy_list = ['120.234.203.171:9002', '110.38.68.38:80']
|
|
84
|
+
|
|
85
|
+
hltv = Hltv(use_proxy=True, proxy_list=proxy_list, proxy_protocol='http')
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
# Methods
|
|
90
|
+
|
|
91
|
+
* **get_upcoming_matches(days: int = 7, min_star_rating: int = 1)**
|
|
92
|
+
|
|
93
|
+
-days (the number of days into the future to fetch matches for)
|
|
94
|
+
|
|
95
|
+
-min_star_rating (the minimum star rating for matches to include)
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
await hltv.get_upcoming_matches(1, 5)
|
|
99
|
+
|
|
100
|
+
>>> ['date': '11-11', 'matches': [id: '1111', team1: 'Natus Vincere' | 'TBD', team2: 'FaZe' | 'TBD', time: '14:15', maps: '3', stars: 5, 'PGL CS2 Major Copenhagen 2024' | None]]```
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
* **get_events(outgoing=True, future=True, max_events=10) -> [('id', 'title', 'startdate', 'enddate')]**
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
await hltv.get_events(future=False)
|
|
107
|
+
|
|
108
|
+
>>>{'id': '7437', 'name': 'IEM Chengdu 2024', 'start_date': '8-4', 'end_date': '14-4'}, {'id': '7757', 'name': 'BetBoom Dacha Belgrade 2024 Europe Closed Qualifier', 'start_date': '2-4', 'end_date': '12-4'}]
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
* **get_event_results(event_id: int | str)**
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
await get_event_results(7148)
|
|
117
|
+
|
|
118
|
+
>>> ['date': '31-3', 'matches': ['id': '1111', team1': 'FaZe', 'team2': 'Natus Vincere', 'score1': '1', 'score2': '2']]
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
* **get_event_matches(event_id: str | int):**
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
await hltv.get_event_matches(7148)
|
|
126
|
+
|
|
127
|
+
>>>[{'date': 'LIVE', 'matches': [{'id': '2371135', 'team1': 'GUN5', 'team2': 'KOI', 't1_id': '12471', 't2_id': '12591'}]}, {'date': '2024-04-08', 'matches': [{'id': '2371131', 'time': '20:00', 'team1': 'Aurora', 'team2': 'Metizport', 't1_id': '11861', 't2_id': '11641'}]}]
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
* **get_event_info(event_id: str | int, event_title: str) -> (event_id, event_title, event_start, event_end, prize, team_num, location, groups)**
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
await hltv.get_event_info(7148, 'PGL CS2 Major Copenhagen2024')
|
|
134
|
+
|
|
135
|
+
(7148, 'PGL CS2 Major Copenhagen2024', '21-3', '31-3', '$1,250,000', '16', 'Copenhagen, Denmark', [])
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
* **get_top_teams(max_teams=30) -> ['rank', 'title', 'points', 'change', 'id']**
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
await hltv.get_top_teams(2)
|
|
143
|
+
|
|
144
|
+
>>>[{'id': '1111', 'rank': '1', 'title': 'FaZe', 'points': '939', 'change': '-', 'id': '6667'}, {'id': '1111', 'rank': '2', 'title': 'Natus Vincere', 'points': '757', 'change': '+4', 'id': '4608'}]
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
* **get_team_info(team_id: int | str, title: str) -> (team_id, team_title, rank, [players], coach, average_age, weeks_in_top_20, last_trophy, total_trophys)**
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
await hltv.get_team_info(6667, 'faze')
|
|
151
|
+
|
|
152
|
+
>>>(6667, 'faze', '1', ['karrigan', 'rain', 'frozen', 'ropz', 'broky'], 'NEO', '26.5', '256', 'CS Asia Championships 2023', 21)
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
* **get_last_news(max_reg_news=2, only_today=True, only_featured=False) -> [date, [featured_id, featured_title, featured_desciption], [regular_id, reg_title, reg_time]]**
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
await hltv.get_last_news(only_today=True, max_reg_news=1)
|
|
159
|
+
|
|
160
|
+
>>>[{'date': '02-04', 'f_news': [{'f_id': '38682', 'f_title': 'NIP confirm r1nkle signing', 'f_desc': "Ninjas in Pyjamas only have an anchor player left to sign following the young Ukrainian AWPer's addition."}], 'news': [{'id': '38685', 'title': 'Rounds add sLowi, p3kko', 'posted': 'an hour ago'}, {'id': '38690', 'title': 'n1ssim returns to Sharks after paiN loan deal expires', 'posted': 'an hour ago'}]}]
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
* **get_best_players(top=40) -> ('rank', 'name', 'team', 'maps', 'rating')**
|
|
164
|
+
|
|
165
|
+
```
|
|
166
|
+
await hltv.get_best_players(2)
|
|
167
|
+
|
|
168
|
+
>>>[{'rank': 1, 'name': 'donk', 'team': 'Spirit', 'maps': '33', 'rating': '1.52'}, {'rank': 2, 'name': 'm0NESY', 'team': 'G2', 'maps': '34', 'rating': '1.38'}]
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
# Configs
|
|
173
|
+
|
|
174
|
+
* max_delay: int = 15
|
|
175
|
+
|
|
176
|
+
We automaticly increasing reconnecting delay by 1 sec to max_delay (from 1s to 5s)
|
|
177
|
+
|
|
178
|
+
```
|
|
179
|
+
hltv = Hltv(max_delay=5, use_proxy=False)
|
|
180
|
+
|
|
181
|
+
>>>Fetching https://www.hltv.org/matches/2370727/faze-vs-natus-vincere-pgl-cs2-major-copenhagen-2024, code: 403
|
|
182
|
+
>>>Got 403 forbitten
|
|
183
|
+
>>>Calling again, increasing delay to 4s
|
|
184
|
+
>>>Fetching https://www.hltv.org/matches/2370727/faze-vs-natus-vincere-pgl-cs2-major-copenhagen-2024, code: 403
|
|
185
|
+
>>>Got 403 forbitten
|
|
186
|
+
>>>Calling again, increasing delay to 5s
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
* max_retries: int = 0
|
|
190
|
+
|
|
191
|
+
Max retries. 0 or -1 for infinity tries.
|
|
192
|
+
|
|
193
|
+
```
|
|
194
|
+
hltv = Hltv(max_retries=2, debug=True)
|
|
195
|
+
print(await hltv.get_best_players())
|
|
196
|
+
|
|
197
|
+
Creating Session
|
|
198
|
+
Trying connect to https://www.hltv.org/stats/players?startDate=2024-01-01&endDate=2024-12-31&rankingFilter=Top20, try 1/2
|
|
199
|
+
Trying connect to https://www.hltv.org/stats/players?startDate=2024-01-01&endDate=2024-12-31&rankingFilter=Top20, try 2/2
|
|
200
|
+
Connection failed
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
* use_proxy: bool = False
|
|
204
|
+
|
|
205
|
+
Proxy Usage. No compatibility with max_delay (max_delay will be ignored)
|
|
206
|
+
|
|
207
|
+
* proxy_list: list | None = None
|
|
208
|
+
|
|
209
|
+
list of your proxies, if your proxies doesnt have any protocol you can use proxy_protocol
|
|
210
|
+
|
|
211
|
+
* proxy_path: str | None = None
|
|
212
|
+
|
|
213
|
+
Path to your proxy (proxy_list will be ignored). If your proxies doesnt have any protocol you can use proxy_protocol
|
|
214
|
+
|
|
215
|
+
* proxy_protocol: str | None = None,
|
|
216
|
+
|
|
217
|
+
Proxy protocol. Your proxies ```hltv = Hltv(proxy_protocol='http' ...) -> '11.11.11.11:1111' -> 'http://11.11.11.11:1111'
|
|
218
|
+
|
|
219
|
+
* proxy_one_time: bool = False
|
|
220
|
+
|
|
221
|
+
Removes proxy from list (proxy_path included) if connection unsuccessfull
|
|
222
|
+
|
|
223
|
+
* timeout: int = 5
|
|
224
|
+
|
|
225
|
+
Max time to close connection. Recommended to use timeout=1 if you are using random proxies.
|
|
226
|
+
|
|
227
|
+
* debug: bool = False
|
|
228
|
+
|
|
229
|
+
More loggs
|
|
230
|
+
|
|
231
|
+
* true_session=False
|
|
232
|
+
|
|
233
|
+
**(BETA)**
|
|
234
|
+
This parser automaticaly creating and clossing sessions after every use, if you want to let your session open even when parser is inactive
|
|
235
|
+
use this method. **!! IMPORTANT YOU SHOULD CLOSE YOUR SESSION BEFORE KILLING PROGRAM**
|
|
236
|
+
|
|
237
|
+
```
|
|
238
|
+
async def test():
|
|
239
|
+
hltv = Hltv(true_session=True)
|
|
240
|
+
print(await hltv.get_best_players())
|
|
241
|
+
print(await hltv.get_upcoming_matches())
|
|
242
|
+
await hltv.close_session()
|
|
243
|
+
|
|
244
|
+
if __name__ == "__main__":
|
|
245
|
+
asyncio.run(test())
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
# Examples
|
|
250
|
+
|
|
251
|
+
****Simple Example****
|
|
252
|
+
|
|
253
|
+
```
|
|
254
|
+
from hltv_async_api import Hltv
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
async def test():
|
|
258
|
+
|
|
259
|
+
hltv = Hltv()
|
|
260
|
+
|
|
261
|
+
print(await hltv.get_event_info(7148, 'pgl-cs2-major-copenhagen-2024'))
|
|
262
|
+
|
|
263
|
+
if __name__ == "__main__":
|
|
264
|
+
asyncio.run(test())
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
****Proxy Parser****
|
|
268
|
+
```
|
|
269
|
+
from hltv_async_api import Hltv
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
async def test():
|
|
273
|
+
|
|
274
|
+
hltv = Hltv(debug=True, use_proxy=True, proxy_path='proxy_test.txt', timeout=1, proxy_one_time=True, proxy_protocol='http')
|
|
275
|
+
|
|
276
|
+
print(await hltv.get_event_info(7148, 'pgl-cs2-major-copenhagen-2024'))
|
|
277
|
+
|
|
278
|
+
if __name__ == "__main__":
|
|
279
|
+
asyncio.run(test())
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
# Requirements:
|
|
284
|
+
|
|
285
|
+
Python 3.9+
|
|
286
|
+
|
|
287
|
+
License:
|
|
288
|
+
HLTV Async is licensed under the MIT License, allowing for personal and commercial use with minimal restrictions.
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
# hltv-async-api an unofficial asynchronous HLTV API Wrapper for Python
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
**This page not completed, not all methods and configs are written**
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
# Features
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
* **Simple Usage** (its realy simple)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
* **New and modern fully async library**
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
* **Supports proxy usage with huge amount of options**
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
# Installation
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
pip install hltv-async-api
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
# Simple Usage
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
from hltv_async_api import Hltv
|
|
34
|
+
|
|
35
|
+
hltv = Hltv()
|
|
36
|
+
live_matches = await hltv.get_live_matches()
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
# Proxy Usage
|
|
42
|
+
|
|
43
|
+
**Load Proxies from list**
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
proxy_list = ['http://120.234.203.171:9002', 'http://110.38.68.38:80']
|
|
47
|
+
|
|
48
|
+
hltv = Hltv(use_proxy=True, proxy_list=proxy_list)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**Load Proxies from file**
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
hltv = Hltv(use_proxy=True, proxy_path='PATH_TO_PROXY.TXT')
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
**One-time proxy**
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
hltv = Hltv(use_proxy=True, proxy_path='PATH_TO_PROXY.TXT', proxy_one_time=True)
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Protocol usage**
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
proxy_list = ['120.234.203.171:9002', '110.38.68.38:80']
|
|
68
|
+
|
|
69
|
+
hltv = Hltv(use_proxy=True, proxy_list=proxy_list, proxy_protocol='http')
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
# Methods
|
|
74
|
+
|
|
75
|
+
* **get_upcoming_matches(days: int = 7, min_star_rating: int = 1)**
|
|
76
|
+
|
|
77
|
+
-days (the number of days into the future to fetch matches for)
|
|
78
|
+
|
|
79
|
+
-min_star_rating (the minimum star rating for matches to include)
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
await hltv.get_upcoming_matches(1, 5)
|
|
83
|
+
|
|
84
|
+
>>> ['date': '11-11', 'matches': [id: '1111', team1: 'Natus Vincere' | 'TBD', team2: 'FaZe' | 'TBD', time: '14:15', maps: '3', stars: 5, 'PGL CS2 Major Copenhagen 2024' | None]]```
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
* **get_events(outgoing=True, future=True, max_events=10) -> [('id', 'title', 'startdate', 'enddate')]**
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
await hltv.get_events(future=False)
|
|
91
|
+
|
|
92
|
+
>>>{'id': '7437', 'name': 'IEM Chengdu 2024', 'start_date': '8-4', 'end_date': '14-4'}, {'id': '7757', 'name': 'BetBoom Dacha Belgrade 2024 Europe Closed Qualifier', 'start_date': '2-4', 'end_date': '12-4'}]
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
* **get_event_results(event_id: int | str)**
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
await get_event_results(7148)
|
|
101
|
+
|
|
102
|
+
>>> ['date': '31-3', 'matches': ['id': '1111', team1': 'FaZe', 'team2': 'Natus Vincere', 'score1': '1', 'score2': '2']]
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
* **get_event_matches(event_id: str | int):**
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
await hltv.get_event_matches(7148)
|
|
110
|
+
|
|
111
|
+
>>>[{'date': 'LIVE', 'matches': [{'id': '2371135', 'team1': 'GUN5', 'team2': 'KOI', 't1_id': '12471', 't2_id': '12591'}]}, {'date': '2024-04-08', 'matches': [{'id': '2371131', 'time': '20:00', 'team1': 'Aurora', 'team2': 'Metizport', 't1_id': '11861', 't2_id': '11641'}]}]
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
* **get_event_info(event_id: str | int, event_title: str) -> (event_id, event_title, event_start, event_end, prize, team_num, location, groups)**
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
await hltv.get_event_info(7148, 'PGL CS2 Major Copenhagen2024')
|
|
118
|
+
|
|
119
|
+
(7148, 'PGL CS2 Major Copenhagen2024', '21-3', '31-3', '$1,250,000', '16', 'Copenhagen, Denmark', [])
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
* **get_top_teams(max_teams=30) -> ['rank', 'title', 'points', 'change', 'id']**
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
await hltv.get_top_teams(2)
|
|
127
|
+
|
|
128
|
+
>>>[{'id': '1111', 'rank': '1', 'title': 'FaZe', 'points': '939', 'change': '-', 'id': '6667'}, {'id': '1111', 'rank': '2', 'title': 'Natus Vincere', 'points': '757', 'change': '+4', 'id': '4608'}]
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
* **get_team_info(team_id: int | str, title: str) -> (team_id, team_title, rank, [players], coach, average_age, weeks_in_top_20, last_trophy, total_trophys)**
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
await hltv.get_team_info(6667, 'faze')
|
|
135
|
+
|
|
136
|
+
>>>(6667, 'faze', '1', ['karrigan', 'rain', 'frozen', 'ropz', 'broky'], 'NEO', '26.5', '256', 'CS Asia Championships 2023', 21)
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
* **get_last_news(max_reg_news=2, only_today=True, only_featured=False) -> [date, [featured_id, featured_title, featured_desciption], [regular_id, reg_title, reg_time]]**
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
await hltv.get_last_news(only_today=True, max_reg_news=1)
|
|
143
|
+
|
|
144
|
+
>>>[{'date': '02-04', 'f_news': [{'f_id': '38682', 'f_title': 'NIP confirm r1nkle signing', 'f_desc': "Ninjas in Pyjamas only have an anchor player left to sign following the young Ukrainian AWPer's addition."}], 'news': [{'id': '38685', 'title': 'Rounds add sLowi, p3kko', 'posted': 'an hour ago'}, {'id': '38690', 'title': 'n1ssim returns to Sharks after paiN loan deal expires', 'posted': 'an hour ago'}]}]
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
* **get_best_players(top=40) -> ('rank', 'name', 'team', 'maps', 'rating')**
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
await hltv.get_best_players(2)
|
|
151
|
+
|
|
152
|
+
>>>[{'rank': 1, 'name': 'donk', 'team': 'Spirit', 'maps': '33', 'rating': '1.52'}, {'rank': 2, 'name': 'm0NESY', 'team': 'G2', 'maps': '34', 'rating': '1.38'}]
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
# Configs
|
|
157
|
+
|
|
158
|
+
* max_delay: int = 15
|
|
159
|
+
|
|
160
|
+
We automaticly increasing reconnecting delay by 1 sec to max_delay (from 1s to 5s)
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
hltv = Hltv(max_delay=5, use_proxy=False)
|
|
164
|
+
|
|
165
|
+
>>>Fetching https://www.hltv.org/matches/2370727/faze-vs-natus-vincere-pgl-cs2-major-copenhagen-2024, code: 403
|
|
166
|
+
>>>Got 403 forbitten
|
|
167
|
+
>>>Calling again, increasing delay to 4s
|
|
168
|
+
>>>Fetching https://www.hltv.org/matches/2370727/faze-vs-natus-vincere-pgl-cs2-major-copenhagen-2024, code: 403
|
|
169
|
+
>>>Got 403 forbitten
|
|
170
|
+
>>>Calling again, increasing delay to 5s
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
* max_retries: int = 0
|
|
174
|
+
|
|
175
|
+
Max retries. 0 or -1 for infinity tries.
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
hltv = Hltv(max_retries=2, debug=True)
|
|
179
|
+
print(await hltv.get_best_players())
|
|
180
|
+
|
|
181
|
+
Creating Session
|
|
182
|
+
Trying connect to https://www.hltv.org/stats/players?startDate=2024-01-01&endDate=2024-12-31&rankingFilter=Top20, try 1/2
|
|
183
|
+
Trying connect to https://www.hltv.org/stats/players?startDate=2024-01-01&endDate=2024-12-31&rankingFilter=Top20, try 2/2
|
|
184
|
+
Connection failed
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
* use_proxy: bool = False
|
|
188
|
+
|
|
189
|
+
Proxy Usage. No compatibility with max_delay (max_delay will be ignored)
|
|
190
|
+
|
|
191
|
+
* proxy_list: list | None = None
|
|
192
|
+
|
|
193
|
+
list of your proxies, if your proxies doesnt have any protocol you can use proxy_protocol
|
|
194
|
+
|
|
195
|
+
* proxy_path: str | None = None
|
|
196
|
+
|
|
197
|
+
Path to your proxy (proxy_list will be ignored). If your proxies doesnt have any protocol you can use proxy_protocol
|
|
198
|
+
|
|
199
|
+
* proxy_protocol: str | None = None,
|
|
200
|
+
|
|
201
|
+
Proxy protocol. Your proxies ```hltv = Hltv(proxy_protocol='http' ...) -> '11.11.11.11:1111' -> 'http://11.11.11.11:1111'
|
|
202
|
+
|
|
203
|
+
* proxy_one_time: bool = False
|
|
204
|
+
|
|
205
|
+
Removes proxy from list (proxy_path included) if connection unsuccessfull
|
|
206
|
+
|
|
207
|
+
* timeout: int = 5
|
|
208
|
+
|
|
209
|
+
Max time to close connection. Recommended to use timeout=1 if you are using random proxies.
|
|
210
|
+
|
|
211
|
+
* debug: bool = False
|
|
212
|
+
|
|
213
|
+
More loggs
|
|
214
|
+
|
|
215
|
+
* true_session=False
|
|
216
|
+
|
|
217
|
+
**(BETA)**
|
|
218
|
+
This parser automaticaly creating and clossing sessions after every use, if you want to let your session open even when parser is inactive
|
|
219
|
+
use this method. **!! IMPORTANT YOU SHOULD CLOSE YOUR SESSION BEFORE KILLING PROGRAM**
|
|
220
|
+
|
|
221
|
+
```
|
|
222
|
+
async def test():
|
|
223
|
+
hltv = Hltv(true_session=True)
|
|
224
|
+
print(await hltv.get_best_players())
|
|
225
|
+
print(await hltv.get_upcoming_matches())
|
|
226
|
+
await hltv.close_session()
|
|
227
|
+
|
|
228
|
+
if __name__ == "__main__":
|
|
229
|
+
asyncio.run(test())
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
# Examples
|
|
234
|
+
|
|
235
|
+
****Simple Example****
|
|
236
|
+
|
|
237
|
+
```
|
|
238
|
+
from hltv_async_api import Hltv
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
async def test():
|
|
242
|
+
|
|
243
|
+
hltv = Hltv()
|
|
244
|
+
|
|
245
|
+
print(await hltv.get_event_info(7148, 'pgl-cs2-major-copenhagen-2024'))
|
|
246
|
+
|
|
247
|
+
if __name__ == "__main__":
|
|
248
|
+
asyncio.run(test())
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
****Proxy Parser****
|
|
252
|
+
```
|
|
253
|
+
from hltv_async_api import Hltv
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
async def test():
|
|
257
|
+
|
|
258
|
+
hltv = Hltv(debug=True, use_proxy=True, proxy_path='proxy_test.txt', timeout=1, proxy_one_time=True, proxy_protocol='http')
|
|
259
|
+
|
|
260
|
+
print(await hltv.get_event_info(7148, 'pgl-cs2-major-copenhagen-2024'))
|
|
261
|
+
|
|
262
|
+
if __name__ == "__main__":
|
|
263
|
+
asyncio.run(test())
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
# Requirements:
|
|
268
|
+
|
|
269
|
+
Python 3.9+
|
|
270
|
+
|
|
271
|
+
License:
|
|
272
|
+
HLTV Async is licensed under the MIT License, allowing for personal and commercial use with minimal restrictions.
|