1
0
Fork 0
mirror of https://github.com/SocksPls/hltv-api synced 2025-05-02 00:09:34 +00:00

Compare commits

...

7 commits

Author SHA1 Message Date
David Silva
ab17ce1d30 fix(get_matches): add hltv domain to url 2022-05-28 14:22:37 +02:00
David Silva
f296947331
Merge pull request #25 from grantephross/patch-1
Adds URL to get_matches()
2022-05-28 14:20:52 +02:00
David Silva
6a8f695dbe fix(get_parsed_page): introduce small sleep to help with CF 2022-05-28 14:20:39 +02:00
David Silva
d45f833c05 fix(requirements): beautifulsoup version to 4.11.1 2022-05-28 14:18:22 +02:00
David Silva
92fb6f66b3
Merge pull request #26 from SocksPls/fix-beautifulsoup
fix(requirements): beautifulsoup version
2022-05-28 14:16:10 +02:00
David Silva
1cea969b82 fix(requirements): beautifulsoup version 2022-05-28 14:12:10 +02:00
grantephross
1ce33609cc
Adds URL to get_matches()
Allows you to get matchid/match page url info out of the API for upcoming matches
2022-05-28 00:41:52 -05:00
2 changed files with 5 additions and 2 deletions

View file

@ -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()

View file

@ -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