4
from dosage.helpers import BasicScraper, indirectStarter
7
class Zapiro(BasicScraper):
8
baseUrl = 'http://www.mg.co.za/zapiro/default.aspx'
9
imageUrl = 'http://www.mg.co.za/zapiro/imagePage.aspx?YearId=%s|MonthId=%s|DayId=%s'
10
imageSearch = compile(r'<img src=(http://www.mg.co.za/ContentImages/\d+/\d{2}-...\d{2}x\.gif) border=0 />')
11
prevSearch = compile(r'href="((?:/zapiro/)?[iI]magePage.aspx\?YearId=\d{4}\|MonthId=\d{1,2}\|DayId=\d{1,2})"')
12
latestSearch = compile(r'<a href="(imagePage.aspx\?YearId=\d{4}\|MonthId=\d{1,2}\|DayId=\d{1,2})">')
13
help = 'Index format: yyyy-mm-dd'
15
starter = indirectStarter('http://www.mg.co.za/zapiro/default.aspx', compile(r'<a href="(imagePage.aspx\?YearId=\d{4}\|MonthId=\d{1,2}\|DayId=\d{1,2})">'))
17
def setStrip(self, index):
18
self.currentUrl = self.imageUrl % tuple(map(int, index.split('-')))
20
def namer(cls, imageUrl, pageUrl):
21
values = [a.split('=') for a in urllib.splitquery(pageUrl)[-1].split('|')]
22
d = dict([(name, int(value)) for name, value in values])
23
return 'zapiro-%(YearId)02d%(MonthId)02d%(DayId)02d' % d
26
class ZombieHunters(BasicScraper):
27
latestUrl = 'http://www.thezombiehunters.com/'
28
imageUrl = 'http://www.thezombiehunters.com/index.php?strip_id=%s'
29
imageSearch = compile(r'"(.+?strips/.+?)"')
30
prevSearch = compile(r'"(.+?)">\r\n.+?Pre')
31
help = 'Index format: n(unpadded)'