dosage/dosagelib/plugins/c.py

498 lines
16 KiB
Python
Raw Normal View History

# -*- coding: utf-8 -*-
2016-10-28 22:21:41 +00:00
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
2014-01-05 15:50:57 +00:00
# Copyright (C) 2012-2014 Bastian Kleineidam
# Copyright (C) 2015-2020 Tobias Gruetzmacher
# Copyright (C) 2019-2020 Daniel Ring
from re import compile, escape
2012-06-20 19:58:13 +00:00
2015-05-20 10:58:13 +00:00
from ..scraper import _BasicScraper, _ParserScraper
2019-06-29 19:41:15 +00:00
from ..helpers import bounceStarter, indirectStarter
2012-12-04 06:02:40 +00:00
from ..util import tagre
from .common import _WordPressScraper, _WPNavi, _WPWebcomic
2012-06-20 19:58:13 +00:00
2014-01-06 04:05:00 +00:00
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'
2013-02-21 18:47:21 +00:00
2012-06-20 19:58:13 +00:00
class CaptainSNES(_BasicScraper):
url = 'http://www.captainsnes.com/'
rurl = escape(url)
stripUrl = url + '%s/'
2013-04-10 21:57:09 +00:00
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"))
2012-12-02 17:35:06 +00:00
multipleImagesPerStrip = True
2012-11-21 20:57:26 +00:00
help = 'Index format: yyyy/mm/dd/nnn-stripname'
2012-06-20 19:58:13 +00:00
2019-06-20 03:05:32 +00:00
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
2019-08-10 06:39:43 +00:00
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]
2019-08-10 06:40:02 +00:00
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
2012-12-08 20:30:51 +00:00
class CaseyAndAndy(_BasicScraper):
url = 'http://www.galactanet.com/comic/'
stripUrl = url + 'view.php?strip=%s'
firstStripUrl = stripUrl % '1'
2012-12-08 20:30:51 +00:00
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'))
2012-12-08 20:30:51 +00:00
help = 'Index format: number'
2013-04-10 16:36:33 +00:00
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'([^"]+)'))
2013-04-10 16:36:33 +00:00
help = 'Index format: nnn'
2012-12-07 23:45:18 +00:00
class Catalyst(_BasicScraper):
baseUrl = "http://catalyst.spiderforest.com/"
rurl = escape(baseUrl)
url = baseUrl + "comic.php?comic_id=415"
2012-12-07 23:45:18 +00:00
stripUrl = baseUrl + "comic.php?comic_id=%s"
firstStripUrl = stripUrl % '1'
imageSearch = compile(tagre("img", "src", r'((?:%s)?comics/[^"]+)' % rurl))
prevSearch = compile("<center>" +
tagre("a", "href",
r'(%scomic\.php\?comic_id=\d+)' % rurl))
2012-12-07 23:45:18 +00:00
help = 'Index format: number'
2017-05-14 22:27:28 +00:00
class CatAndGirl(_ParserScraper):
2013-04-10 16:36:33 +00:00
url = 'http://catandgirl.com/'
2017-05-14 22:27:28 +00:00
imageSearch = '//div[@id="comic"]//img'
prevSearch = '//a[@rel="prev"]'
2013-11-12 17:33:14 +00:00
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)
2019-12-13 09:48:13 +00:00
class CatNine(_WordPressScraper):
url = 'http://classic.cat-nine.net/'
stripUrl = url + 'comic/%s'
firstStripUrl = stripUrl % 'day-first'
endOfLife = True
2019-12-13 09:48:25 +00:00
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):
2020-01-02 05:51:29 +00:00
url = 'https://catsncameras.com/cnc/'
stripUrl = url + 'comic/%s'
firstStripUrl = stripUrl % 'cnc-begins'
adult = True
2015-07-30 10:16:34 +00:00
class CatVersusHuman(_ParserScraper):
url = 'http://www.catversushuman.com'
imageSearch = '//div[@class="post-body entry-content"]//img'
2016-04-28 22:34:25 +00:00
prevSearch = '//a[@id="Blog1_blog-pager-older-link"]'
latestSearch = '//a[@rel="bookmark"]'
starter = indirectStarter
2015-07-30 10:16:34 +00:00
2013-04-10 16:36:33 +00:00
class CavesAndCritters(_WPWebcomic):
2019-06-19 08:45:07 +00:00
url = 'https://cavesandcritters.com/?ao_confirm'
stripUrl = 'https://cavesandcritters.com/cnc_webcomic/%s/'
2019-06-19 08:45:07 +00:00
firstStripUrl = stripUrl % '01_000'
adult = True
2019-07-13 06:37:52 +00:00
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
2017-04-15 23:06:41 +00:00
class ChainsawSuit(_WordPressScraper):
url = 'http://chainsawsuit.com/comic/'
stripUrl = url + '%s/'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % '2008/03/12/strip-338'
2015-05-26 07:53:04 +00:00
prevSearch = '//img[@alt="previous"]/..'
2013-02-06 21:08:36 +00:00
help = 'Index format: yyyy/mm/dd/stripname'
2017-05-21 23:17:05 +00:00
class ChannelAte(_WPNavi):
2013-02-06 21:08:36 +00:00
url = 'http://www.channelate.com/'
2012-06-20 19:58:13 +00:00
class ChasingTheSunset(_BasicScraper):
url = 'http://www.fantasycomic.com/'
stripUrl = url + 'index.php?p=%s'
firstStripUrl = stripUrl % 'c1'
2012-06-20 19:58:13 +00:00
imageSearch = compile(r'(/cmsimg/.+?)".+?comic-img')
prevSearch = compile(r'<a href="(.+?)" title="" ><img src="(images/eye-prev.png|images/cn-prev.png)"')
help = 'Index format: n'
2016-04-28 22:34:25 +00:00
class Chester5000XYV(_WordPressScraper):
2013-04-10 16:36:33 +00:00
url = 'http://jessfink.com/Chester5000XYV/'
stripUrl = url + '?p=%s'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % '34'
2016-04-28 22:34:25 +00:00
prevSearch = '//a[@rel="prev"]'
adult = True
help = 'Index format: n (unpadded)'
def link_modifier(self, fromurl, tourl):
2016-04-28 22:34:25 +00:00
"""Bugfix for link to blog"""
if tourl == self.stripUrl % '714':
2016-04-28 22:34:25 +00:00
return self.stripUrl % '710'
return tourl
2013-04-10 16:36:33 +00:00
2016-04-28 22:34:25 +00:00
class Chisuji(_WordPressScraper):
url = 'http://www.chisuji.com/'
2016-04-28 22:34:25 +00:00
stripUrl = url + '?p=%s'
firstStripUrl = stripUrl % '266'
prevSearch = '//div[@class="nav-previous"]/a'
help = 'Index format: nnn'
2012-06-20 19:58:13 +00:00
2015-05-20 10:58:13 +00:00
class CigarroAndCerveja(_ParserScraper):
url = 'http://www.cigarro.ca/'
2015-05-20 10:58:13 +00:00
stripUrl = url + 'comic/%s/'
firstStripUrl = stripUrl % 'reacquaintance'
imageSearch = '//div[@id="comic"]//img',
prevSearch = '//a[contains(text()," Prev")]',
2012-06-20 19:58:13 +00:00
2019-08-10 07:03:13 +00:00
class ClanOfTheCats(_WordPressScraper):
url = 'http://www.cotclassic.com/'
stripUrl = url + 'comic/%s/'
firstStripUrl = stripUrl % 'coming-home-2'
def link_modifier(self, fromurl, tourl):
# Fix broken navigation link
return tourl.replace('/2954/', '/2002-06-22/')
2019-08-10 07:50:10 +00:00
class ClanOfTheCatsReunion(_WordPressScraper):
name = 'ClanOfTheCats/Reunion'
url = 'http://www.clanofthecats.com/'
stripUrl = url + 'comic/%s/'
firstStripUrl = stripUrl % 'cotc-reunion'
2019-07-05 08:30:08 +00:00
class Cloudscratcher(_ParserScraper):
url = 'http://www.cloudscratcher.com/'
stripUrl = url + 'comic.php?page=%s'
firstStripUrl = stripUrl % '1'
imageSearch = '//div[@id="main_content"]//img[contains(@src, "comic")]'
prevSearch = '//a[./img[contains(@src, "previous-page")]]'
latestSearch = '//a[@alt="Newest_Page"]'
starter = indirectStarter
2019-06-20 06:28:40 +00:00
class CollegeCatastrophe(_ParserScraper):
url = 'https://www.tigerknight.com/cc'
stripUrl = url + '/%s'
firstStripUrl = stripUrl % '2000-11-10'
imageSearch = '//img[@class="comic-image"]'
prevSearch = '//a[@class="prev"]'
endOfLife = True
multipleImagesPerStrip = True
2012-06-20 19:58:13 +00:00
class Comedity(_BasicScraper):
url = 'http://www.comedity.com/'
stripUrl = url + 'index.php?strip_id=%s'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % '1'
2012-06-20 19:58:13 +00:00
imageSearch = compile(r'<img src="(Comedity_files/.+?)"')
prevSearch = compile(r'<a href="(/?index.php\?strip_id=\d+?)"> *<img alt=\"Prior Strip')
help = 'Index format: n (no padding)'
2019-07-11 08:08:01 +00:00
class CommanderKitty(_WPNavi):
url = 'http://www.commanderkitty.com/'
stripUrl = url + '%s/'
firstStripUrl = stripUrl % '2009/01/03/good-to-be-back'
endOfLife = True
2017-09-18 19:31:15 +00:00
class CommitStrip(_ParserScraper):
baseUrl = 'https://www.commitstrip.com/en/'
2018-05-22 22:54:40 +00:00
url = baseUrl + '?setLocale=1' # ensure the language cookie is set
2017-09-18 19:31:15 +00:00
stripUrl = baseUrl + '%s/'
2019-12-27 23:15:46 +00:00
firstStripUrl = stripUrl % '2012/02/22/interview'
2017-09-18 19:31:15 +00:00
latestSearch = '//section//a'
starter = indirectStarter
imageSearch = '//article/div//img'
prevSearch = '//span[@class="nav-previous"]/a'
help = 'Index format: yyyy/mm/dd/strip-name'
def namer(self, image_url, page_url):
parts = page_url.rstrip('/').rsplit('/')[-4:]
return '-'.join(parts)
2019-12-27 23:15:46 +00:00
def link_modifier(self, fromurl, tourl):
return tourl.replace('http:', 'https:')
2017-09-18 19:31:15 +00:00
class CommitStripFr(CommitStrip):
baseUrl = 'https://www.commitstrip.com/fr/'
2018-05-22 22:54:40 +00:00
url = baseUrl + '?setLocale=1' # ensure the language cookie is set
2017-09-18 19:31:15 +00:00
stripUrl = baseUrl + '%s/'
2019-12-27 23:15:46 +00:00
firstStripUrl = stripUrl % '2012/02/22/interview'
2017-09-18 19:31:15 +00:00
lang = 'fr'
2013-04-10 21:57:09 +00:00
class CompanyY(_BasicScraper):
url = 'http://company-y.com/'
rurl = escape(url)
stripUrl = url + '%s/'
firstStripUrl = stripUrl % '2009/08/14/coming-soon'
imageSearch = compile(tagre("img", "src", r'(%scomics/[^"]+)' % rurl))
prevSearch = compile(tagre("div", "class", r"nav-previous") +
tagre("a", "href", r'(%s[^"]+)' % rurl))
2013-04-10 21:57:09 +00:00
help = 'Index format: yyyy/mm/dd/strip-name'
2019-07-12 08:36:47 +00:00
class Concession(_ParserScraper):
url = 'http://concessioncomic.com/'
stripUrl = url + 'index.php?pid=%s'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % '20060701'
2019-07-12 08:36:47 +00:00
imageSearch = '//div[@id="comic"]/img[not(@class="preload")]'
prevSearch = '//a[@class="nav-prev"]'
adult = True
endOfLife = True
2012-12-07 23:45:18 +00:00
2015-05-26 09:32:25 +00:00
class CorydonCafe(_ParserScraper):
2013-04-10 16:36:33 +00:00
url = 'http://corydoncafe.com/'
2015-05-26 09:32:25 +00:00
imageSearch = "//center[2]//img"
prevSearch = '//a[@title="prev"]'
2017-05-14 22:27:28 +00:00
multipleImagesPerStrip = True
2013-04-10 16:36:33 +00:00
class CourtingDisaster(_WordPressScraper):
url = 'http://www.courting-disaster.com/'
firstStripUrl = 'http://www.courting-disaster.com/comic/courting-disaster-17/'
class CraftedFables(_WordPressScraper):
url = 'http://www.caf-fiends.net/comicpress/'
prevSearch = '//a[@rel="prev"]'
2012-06-20 19:58:13 +00:00
class CrapIDrewOnMyLunchBreak(_BasicScraper):
url = 'http://crap.jinwicked.com/'
2013-04-10 21:57:09 +00:00
stripUrl = url + '%s/'
firstStripUrl = stripUrl % '2003/07/30/jin-and-josh-decide-to-move'
2012-11-14 19:23:30 +00:00
imageSearch = compile(tagre("img", "src", r'(http://crap\.jinwicked\.com/comics/[^"]+)'))
prevSearch = compile(tagre("a", "href", r'([^"]+)', after="prev"))
2012-06-20 19:58:13 +00:00
help = 'Index format: yyyy/mm/dd/name'
class CrimsonDark(_BasicScraper):
url = 'http://www.davidcsimon.com/crimsondark/'
stripUrl = url + 'index.php?view=comic&strip_id=%s'
firstStripUrl = stripUrl % '1'
imageSearch = compile(r'src="(.+?strips/.+?)"')
prevSearch = compile(r'<a href=[\'"](/crimsondark/index\.php\?view=comic&amp;strip_id=\d+)[\'"]><img src=[\'"]themes/cdtheme/images/active_prev.png[\'"]')
help = 'Index format: n (unpadded)'
2019-06-21 06:14:30 +00:00
class CrimsonFlag(_ParserScraper):
url = 'http://crimsonflagcomic.com/'
stripUrl = url + 'comic.php?comicID=%s'
firstStripUrl = stripUrl % '1'
imageSearch = '//img[@class="comicimage"]'
prevSearch = '//a[contains(@class, "prev")]'
2019-07-14 21:55:13 +00:00
class CritterCoven(_WordPressScraper):
url = 'http://crittercoven.com/'
stripUrl = url + 'comic/%s/'
firstStripUrl = stripUrl % 'critter-coven'
2019-07-29 08:00:36 +00:00
class CrossTimeCafe(_ParserScraper):
stripUrl = 'http://www.whiteponyproductions.com/ctc/%s.htm'
url = stripUrl % 'present'
firstStripUrl = stripUrl % 'ctc0001'
imageSearch = '//img[not(contains(@src, "graphics/"))]'
prevSearch = '//a[.//text()="Back"]'
multipleImagesPerStrip = True
endOfLife = True
2013-04-10 16:36:33 +00:00
class CucumberQuest(_BasicScraper):
url = 'http://cucumber.gigidigi.com/'
rurl = escape(url)
2013-04-28 17:58:38 +00:00
stripUrl = url + 'cq/%s/'
2013-04-10 16:36:33 +00:00
firstStripUrl = stripUrl % 'page-1'
startUrl = url + 'recent.html'
starter = indirectStarter
2013-04-28 17:58:38 +00:00
imageSearch = (
compile(tagre("img", "src", r'(%swp-content/uploads/\d+/\d+/\d+[^"]+)' % rurl)),
compile(tagre("img", "src", r'(%swp-content/uploads/\d+/\d+/ch\d+[^"]+)' % rurl)),
compile(tagre("img", "src", r'(%swp-content/uploads/\d+/\d+/bonus[^"]+)' % rurl)),
)
prevSearch = compile(tagre("a", "href", r'(%scq/[^"]+/)' % rurl, after="previous"))
latestSearch = compile(r'window\.location="(/cq/[^"]+/)"')
2013-04-10 16:36:33 +00:00
help = 'Index format: stripname'
2016-04-28 22:34:25 +00:00
class Curtailed(_WordPressScraper):
2019-06-13 02:21:31 +00:00
url = 'https://www.curtailedcomic.com/'
stripUrl = url + 'comic/%s/'
firstStripUrl = stripUrl % '001-sneeze'
2013-04-25 18:46:05 +00:00
2017-05-14 22:27:28 +00:00
def shouldSkipUrl(self, url, data):
"""Skip pages without images."""
2019-06-13 02:21:31 +00:00
return 'comic/sitrep-1' in url or 'comic/be-right-back' in url
2017-05-14 22:27:28 +00:00
2013-04-25 18:46:05 +00:00
2015-05-26 07:47:31 +00:00
class Curvy(_ParserScraper):
url = 'http://www.c.urvy.org/'
stripUrl = url + '?date=%s'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % '20080329'
2015-05-26 07:47:31 +00:00
imageSearch = '//div[@id="theActualComic"]//img'
prevSearch = '//div[@class="aNavbar"]//p[2]/a'
2012-06-20 19:58:13 +00:00
help = 'Index format: yyyymmdd'
2019-06-29 19:41:15 +00:00
class CutLoose(_ParserScraper):
url = 'https://www.cutloosecomic.com/'
stripUrl = url + 'archive/comic/%s'
firstStripUrl = stripUrl % '2016/02/02'
imageSearch = '//img[@id="comic-container"]'
prevSearch = '//a[@title="Previous Comic"]'
nextSearch = '//a[@title="Next Comic"]'
starter = bounceStarter
adult = True
def namer(self, imageUrl, pageUrl):
postDate = pageUrl.rsplit('/', 3)
filename = imageUrl.rsplit('/', 1)[-1]
return '%s-%s-%s_%s' % (postDate[1], postDate[2], postDate[3], filename)
2012-06-20 19:58:13 +00:00
class CyanideAndHappiness(_BasicScraper):
2018-04-21 00:19:01 +00:00
url = 'http://www.explosm.net/'
stripUrl = url + '%s/'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % '15'
imageSearch = compile(tagre("img", "src", r'(//files.explosm.net/comics/[^"]+)', before="main-comic"))
2018-04-21 00:19:01 +00:00
prevSearch = compile(tagre("a", "href", r'(/comics/\d+/)', after="nav-previous"))
nextSearch = compile(tagre("a", "href", r"(/comics/\d+/)", after="nav-next"))
2012-06-20 19:58:13 +00:00
help = 'Index format: n (unpadded)'
2014-02-10 20:58:26 +00:00
def shouldSkipUrl(self, url, data):
"""Skip pages without images."""
return "/comics/play-button.png" in data[0]
def namer(self, image_url, page_url):
imgname = image_url.split('/')[-1]
# only get the first 100 chars for the image name
imgname = imgname[:100]
imgnum = page_url.split('/')[-2]
return '%s_%s' % (imgnum, imgname)
2019-07-11 08:43:07 +00:00
class CynWolf(_ParserScraper):
url = 'https://cynwolf.net/'
stripUrl = url + '%s/'
firstStripUrl = stripUrl % '2008/because'
imageSearch = '//section[contains(@class, "comic")]//img'
prevSearch = '//a[text()="\u2190"]'
multipleImagesPerStrip = True
endOfLife = True