Created
July 28, 2017 21:19
-
-
Save msaroufim/f8384d0d8e4c9580f9e55c3d1b1100e5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bs4 import BeautifulSoup | |
import requests | |
import csv | |
leaderboard_root_url = 'http://www.dota2.com/leaderboards#' | |
regions = ['americas','europe', 'se_asia', 'china'] | |
for region in regions: | |
page = requests.get(leaderboard_root_url + region).content | |
soup = BeautifulSoup(page, "html5lib") | |
soup.prettify() | |
leaderboard_table_rows = soup.find("tbody", {"id" : "leaderboard_body"}).findAll("tr") | |
for row_number, row in enumerate(leaderboard_table_rows): | |
cells = row.findAll("td") | |
print(td[2][2].text) | |
print(td[2][3].text) | |
print(td[3].text) | |
team_tag = row.find("td:nth-child(2) > span.team_tag") | |
player_name = row.find("td:nth-child(2) > span.team_tag") | |
solo_mmr = row.find("td:nth-child(3)") | |
# print(team_tag,player_name,solo_mmr,region) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment