Extracting from HTML with beautifulsoup



I try to extract lotto numbers from http://ift.tt/XkOn9T (I know there is an easier way, but it's rather for learning).


These are the numbers I want to extract:


Tried with Python, beautifulsoup the following:



from BeautifulSoup import BeautifulSoup
import urllib2

url="http://ift.tt/XkOn9T"
page=urllib2.urlopen(url)
soup = BeautifulSoup(page.read())
numbers=soup.findAll('li',{'class':'winning_numbers.boxRow.clearfix'})

for number in numbers:
print number['li']+","+number.string


Returns nothing, which I actually expected. I read the tutorial, but still didn't understand the parsing totally. Could someone give me a hint?


Thank you!


No comments:

Post a Comment