1
0
Fork 0
mirror of https://github.com/SocksPls/hltv-api synced 2025-04-29 23:23:08 +00:00

Not sure if this workaround is better or worse than the old one, but this one works for more people

This commit is contained in:
SecretlyTaco 2016-09-12 15:14:43 +01:00
parent 8f871233bd
commit eb0c02a5f8

View file

@ -3,7 +3,6 @@ import json
from bs4 import BeautifulSoup
from python_utils import converters
def get_parsed_page(url):
return BeautifulSoup(requests.get(url).text, "lxml")
@ -38,8 +37,9 @@ def top20teams():
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"
if player['name'].startswith("[email"):
player_page = get_parsed_page(str("http://www.hltv.org" + player_anchor['href']))
player['name'] = player_page.title.text.split()[0]
newteam['team-players'].append(player)
teamlist.append(newteam)
return teamlist