mirror of
https://github.com/SocksPls/hltv-api
synced 2025-04-30 07:33:09 +00:00
fix issue with some player links being in a different format
This commit is contained in:
parent
fb9d645f6e
commit
43c5156984
1 changed files with 6 additions and 1 deletions
7
main.py
7
main.py
|
@ -32,7 +32,12 @@ def top20teams():
|
|||
for player_div in team.select('.ranking-lineup > div'):
|
||||
player = {}
|
||||
player_anchor = player_div.select('.ranking-playerNick > a')[0]
|
||||
player['player-id'] = converters.to_int(player_anchor.get('href'), regexp=True)
|
||||
player['name'] = player_anchor.text.strip()
|
||||
player_link = player_anchor.get('href')
|
||||
if 'pageid' in player_link:
|
||||
player['player-id'] = converters.to_int(player_link[player_link.index('playerid'):], regexp=True)
|
||||
else:
|
||||
player['player-id'] = converters.to_int(player_link, regexp=True)
|
||||
if player['player-id'] == 1916:
|
||||
player['name'] = "seang@res"
|
||||
newteam['team-players'].append(player)
|
||||
|
|
Loading…
Add table
Reference in a new issue