1
0
Fork 0
mirror of https://github.com/SocksPls/hltv-api synced 2025-05-03 16:49:36 +00:00

Compare commits

..

No commits in common. "9a477b3eb97c020c7a49dd080f334244c1afdd6d" and "ab17ce1d30e232faa3fb8b006a0330ae90d7074d" have entirely different histories.

2 changed files with 8 additions and 9 deletions

View file

@ -299,14 +299,13 @@ Provides an API for HLTV
```python ```python
>>> hltv.get_matches() >>> hltv.get_matches()
[{'date': '2022-06-06', [{'date': '2020-11-10',
'event': b'WePlay Academy League Season 4', 'time': '15:00',
'team1': b'Astralis Talent', 'event': b'IEM Beijing-Haidian 2020 Europe',
'team2': b'Apeks Rebels', 'team1': b'Spirit',
'time': '18:10', 'team2': b'OG'},
'url': 'https://hltv.org/matches/2356247/esl-impact-league-season-1-finals-grand-final-esl-impact-league-season-1-finals'},
... ...
] }]
``` ```
## `get_results` ## `get_results`

View file

@ -5,14 +5,14 @@ from bs4 import BeautifulSoup
from python_utils import converters from python_utils import converters
import time import time
def get_parsed_page(url, delay=0.5): def get_parsed_page(url):
# This fixes a blocked by cloudflare error i've encountered # This fixes a blocked by cloudflare error i've encountered
headers = { headers = {
"referer": "https://www.hltv.org/stats", "referer": "https://www.hltv.org/stats",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)" "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"
} }
time.sleep(delay) time.sleep(0.5)
return BeautifulSoup(requests.get(url, headers=headers).text, "lxml") return BeautifulSoup(requests.get(url, headers=headers).text, "lxml")