# -*- coding: utf-8 -*- # Copyright (C) 2004-2005 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam # Copyright (C) 2015-2016 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 _TumblrScraper, _WordPressScraper, xpath_class class Caggage(_BasicScraper): url = 'http://caggagecomic.com/' rurl = escape(url) stripUrl = url + 'archives/%s' firstStripUrl = stripUrl % '77' imageSearch = compile(tagre("img", "src", r'(%scomics/[^"]+)' % rurl)) prevSearch = compile(tagre("a", "href", r'(%sarchives/\d+)' % rurl, after="prev")) help = 'Index format: number' 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 Carciphona(_BasicScraper): url = 'http://carciphona.com/' imageSearch = compile(tagre("div", "style", r'background-image:url\((_pages[^)]*)\)')) prevSearch = compile(tagre("a", "href", r'(view\.php\?[^"]*)', after="prevarea")) latestSearch = compile(tagre("a", "href", r'(view\.php\?page=[0-9]+[^"]*)')) starter = indirectStarter def namer(self, image_url, page_url): ip = image_url.split('/') return "volume_%s_page_%s" % (ip[-2], ip[-1]) 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(_BasicScraper): url = 'http://catandgirl.com/' rurl = escape(url) stripUrl = url + '?p=%s' firstStripUrl = stripUrl % '1602' imageSearch = compile(tagre("img", "src", r'(%sarchive/[^"]+)' % rurl)) prevSearch = compile(tagre("a", "href", r'([^"]+)') + r"[^<]+Previous") help = 'Index format: n (unpadded)' def shouldSkipUrl(self, url, data): """Skip pages without images.""" return url in ( self.stripUrl % '4299', ) class Catena(_WordPressScraper): url = 'http://catenamanor.com/' class CatNine(_WordPressScraper): url = 'http://cat-nine.net' firstStripUrl = 'http://cat-nine.net/comic/episode-1/first-day-for-everything/' class CatsAndCameras(_WordPressScraper): url = 'http://catsncameras.com/' 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 ChainsawSuit(_ParserScraper): url = 'http://chainsawsuit.com/' rurl = escape(url) stripUrl = url + '%s/' firstStripUrl = stripUrl % '2008/03/12/strip-338' imageSearch = '//div[@id="comic"]//img' prevSearch = '//img[@alt="previous"]/..' help = 'Index format: yyyy/mm/dd/stripname' class Champ2010(_BasicScraper): baseUrl = 'http://jedcollins.com/champ2010/' rurl = escape(baseUrl) # the latest URL is hard coded since the comic is discontinued url = baseUrl + 'champ-12-30-10.html' stripUrl = baseUrl + '%s.html' firstStripUrl = stripUrl % 'champ1-1-10-fuck' imageSearch = compile(tagre("img", "src", r'(%scomics/[^"]+)' % rurl)) prevSearch = compile(tagre("a", "href", r'(%s[^"]+)' % rurl, after="Previous")) help = 'Index format: yy-dd-mm' class ChannelAte(_WordPressScraper): url = 'http://www.channelate.com/' prevSearch = '//a[%s]' % xpath_class('navi-prev') class ChasingTheSunset(_BasicScraper): url = 'http://www.fantasycomic.com/' stripUrl = url + 'index.php?p=c%s' firstStripUrl = stripUrl % '1' imageSearch = compile(r'(/cmsimg/.+?)".+?comic-img') prevSearch = compile(r' *\"Prior