mirror of
https://github.com/SocksPls/hltv-api
synced 2025-05-02 00:09:34 +00:00
Compare commits
7 commits
b2c500015b
...
ab17ce1d30
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ab17ce1d30 | ||
![]() |
f296947331 | ||
![]() |
6a8f695dbe | ||
![]() |
d45f833c05 | ||
![]() |
92fb6f66b3 | ||
![]() |
1cea969b82 | ||
![]() |
1ce33609cc |
2 changed files with 5 additions and 2 deletions
5
main.py
5
main.py
|
@ -3,7 +3,7 @@ import requests
|
|||
import datetime
|
||||
from bs4 import BeautifulSoup
|
||||
from python_utils import converters
|
||||
|
||||
import time
|
||||
|
||||
def get_parsed_page(url):
|
||||
# This fixes a blocked by cloudflare error i've encountered
|
||||
|
@ -12,6 +12,8 @@ def get_parsed_page(url):
|
|||
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"
|
||||
}
|
||||
|
||||
time.sleep(0.5)
|
||||
|
||||
return BeautifulSoup(requests.get(url, headers=headers).text, "lxml")
|
||||
|
||||
|
||||
|
@ -232,6 +234,7 @@ def get_matches():
|
|||
matchObj = {}
|
||||
|
||||
matchObj['date'] = date
|
||||
matchObj['url'] = "https://hltv.org" + match.find("a", {"class": "match a-reset"}).get("href")
|
||||
matchObj['time'] = getMatch.find("div", {"class": "matchTime"}).text
|
||||
if getMatch.find("div", {"class": "matchEvent"}):
|
||||
matchObj['event'] = getMatch.find("div", {"class": "matchEvent"}).text.encode('utf8').strip()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
beautifulsoup4==4.5.1
|
||||
beautifulsoup4==4.11.1
|
||||
bs4==0.0.1
|
||||
lxml==4.6.5
|
||||
python-utils==2.0.0
|
||||
|
|
Loading…
Add table
Reference in a new issue