From d5403101a93d60a487f928809392ee568ef7f476 Mon Sep 17 00:00:00 2001 From: SecretlyTaco Date: Mon, 12 Sep 2016 17:16:46 +0100 Subject: [PATCH] Added function to get top 5 players in each category. Not yet formatted to JSON/Dict --- main.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 6963cfe..1a90429 100644 --- a/main.py +++ b/main.py @@ -45,6 +45,13 @@ def top20teams(): return teamlist +def topplayers(): + page = get_parsed_page("http://www.hltv.org/?pageid=348&statsfilter=10&mapid=0") + boxes = page.find_all("div", {"class": "framedBox"}) + for box in boxes: + print(box.find("h2").text) + for player in box.find_all("div", {"style":["background-color: #E8E8E8;;padding:5px;", ";padding:5px;"]}): + print "* ", player.text.replace(")", ") ") def getmatches(): matches = get_parsed_page("http://www.hltv.org/matches/") @@ -62,4 +69,4 @@ def getmatches(): print(match.text[:7].strip(), match.text[7:-7].strip()) if __name__ == "__main__": - print(top20teams()) + topplayers()