1
0
Fork 0
mirror of https://github.com/SocksPls/hltv-api synced 2025-04-30 15:43:07 +00:00

Added function to get a list of player names from a team ID. Needs some heavy rewriting

This commit is contained in:
SecretlyTaco 2016-09-13 04:59:12 +01:00
parent 27d0785ddb
commit db57ac411b

11
main.py
View file

@ -65,8 +65,15 @@ def top_players():
top_player_categories.append(category_obj) top_player_categories.append(category_obj)
return top_player_categories return top_player_categories
def get_players(teamid):
page = get_parsed_page("http://www.hltv.org/?pageid=362&teamid=" + teamid)
titlebox = page.find("div", {"class": "centerFade"})
players = []
for player in titlebox.find_all("div")[5:25]:
players.append(player.text.strip())
print [x for x in set(players) if x is not u'']
def getmatches(): def get_matches():
matches = get_parsed_page("http://www.hltv.org/matches/") matches = get_parsed_page("http://www.hltv.org/matches/")
matchlist = matches.find_all("div", {"class": ["matchListBox", "matchListDateBox"]}) matchlist = matches.find_all("div", {"class": ["matchListBox", "matchListDateBox"]})
for match in matchlist: for match in matchlist:
@ -82,4 +89,4 @@ def getmatches():
print(match.text[:7].strip(), match.text[7:-7].strip()) print(match.text[:7].strip(), match.text[7:-7].strip())
if __name__ == "__main__": if __name__ == "__main__":
print(top_players()) get_players("5378")