# -*- coding: utf-8 -*- # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam # Copyright (C) 2015-2020 Tobias Gruetzmacher from __future__ import absolute_import, division, print_function from re import compile, escape from ..scraper import _BasicScraper, _ParserScraper from ..helpers import bounceStarter, indirectStarter from ..util import tagre from .common import _WordPressScraper, _WPNavi, _WPWebcomic class CampComic(_BasicScraper): url = 'http://campcomic.com/comic/' rurl = escape(url) stripUrl = url + '%s' firstStripUrl = stripUrl % '6' imageSearch = compile(tagre("img", "src", r'(http://hw1\.pa-cdn\.com/camp/assets/img/katie/comics/[^"]+)')) prevSearch = compile(tagre("a", "href", r'(%s[^"]+)' % rurl, before="btn btnPrev")) help = 'Index Format: number' class CaptainSNES(_BasicScraper): url = 'http://www.captainsnes.com/' rurl = escape(url) stripUrl = url + '%s/' firstStripUrl = stripUrl % '2001/07/10/the-mistake' imageSearch = compile(tagre("img", "src", r"(%scomics/[^']+)" % rurl, quote="'")) prevSearch = compile(tagre("a", "href", r'(%s[^"]+)' % rurl) + tagre("span", "class", "prev")) multipleImagesPerStrip = True help = 'Index format: yyyy/mm/dd/nnn-stripname' class CarryOn(_ParserScraper): url = 'http://www.hirezfox.com/km/co/' stripUrl = url + 'd/%s.html' firstStripUrl = stripUrl % '20040701' imageSearch = '//div[@class="strip"]/img' prevSearch = '//a[text()="Previous Day"]' multipleImagesPerStrip = True def namer(self, imageUrl, pageUrl): # Fix filenames of early comics filename = imageUrl.rsplit('/', 1)[-1] if filename[0].isdigit(): filename = 'co' + filename return filename class CarryOnAliceBlueAndTheGardensOfQ(CarryOn): name = 'CarryOn/AliceBlueAndTheGardensOfQ' url = 'http://www.hirezfox.com/km/abgq/abgq1024/' stripUrl = url + 'd/%s.html' firstStripUrl = stripUrl % '20050401' def namer(self, imageUrl, pageUrl): # Fix filenames return 'abgq' + imageUrl.rsplit('/', 1)[-1] class CarryOnLegendOfAnneBunny(CarryOn): name = 'CarryOn/LegendOfAnneBunny' url = 'http://www.hirezfox.com/km/loab/loab1024/' stripUrl = url + 'd/%s.html' firstStripUrl = stripUrl % '20040701' def namer(self, imageUrl, pageUrl): # Fix filenames of early comics filename = imageUrl.rsplit('/', 1)[-1] if filename[0].isdigit(): filename = 'ab' + filename return filename class CaseyAndAndy(_BasicScraper): url = 'http://www.galactanet.com/comic/' stripUrl = url + 'view.php?strip=%s' firstStripUrl = stripUrl % '1' imageSearch = compile(tagre("img", "src", r'(Strip\d+\.gif)')) prevSearch = compile(tagre("a", "href", r'(view\.php\?strip=\d+)') + tagre("img", "src", r'previous\.gif')) help = 'Index format: number' class CasuallyKayla(_BasicScraper): url = 'http://casuallykayla.com/' stripUrl = url + '?p=%s' firstStripUrl = stripUrl % '89' imageSearch = compile(tagre("img", "src", r'(http://casuallykayla\.com/comics/[^"]+)')) prevSearch = compile(tagre("div", "class", r'nav-previous') + tagre("a", "href", r'([^"]+)')) help = 'Index format: nnn' class Catalyst(_BasicScraper): baseUrl = "http://catalyst.spiderforest.com/" rurl = escape(baseUrl) url = baseUrl + "comic.php?comic_id=415" stripUrl = baseUrl + "comic.php?comic_id=%s" firstStripUrl = stripUrl % '1' imageSearch = compile(tagre("img", "src", r'((?:%s)?comics/[^"]+)' % rurl)) prevSearch = compile("
" + tagre("a", "href", r'(%scomic\.php\?comic_id=\d+)' % rurl)) help = 'Index format: number' class CatAndGirl(_ParserScraper): url = 'http://catandgirl.com/' imageSearch = '//div[@id="comic"]//img' prevSearch = '//a[@rel="prev"]' class CatenaCafe(_WordPressScraper): name = 'CatenaManor/CatenaCafe' url = 'https://catenamanor.com/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % 'reboot-book1cover-small' class CatenaManor(_ParserScraper): baseUrl = ('https://web.archive.org/web/20141027141116/' 'http://catenamanor.com/') url = baseUrl + 'archives' stripUrl = baseUrl + '%s/' firstStripUrl = stripUrl % '2003/07' imageSearch = '//img[@class="comicthumbnail"]' multipleImagesPerStrip = True endOfLife = True strips = [] def starter(self): # Retrieve archive links and select valid range archivePage = self.getPage(self.url) archiveStrips = archivePage.xpath('//div[@id="archivepage"]//a') valid = False for link in archiveStrips: if self.stripUrl % '2012/01' in link.get('href'): valid = True elif self.stripUrl % '2003/06' in link.get('href'): valid = False if valid: self.strips.append(link.get('href')) return self.strips.pop(0) def getPrevUrl(self, url, data): return self.strips.pop(0) class CatNine(_WordPressScraper): url = 'http://classic.cat-nine.net/' stripUrl = url + 'comic/%s' firstStripUrl = stripUrl % 'day-first' endOfLife = True class CatNineTakeTwo(CatNine): name = 'CatNine/TakeTwo' url = 'http://cat-nine.net/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % 'episode-1/1-first-day-for-everything' class CatsAndCameras(_WordPressScraper): url = 'https://catsncameras.com/cnc/' stripUrl = url + 'comic/%s' firstStripUrl = stripUrl % 'cnc-begins' adult = True class CatVersusHuman(_ParserScraper): url = 'http://www.catversushuman.com' imageSearch = '//div[@class="post-body entry-content"]//img' prevSearch = '//a[@id="Blog1_blog-pager-older-link"]' latestSearch = '//a[@rel="bookmark"]' starter = indirectStarter class CavesAndCritters(_WPWebcomic): url = 'https://cavesandcritters.com/?ao_confirm' stripUrl = 'https://cavesandcritters.com/cnc_webcomic/%s/' firstStripUrl = stripUrl % '01_000' adult = True class Centralia2050(_WordPressScraper): url = 'http://centralia2050.com/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % 'ch1cover' starter = bounceStarter def namer(self, imageUrl, pageUrl): page = pageUrl.rstrip('/').rsplit('/', 1)[-1].replace('chapter', 'ch') if 'page-' in page and 'ch-' not in page: page = 'ch-1-' + page ext = imageUrl.rsplit('.', 1)[-1] return page + '.' + ext class ChainsawSuit(_WordPressScraper): url = 'http://chainsawsuit.com/comic/' stripUrl = url + '%s/' firstStripUrl = stripUrl % '2008/03/12/strip-338' prevSearch = '//img[@alt="previous"]/..' help = 'Index format: yyyy/mm/dd/stripname' class ChannelAte(_WPNavi): url = 'http://www.channelate.com/' class ChasingTheSunset(_BasicScraper): url = 'http://www.fantasycomic.com/' stripUrl = url + 'index.php?p=%s' firstStripUrl = stripUrl % 'c1' imageSearch = compile(r'(/cmsimg/.+?)".+?comic-img') prevSearch = compile(r' *\"Prior