WikiLeaks Cablegate Count


Today, I wrote a small script to get the count of released WikiLeaks cables. Actually, it’s extremely small. Just two lines of code.

import urllib, piksemel, re

wleaks = int(re.search(r"(d+) / [0-9,]+", piksemel.parseString(urllib.urlopen("http://cablegate.wikileaks.org/index.html").read()).getTag("body").getTag("div").getTag("div").getTag("a").getTag("p").toString()).groups()[0])

Generally, I don’t code like this. But I wanted to write it quick (5 minutes?) and keep it short. It uses piksemel to parse the page.

Enjoy!