/usr/share/pyshared/dosage/plugins/x.py is in dosage 1.6.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | from re import compile
from dosage.helpers import BasicScraper, bounceStarter
class xkcd(BasicScraper):
starter = bounceStarter('http://xkcd.com/', compile(r'<a href="(/?\d+/?)"[^>]*>Next'))
imageUrl = 'http://xkcd.com/c%s.html'
imageSearch = compile(r'<img[^<]+src="(http://imgs.xkcd.com/comics/[^<>"]+)"')
prevSearch = compile(r'<a href="(/?\d+/?)"[^>]*>< Prev')
help = 'Index format: n (unpadded)'
def namer(cls, imageUrl, pageUrl):
index = int(pageUrl.rstrip('/').split('/')[-1])
name = imageUrl.split('/')[-1].split('.')[0]
return 'c%03d-%s' % (index, name)
|