Skip to content

Instantly share code, notes, and snippets.

@czobrisky
Last active July 1, 2016 16:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save czobrisky/9690e84934bfa2f2c7112d6eba817e01 to your computer and use it in GitHub Desktop.
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.
#!/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