Skip to content

Instantly share code, notes, and snippets.

@theSage21
Created June 8, 2015 12:22
Show Gist options
  • Save theSage21/0e5e68ff59b960f5870d to your computer and use it in GitHub Desktop.
Save theSage21/0e5e68ff59b960f5870d to your computer and use it in GitHub Desktop.
Order the proposal lists in pyconIndia
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