public
Created

  • Download Gist
members-of-parliment.py
Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#!usr/bin/python
 
import urllib
from lxml import etree
import StringIO
 
url = "http://164.100.47.132/LssNew/Members/Alphabaticallist.aspx"
result = urllib.urlopen(url)
html = result.read()
 
parser = etree.HTMLParser()
tree = etree.parse(StringIO.StringIO(html), parser)
 
xpath = "//table[@id='ctl00_ContPlaceHolderMain_Alphabaticallist1_dg1']/tr[position()>1]/td[position()=2]/a/child::text()"
filtered_html = tree.xpath(xpath)
 
print filtered_html

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.