mirror of
https://github.com/SocksPls/hltv-api
synced 2025-04-29 15:13:08 +00:00
Updated code, added extra info to get_match_result_stats
This commit is contained in:
parent
612291c883
commit
9bfac9126c
1 changed files with 6 additions and 3 deletions
9
main.py
9
main.py
|
@ -68,7 +68,7 @@ def get_parsed_page(url, delay=0.5, max_trys = 100, verbose = True):
|
||||||
results = BeautifulSoup(req.text, "lxml")
|
results = BeautifulSoup(req.text, "lxml")
|
||||||
return results
|
return results
|
||||||
|
|
||||||
def get_parsed_page_matches(url, delay=0.5, max_trys = 100, verbose = True):
|
def get_parsed_page_matches(url, delay=1, max_trys = 100, verbose = True):
|
||||||
# This fixes a blocked error when trying to get game results page
|
# This fixes a blocked error when trying to get game results page
|
||||||
headers = {
|
headers = {
|
||||||
"referer": "https://www.hltv.org/matches", ## Have changed referer
|
"referer": "https://www.hltv.org/matches", ## Have changed referer
|
||||||
|
@ -567,8 +567,11 @@ def get_match_result_stats(match_id):
|
||||||
|
|
||||||
match_stats['match-id'] = match_id
|
match_stats['match-id'] = match_id
|
||||||
match_stats['match_type'] = results.find('div', attrs={'class': 'padding preformatted-text'}).text.strip().split('\n')[0]
|
match_stats['match_type'] = results.find('div', attrs={'class': 'padding preformatted-text'}).text.strip().split('\n')[0]
|
||||||
match_stats['match_stage'] = results.find('div', attrs={'class': 'padding preformatted-text'}).text.strip().split('\n')[2
|
match_stats['match_stage'] = results.find('div', attrs={'class': 'padding preformatted-text'}).text.strip().split('\n')[2]
|
||||||
]
|
rank_list = results.find_all('div', attrs={'class': 'teamRanking'})
|
||||||
|
match_stats['team1_Ranking'] = rank_list[0].find('a').contents[1].strip('#')
|
||||||
|
match_stats['team2_Ranking'] = rank_list[1].find('a').contents[1].strip('#')
|
||||||
|
|
||||||
return match_stats
|
return match_stats
|
||||||
|
|
||||||
def get_past_player_stats_for_match(match_id):
|
def get_past_player_stats_for_match(match_id):
|
||||||
|
|
Loading…
Add table
Reference in a new issue