Created
August 1, 2014 18:49
-
-
Save jsanz/089c34f3d3f767d2bd42 to your computer and use it in GitHub Desktop.
Scrap Charter Members lines for electronic voting
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
# Simple script to take from the OSGeo wiki the data to | |
# print on the console the lines to be used on the | |
# electronic voting system to produce meaninful | |
# questions with links and info. | |
from BeautifulSoup import BeautifulSoup | |
import urllib | |
nominations_url = 'http://wiki.osgeo.org/wiki/New_Member_Nominations_2014' | |
response = urllib.urlopen(nominations_url) | |
html_doc = response.read() | |
soup = BeautifulSoup(html_doc) | |
table = soup.findAll('table','wikitable')[0] | |
for tr in table.findAll('tr')[1:]: | |
tds = tr.findAll('td') | |
num = tds[0].span.string.strip().encode('utf-8') | |
aName = tds[1].findAll('a') | |
if len(aName)>0: | |
name = aName[0].string.strip().encode('utf-8') | |
else: | |
name = tds[1].findAll('i')[0].string.strip().encode('utf-8') | |
country = tds[2].findAll(['i'])[0].string | |
nabble_name = '+'.join([ 'message%3A{}'.format(urllib.quote_plus(word)) for word in name.split()]) | |
nabble_search = '<a href="http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=search_page&node=3842115&query={}+author%3A%22Jorge+Sanz%22&days=30">discussion</a>'.format(nabble_name) | |
print "<a href=\"{}#{}\">{}</a> - {} - {}".format(nominations_url,num,name,country,nabble_search) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment