You are not logged in.
This is more a request
I'd like to have a python script that simply returns Arch Linux ranking on distrowatch.com to display on conky
When I check the code of distrowatch the part of the code concercing Arch's ranking is:
<tr>
<th class="News">9</th>
<td class="News"><a href="arch">Arch</a></td>
<td class="News" style="text-align: right" title="Yesterday: 794">796<img src="images/other/aup.png" alt=">" title="Yesterday: 794"></td>
</tr>
Last edited by willxtreme (2010-01-14 15:54:13)
Offline
Okay solved :D:D
in 3 steps
1) Download Beautiful Soup for Python & copy BeautifulSoup.py to /usr/lib/python2.6/site-packages
2) Create ranking.py containing:
#!/usr/bin/env python
import urllib2
from BeautifulSoup import BeautifulSoup
address = "http://distrowatch.com/"
try:
website = urllib2.urlopen(address)
soup = BeautifulSoup(''.join(website))
rankings = soup.find(text= "Page Hit Ranking").findParent("table").find(text="Arch").findParent("tr").find("th").string
print rankings
except:
print "N/A"
3) Add in .conkyrc
Distrowatch's Ranking: $alignr ${execi 7200 python ~/.scripts/ranking.py}
credits to iggykoopa
Last edited by willxtreme (2010-01-14 16:08:30)
Offline
could we sticky this for the day? pleae mods I want to try this as soon as I get home. but stuck at work on windoze machines :-/
Offline
I'm sure you have email...
Offline
And it's added in the wiki
NICE!
Offline