from re import compile, IGNORECASE from ..helpers import _BasicScraper, bounceStarter, queryNamer class PartiallyClips(_BasicScraper): latestUrl = 'http://www.partiallyclips.com/' imageUrl = 'http://www.partiallyclips.com/index.php?id=%s' imageSearch = compile(r'"(http://www.partiallyclips.com/storage/.+?)"') prevSearch = compile(r'"(index.php\?id=.+?)".+?prev') help = 'Index format: nnnn' class PastelDefender(_BasicScraper): latestUrl = 'http://www.pasteldefender.com/coverbackcover.html' imageUrl = 'http://www.pasteldefender.com/%s.html' imageSearch = compile(r'First Comic)Archives/Strip.+?|(?=.+?">Previous Comic)(?!.+?">First Comic)Strip.+?)"') help = 'Index format: n (unpadded)' class PennyAndAggie(_BasicScraper): latestUrl = 'http://www.pennyandaggie.com/index.php' imageUrl = 'http://www.pennyandaggie.com/index.php\?p=%s' imageSearch = compile(r'src=".+?(/comics/.+?)"') prevSearch = compile(r"Next')) imageUrl = 'http://www.penny-arcade.com/comic/%s/' imageSearch = compile(r'(?Back') help = 'Index format: yyyy/mm/dd' @classmethod def namer(cls, imageUrl, pageUrl): yyyy, mm, dd = pageUrl.split('/')[-4:-1] return '%04d%02d%02d' % (int(yyyy), int(mm), int(dd)) class PeppermintSaga(_BasicScraper): latestUrl = 'http://www.pepsaga.com/' imageUrl = 'http://www.pepsaga.com/comics/%s/' imageSearch = compile(r'src=.+?(http.+?/comics/.+?)"') prevSearch = compile(r'FirstPrev') help = 'Index format: mm/dd/yyyy' class Pixel(_BasicScraper): latestUrl = 'http://www.chrisdlugosz.net/pixel/' imageUrl = 'http://www.chrisdlugosz.net/pixel/%s.shtml' imageSearch = compile(r'

') prevSearch = compile(r'') help = 'Index format: nnn' class PiledHigherAndDeeper(_BasicScraper): starter = bounceStarter('http://www.phdcomics.com/comics/archive.php', compile(r'')) imageUrl = 'http://www.phdcomics.com/comics/archive.php?comicid=%s' imageSearch = compile(r'') help = 'Index format: n (unpadded)' namer = queryNamer('comicid', usePageUrl=True) class Precocious(_BasicScraper): latestUrl = 'http://www.precociouscomic.com/' imageUrl = 'http://www.precociouscomic.com/comic.php?page=%s' imageSearch = compile(r'(archive/strips/.+?)"') prevSearch = compile(r'First.+?(comic.php\?page=.+?)">Previous<') help = 'Index format: n (unpadded)' class PvPonline(_BasicScraper): latestUrl = 'http://www.pvponline.com/' imageUrl = None imageSearch = compile(r']*>‹ Previous', IGNORECASE) help = 'Index format: yyyymmdd' def pensAndTales(name, baseUrl): return type('PensAndTales_%s' % name, (_BasicScraper,), dict( name='PensAndTales/' + name, latestUrl=baseUrl, imageUrl=baseUrl + '?date=', imageSearch=compile(r']+?src="([^"]*?comics/.+?)"', IGNORECASE), prevSearch=compile(r'(:?]+?alt=")?Previous Comic', IGNORECASE), help='Index format: yyyymmdd') ) # XXX: using custom Wordpress layout # th = pensAndTales('TreasureHunters', 'http://th.pensandtales.com/') # XXX: comic broken, no content # strangekith = pensAndTales('Strangekith', 'http://strangekith.pensandtales.com/') # XXX: comic broken # fireflycross = pensAndTales('FireflyCross', 'http://fireflycross.pensandtales.com/') thosedestined = pensAndTales('ThoseDestined', 'http://thosedestined.pensandtales.com/') evilish = pensAndTales('Evilish', 'http://evilish.pensandtales.com/') redallover = pensAndTales('RedAllOver', 'http://redallover.pensandtales.com/') stickyevil = pensAndTales('StickyEvil', 'http://stickyevil.pensandtales.com/') # XXX: moved / layout changed #ynt = pensAndTales('YamiNoTainai', 'http://ynt.pensandtales.com/') earthbound = pensAndTales('Earthbound', 'http://earthbound.pensandtales.com/') class ProperBarn(_BasicScraper): latestUrl = 'http://www.nitrocosm.com/go/gag/' imageUrl = 'http://www.nitrocosm.com/go/gag/%s/' imageSearch = compile(r']*>