Created
June 8, 2015 12:22
-
-
Save theSage21/0e5e68ff59b960f5870d to your computer and use it in GitHub Desktop.
Order the proposal lists in pyconIndia
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 as BS | |
from urllib2 import urlopen | |
html = urlopen('https://in.pycon.org/cfp/pycon-india-2015/proposals/') | |
html = ''.join(html.readlines()) | |
html[:30] | |
soup = BS(html) | |
soup.find_all('div',{'class':'user-proposals'}) | |
proposals=soup.find_all('div',{'class':'user-proposals'}) | |
ordered = [] | |
for p in proposals: | |
stats=p.find_all('div',{'class':'proposal-stats'}) | |
tags = stats[0].text.strip().split('\n') | |
votes = int(tags[0]) | |
name = p.find_all('h3', {'class':'proposal--title'})[0].text.strip() | |
ordered.append([votes, name]) | |
ordered.sort() | |
for v,t in ordered: | |
print v,t |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment