# SPDX-License-Identifier: MIT # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam # Copyright (C) 2015-2022 Tobias Gruetzmacher # Copyright (C) 2019-2020 Daniel Ring from re import compile, escape from typing import List from ..scraper import _BasicScraper, _ParserScraper, ParserScraper from ..helpers import bounceStarter, indirectStarter, joinPathPartsNamer from ..util import tagre from .common import ComicControlScraper, WordPressScraper, WordPressNavi, WordPressWebcomic class CampComic(_ParserScraper): url = 'http://campcomic.com/comic/' stripUrl = url + '%s' firstStripUrl = stripUrl % '6' imageSearch = '//div[@id="comic"]/img' prevSearch = '//a[d:class("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' endOfLife = True 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' endOfLife = True 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 CassiopeiaQuinn(ComicControlScraper): url = 'https://www.cassiopeiaquinn.com/' firstStripUrl = url + 'comic/the-prize-cover' 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("