mirror of
https://github.com/SocksPls/hltv-api
synced 2025-05-03 16:49:36 +00:00
Compare commits
No commits in common. "ab17ce1d30e232faa3fb8b006a0330ae90d7074d" and "b2c500015b9308c5b4f1adcd31a532696d2387e5" have entirely different histories.
ab17ce1d30
...
b2c500015b
2 changed files with 2 additions and 5 deletions
5
main.py
5
main.py
|
@ -3,7 +3,7 @@ import requests
|
||||||
import datetime
|
import datetime
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
from python_utils import converters
|
from python_utils import converters
|
||||||
import time
|
|
||||||
|
|
||||||
def get_parsed_page(url):
|
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
|
||||||
|
@ -12,8 +12,6 @@ def get_parsed_page(url):
|
||||||
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"
|
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"
|
||||||
}
|
}
|
||||||
|
|
||||||
time.sleep(0.5)
|
|
||||||
|
|
||||||
return BeautifulSoup(requests.get(url, headers=headers).text, "lxml")
|
return BeautifulSoup(requests.get(url, headers=headers).text, "lxml")
|
||||||
|
|
||||||
|
|
||||||
|
@ -234,7 +232,6 @@ def get_matches():
|
||||||
matchObj = {}
|
matchObj = {}
|
||||||
|
|
||||||
matchObj['date'] = date
|
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
|
matchObj['time'] = getMatch.find("div", {"class": "matchTime"}).text
|
||||||
if getMatch.find("div", {"class": "matchEvent"}):
|
if getMatch.find("div", {"class": "matchEvent"}):
|
||||||
matchObj['event'] = getMatch.find("div", {"class": "matchEvent"}).text.encode('utf8').strip()
|
matchObj['event'] = getMatch.find("div", {"class": "matchEvent"}).text.encode('utf8').strip()
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
beautifulsoup4==4.11.1
|
beautifulsoup4==4.5.1
|
||||||
bs4==0.0.1
|
bs4==0.0.1
|
||||||
lxml==4.6.5
|
lxml==4.6.5
|
||||||
python-utils==2.0.0
|
python-utils==2.0.0
|
||||||
|
|
Loading…
Add table
Reference in a new issue