hltv-async-api 0.2.5__tar.gz → 0.2.6__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.2.5 → hltv_async_api-0.2.6}/PKG-INFO +1 -1
- {hltv_async_api-0.2.5 → hltv_async_api-0.2.6}/hltv_async_api/__init__.py +1 -1
- {hltv_async_api-0.2.5 → hltv_async_api-0.2.6}/hltv_async_api/aiohltv.py +52 -10
- {hltv_async_api-0.2.5 → hltv_async_api-0.2.6}/hltv_async_api.egg-info/PKG-INFO +1 -1
- {hltv_async_api-0.2.5 → hltv_async_api-0.2.6}/pyproject.toml +1 -1
- {hltv_async_api-0.2.5 → hltv_async_api-0.2.6}/setup.py +1 -1
- {hltv_async_api-0.2.5 → hltv_async_api-0.2.6}/LICENSE +0 -0
- {hltv_async_api-0.2.5 → hltv_async_api-0.2.6}/README.md +0 -0
- {hltv_async_api-0.2.5 → hltv_async_api-0.2.6}/hltv_async_api.egg-info/SOURCES.txt +0 -0
- {hltv_async_api-0.2.5 → hltv_async_api-0.2.6}/hltv_async_api.egg-info/dependency_links.txt +0 -0
- {hltv_async_api-0.2.5 → hltv_async_api-0.2.6}/hltv_async_api.egg-info/top_level.txt +0 -0
- {hltv_async_api-0.2.5 → hltv_async_api-0.2.6}/setup.cfg +0 -0
|
@@ -86,8 +86,8 @@ class Hltv:
|
|
|
86
86
|
else:
|
|
87
87
|
proxy = self.PROXY_LIST[0]
|
|
88
88
|
|
|
89
|
-
if self.PROXY_PROTOCOL
|
|
90
|
-
|
|
89
|
+
if self.PROXY_PROTOCOL and proxy != '' and self.PROXY_PROTOCOL not in proxy:
|
|
90
|
+
proxy = self.PROXY_PROTOCOL + '://' + proxy
|
|
91
91
|
|
|
92
92
|
return proxy
|
|
93
93
|
|
|
@@ -213,18 +213,60 @@ class Hltv:
|
|
|
213
213
|
stars = [line.get('stars') for line in liveMatchContainer]
|
|
214
214
|
return [{'teams': teams, 'maps': maps, 'stars': stars} for teams, maps, stars in zip(matches, maps, stars)]
|
|
215
215
|
|
|
216
|
-
async def get_upcoming_matches(self):
|
|
216
|
+
async def get_upcoming_matches(self, days: int = 7, star_rating: int = 1):
|
|
217
217
|
"""returns a list of all upcoming matches on HLTV"""
|
|
218
218
|
r = await self.fetch("https://www.hltv.org/matches")
|
|
219
|
-
if not r:
|
|
220
|
-
|
|
219
|
+
if not r:return
|
|
220
|
+
|
|
221
|
+
matches = []
|
|
221
222
|
try:
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
223
|
+
|
|
224
|
+
days = 7
|
|
225
|
+
for i, date_div in enumerate(r.find_all('div', {'class': 'upcomingMatchesSection'}), start=1):
|
|
226
|
+
if i > days:
|
|
227
|
+
break
|
|
228
|
+
date_ = date_div.find('span', {'class': 'matchDayHeadline'}).text.split()[-1]
|
|
229
|
+
matches_today = []
|
|
230
|
+
|
|
231
|
+
for match in date_div.find_all('div', {'class': 'upcomingMatch'}):
|
|
232
|
+
time_ = match.find('div', {'class': 'matchTime'}).text
|
|
233
|
+
rating = int(match['stars'])
|
|
234
|
+
if rating >= star_rating:
|
|
235
|
+
maps = match.find('div', {'class': 'matchMeta'}).text[-1:]
|
|
236
|
+
try:
|
|
237
|
+
teams = match.find_all('div', {'class': 'matchTeamName text-ellipsis'})
|
|
238
|
+
|
|
239
|
+
team1 = teams[0].text
|
|
240
|
+
team2 = teams[1].text
|
|
241
|
+
except (IndexError, AttributeError):
|
|
242
|
+
team1 = 'TBD'
|
|
243
|
+
team2 = 'TBD'
|
|
244
|
+
|
|
245
|
+
try:
|
|
246
|
+
event = match.find('div', {'class', 'matchEventName gtSmartphone-only'}).text
|
|
247
|
+
except AttributeError:
|
|
248
|
+
|
|
249
|
+
try:
|
|
250
|
+
event = match.find('span', {'class': 'line-clamp-3'}).text
|
|
251
|
+
except AttributeError:
|
|
252
|
+
event = ''
|
|
253
|
+
|
|
254
|
+
matches_today.append({
|
|
255
|
+
'team1': team1,
|
|
256
|
+
'team2': team2,
|
|
257
|
+
'time': time_,
|
|
258
|
+
'maps': maps,
|
|
259
|
+
'rating': rating,
|
|
260
|
+
'event': event
|
|
261
|
+
})
|
|
262
|
+
|
|
263
|
+
matches.append({
|
|
264
|
+
'date': date_,
|
|
265
|
+
'matches': matches_today
|
|
266
|
+
})
|
|
225
267
|
except AttributeError:
|
|
226
268
|
return None
|
|
227
|
-
return
|
|
269
|
+
return matches
|
|
228
270
|
|
|
229
271
|
async def get_important_upcoming_matches(self, star_rating=1):
|
|
230
272
|
"""returns a list of all upcoming matches on HLTV with the star rating argument (should be between 0 and 5)"""
|
|
@@ -597,7 +639,7 @@ class Hltv:
|
|
|
597
639
|
|
|
598
640
|
async def test():
|
|
599
641
|
hltv = Hltv()
|
|
600
|
-
print(await hltv.
|
|
642
|
+
print(await hltv.get_upcoming_matches())
|
|
601
643
|
|
|
602
644
|
|
|
603
645
|
if __name__ == "__main__":
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|