Difference between
modified post 128 by iggykoopa on Mon 26th Jan 03:51 and
original post 126 by iggykoopa on Mon 26th Jan 02:47
Show old version | new version | both versions
| 1 | 1 | #!/usr/bin/env python | |
| 3 | 3 | import urllib2 | |
| 4 | 4 | from BeautifulSoup import BeautifulSoup | |
| 6 | 6 | address = "http://distrowatch.com/" | |
| 7 | 7 | try: | |
| 8 | 8 | website = urllib2.urlopen(address) | |
| 9 | 9 | soup = BeautifulSoup(''.join(website)) | |
| 10 | - | rankings = soup.find(text= "Page Hit Ranking").parent.parent.parent.find(text="CrunchBang").parent.parent.parent.find("th").string | |
| 10 | + | rankings = soup.find(text= "Page Hit Ranking").findParent("table").find(text="CrunchBang").findParent("tr").find("th").string | |
| 11 | 11 | print rankings | |
| 12 | 12 | except: | |
| 13 | 13 | print "Not Available" |