from re import compile, MULTILINE, IGNORECASE, sub from os.path import splitext from ..helpers import _BasicScraper, bounceStarter, indirectStarter class SailorsunOrg(_BasicScraper): latestUrl = 'http://www.sailorsun.org/' imageUrl = 'http://www.sailorsun.org/browse.php?comicID=%s' imageSearch = compile(r'(comics/.+?)"') prevSearch = compile(r'/(browse.php.+?)".+?/prev.gif') help = 'Index format: n (unpadded)' class SamAndFuzzy(_BasicScraper): latestUrl = 'http://www.samandfuzzy.com/' imageUrl = 'http://samandfuzzy.com/%s' imageSearch = compile(r'(/comics/.+?)" alt') prevSearch = compile(r'">') help = 'Index format: nnnn' class ScaryGoRound(_BasicScraper): latestUrl = 'http://www.scarygoround.com/' imageUrl = 'http://www.scarygoround.com/?date=%s' imageSearch = compile(r'.+?(pages.php\?comicID=.+?)".+?back1') help = 'Index format: n (unpadded)' class SluggyFreelance(_BasicScraper): latestUrl = 'http://www.sluggy.com/' imageUrl = 'http://www.sluggy.com/comics/archives/daily/%s' imageSearch = compile(r']+?>') help = 'Index format: yymmdd' class SodiumEyes(_BasicScraper): imageUrl = 'http://sodiumeyes.com/%s' imageSearch = compile(r'(/comic/.+?)"') prevSearch = compile(r'"http://sodiumeyes.com/(.+?/)"><.+?comic-prev') help = 'Index format: nnn' starter = indirectStarter('http://sodiumeyes.com/', compile(r'')) class SpareParts(_BasicScraper): latestUrl = 'http://www.sparepartscomics.com/' imageUrl = 'http://www.sparepartscomics.com/comics/\\?date=s%' imageSearch = compile(r'(/comics/2.+?)[" ]') prevSearch = compile(r'(/comics/.+?|index.php\?.+?)".+?Prev') help = 'Index format: yyyymmdd' class Stubble(_BasicScraper): latestUrl = 'http://www.stubblecomics.com/d/20051230.html' imageUrl = 'http://www.stubblecomics.com/d/%s.html' imageSearch = compile(r'"(/comics/.*?)"') prevSearch = compile(r'"(.*?)".*?backarrow') help = 'Index format: yyyymmdd' class StrawberryDeathCake(_BasicScraper): latestUrl = 'http://rainchildstudios.com/strawberry/' imageUrl = 'http://rainchildstudios.com/strawberry/?p=%s' imageSearch = compile(r'/(comics/.+?)"') prevSearch = compile(r'strawberry/(\?p=.+?)".+?span class="prev"') help = 'Index format: n (good luck)' class SuburbanTribe(_BasicScraper): latestUrl = 'http://www.pixelwhip.com/' imageUrl = 'http://www.pixelwhip.com/?p%s' imageSearch = compile(r'

Latest SL Comic \(#\d+\)', IGNORECASE)) @classmethod def namer(cls, imageUrl, pageUrl): index = pageUrl.split('/')[-1].split('.')[0] title = imageUrl.split('/')[-1].split('.')[0] return index + '-' + title def smackJeeves(names): class _SJScraper(_BasicScraper): imageUrl = property(lambda self: self.baseUrl + self.shortName) imageSearch = compile(r']*alt="< Previous"', IGNORECASE) help = 'Index format: nnnn (some increasing number)' @classmethod def namer(cls, imageUrl, pageUrl): return pageUrl.split('/')[-2] def makeScraper(shortName): baseUrl = 'http://%s.smackjeeves.com/comics/' % shortName return type('SmackJeeves_%s' % shortName, (_SJScraper,), dict( name='SmackJeeves/' + shortName, baseUrl=baseUrl, starter=bounceStarter(baseUrl, compile(r']*alt="Next >"', IGNORECASE))) ) return dict((name, makeScraper(name)) for name in names) globals().update(smackJeeves([ '20galaxies', 'axe13', 'beartholomew', 'bliss', 'durian', 'heard', 'mpmcomic', 'nlmo-project', 'paranoidloyd', 'thatdreamagain', 'wowcomics', ])) class StarCrossdDestiny(_BasicScraper): latestUrl = 'http://www.starcrossd.net/comic.html' imageUrl = 'http://www.starcrossd.net/archives/%s.html' imageSearch = compile(r'') prevSearch = compile(r']*"[^"]*"[^>]*>prev', IGNORECASE) help = 'Index format: nnnnnnnn' @classmethod def namer(cls, imageUrl, pageUrl): if imageUrl.find('ch1') == -1: # At first all images were stored in a strips/ directory but that was changed with the introduction of book2 imageUrl = sub('(?:strips)|(?:images)','book1',imageUrl) elif not imageUrl.find('strips') == -1: imageUrl = imageUrl.replace('strips/','') directory, filename = imageUrl.split('/')[-2:] filename, extension = splitext(filename) return directory + '-' + filename class SGVY(_BasicScraper): imageUrl = 'http://www.sgvy.com/Edda%s/Issue%s/Page%s.html' imageSearch = compile(r'"comic" src="((?:\.\./)+images/sgvy/sgvy-[-\w\d]+\.\w+)"') prevSearch = compile(r'Prev') help = 'Index format: edda-issue-page' starter = indirectStarter('http://www.sgvy.com/', compile(r'')) def setStrip(self, index): self.currentUrl = self.imageUrl % tuple(map(int, index.split('-'))) class Spamusement(_BasicScraper): imageUrl = 'http://spamusement.com/index.php/comics/view/%s' imageSearch = compile(r'', IGNORECASE) help = 'Index format: n (unpadded)' starter = indirectStarter('http://spamusement.com/', prevSearch) def snafuComics(): class _SnafuComics(_BasicScraper): imageSearch = compile(r'Previous') help = 'Index format: n (unpadded)' @property def imageUrl(self): return self.latestUrl + 'index.php?strip_id=%s' comics = { 'Grim': 'grim', 'KOF': 'kof', 'PowerPuffGirls': 'ppg', 'Snafu': 'www', 'Tin': 'tin', 'TW': 'tw', 'Sugar': 'sugar', 'SF': 'sf', 'Titan': 'titan', 'EA': 'ea', 'Zim': 'zim', 'Soul': 'soul', 'FT': 'ft', 'Bunnywith': 'bunnywith', 'Braindead': 'braindead', } url = 'http://%s.snafu-comics.com/' return dict((name, type('SnafuComics_%s' % name, (_SnafuComics,), dict(name='SnafuComics/' + name, latestUrl=url % host))) for name, host in comics.items()) globals().update(snafuComics()) class SosiaalisestiRajoittuneet(_BasicScraper): latestUrl = 'http://sosiaalisestirajoittuneet.fi/index_nocomment.php' imageUrl = 'http://sosiaalisestirajoittuneet.fi/index_nocomment.php?date=%s' imageSearch = compile(r'.*?') prevSearch = compile(r']+?src="http://www.strangecandy.net/images/previous_day.gif"') help = 'Index format: yyyyddmm' class SMBC(_BasicScraper): latestUrl = 'http://www.smbc-comics.com/' imageUrl = 'http://www.smbc-comics.com/index.php?db=comics&id=%s' imageSearch = compile(r'') prevSearch = compile(r'131,13,216,84"\n\s+href="(.+?)#comic"\n>', MULTILINE) help = 'Index format: nnnn' class SomethingLikeLife(_BasicScraper): latestUrl = 'http://www.pulledpunches.com/' imageUrl = 'http://www.pulledpunches.com/?p=%s' imageSearch = compile(r' ') help = 'Index format: yyyy/mm/dd/stripname' class SexDemonBag(_BasicScraper): latestUrl = 'http://www.sexdemonbag.com/' imageUrl = 'http://www.sexdemonbag.com/?p=%s' imageSearch = compile(r'') help = 'Index format: nnn'