mirror of
https://github.com/SocksPls/hltv-api
synced 2025-04-29 23:23:08 +00:00
resolve PR to pattern
This commit is contained in:
parent
4b6cde2cf6
commit
1671d93c24
1 changed files with 12 additions and 7 deletions
19
main.py
19
main.py
|
@ -337,17 +337,23 @@ def _get_matches_by_team(table):
|
|||
|
||||
for row in rows[0:len(rows)]:
|
||||
match = {}
|
||||
match['date'] = row.find(
|
||||
"td", {"class": "date-cell"}).find("span").text
|
||||
dateArr = (row.find(
|
||||
"td", {"class": "date-cell"}).find("span").text).split('/')
|
||||
|
||||
dateTextFromArrPadded = _padIfNeeded(dateArr[2]) + "-" + _padIfNeeded(dateArr[1]) + "-" + _padIfNeeded(dateArr[0])
|
||||
|
||||
dateFromHLTV = datetime.datetime.strptime(dateTextFromArrPadded,'%Y-%m-%d').replace(tzinfo=HLTV_ZONEINFO)
|
||||
dateFromHLTV = dateFromHLTV.astimezone(LOCAL_ZONEINFO)
|
||||
|
||||
date = dateFromHLTV.strftime('%Y-%m-%d')
|
||||
match['date'] = date
|
||||
match['teams'] = {}
|
||||
match['teams']["team_1"] = row.find(
|
||||
"td", {"class": "team-center-cell"}).find("a", {"class": "team-name team-1"}).text
|
||||
match['teams']["team_1_id"] = row.find(
|
||||
"td", {"class": "team-center-cell"}).find("a", {"class": "team-name team-1"})['href'].split('/')[2]
|
||||
match['teams']["team_1_id"] = _findTeamId(row.find( "td", {"class": "team-center-cell"}).find("a", {"class": "team-name team-1"}).text)
|
||||
match['teams']["team_2"] = row.find(
|
||||
"td", {"class": "team-center-cell"}).find("a", {"class": "team-name team-2"}).text
|
||||
match['teams']["team_2_id"] = row.find(
|
||||
"td", {"class": "team-center-cell"}).find("a", {"class": "team-name team-2"})['href'].split('/')[2]
|
||||
match['teams']["team_2_id"] = _findTeamId(row.find( "td", {"class": "team-center-cell"}).find("a", {"class": "team-name team-2"}).text)
|
||||
match["confront_name"] = match['teams']["team_1"] + \
|
||||
" X " + match['teams']["team_2"]
|
||||
match["championship"] = event_name
|
||||
|
@ -355,7 +361,6 @@ def _get_matches_by_team(table):
|
|||
"td", {"class": "matchpage-button-cell"}).find("a")['href']
|
||||
match['time'] = get_parsed_page("https://www.hltv.org" + match_url).find(
|
||||
'div', {"class": "timeAndEvent"}).find('div', {"class": "time"}).text
|
||||
match['full_time'] = match['date'] + ' at ' + match['time']
|
||||
matches.append(match)
|
||||
|
||||
return matches
|
||||
|
|
Loading…
Add table
Reference in a new issue