Last active
July 1, 2016 16:49
-
-
Save czobrisky/9690e84934bfa2f2c7112d6eba817e01 to your computer and use it in GitHub Desktop.
Get the free hero rotation for the current week from the battle.net forums post.
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
#!/usr/local/bin/python2.7 | |
import requests | |
from bs4 import BeautifulSoup | |
#grab the free hero rotation page | |
heroPage = requests.get('http://us.battle.net/heroes/en/forum/topic/17936383460') | |
#soupify it | |
soup = BeautifulSoup(''.join(heroPage),'html.parser') | |
#grab the first post-detail which is the current rotation | |
postContent = soup.find('div', class_='post-detail') | |
heroList =[] | |
#get the ul which is the hero list | |
ul = postContent.find('ul') | |
#add it to a list | |
for li in ul.findAll('li',text=True): | |
heroList.append(li.text) | |
#print it...probably should take and put it in a json and then print/return but yeah | |
print heroList |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment