From db57ac411bfa424df98b0f37e6abdc2443754196 Mon Sep 17 00:00:00 2001 From: SecretlyTaco Date: Tue, 13 Sep 2016 04:59:12 +0100 Subject: [PATCH] Added function to get a list of player names from a team ID. Needs some heavy rewriting --- main.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index ce0bb15..4fd3b03 100644 --- a/main.py +++ b/main.py @@ -65,8 +65,15 @@ def top_players(): top_player_categories.append(category_obj) 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/") matchlist = matches.find_all("div", {"class": ["matchListBox", "matchListDateBox"]}) for match in matchlist: @@ -82,4 +89,4 @@ def getmatches(): print(match.text[:7].strip(), match.text[7:-7].strip()) if __name__ == "__main__": - print(top_players()) + get_players("5378")