dosage/dosagelib/plugins/c.py

483 lines
16 KiB
Python
Raw Normal View History

# SPDX-License-Identifier: MIT
2023-10-08 18:41:39 +00:00
# SPDX-FileCopyrightText: © 2004 Tristan Seligmann and Jonathan Jacobs
# SPDX-FileCopyrightText: © 2012 Bastian Kleineidam
# SPDX-FileCopyrightText: © 2015 Tobias Gruetzmacher
# SPDX-FileCopyrightText: © 2019 Daniel Ring
from re import compile, escape
2022-05-28 17:33:16 +00:00
from typing import List
2012-06-20 19:58:13 +00:00
from ..scraper import _BasicScraper, _ParserScraper, ParserScraper
2022-06-03 20:28:21 +00:00
from ..helpers import bounceStarter, indirectStarter, joinPathPartsNamer
2012-12-04 06:02:40 +00:00
from ..util import tagre
2023-09-24 05:27:48 +00:00
from .common import ComicControlScraper, WordPressScraper, WordPressNavi, WordPressWebcomic
2012-06-20 19:58:13 +00:00
2021-01-18 00:25:03 +00:00
class CampComic(_ParserScraper):
2014-01-06 04:05:00 +00:00
url = 'http://campcomic.com/comic/'
stripUrl = url + '%s'
firstStripUrl = stripUrl % '6'
2021-01-18 00:25:03 +00:00
imageSearch = '//div[@id="comic"]/img'
prevSearch = '//a[d:class("btnPrev")]'
2014-01-06 04:05:00 +00:00
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'
2020-09-27 01:30:23 +00:00
endOfLife = True
2019-08-10 06:39:43 +00:00
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'
2020-09-27 01:30:23 +00:00
endOfLife = True
2019-08-10 06:40:02 +00:00
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'
2023-09-24 05:27:48 +00:00
class CassiopeiaQuinn(ComicControlScraper):
url = 'https://www.cassiopeiaquinn.com/'
firstStripUrl = url + 'comic/the-prize-cover'
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):
2021-01-18 00:25:03 +00:00
url = 'https://catandgirl.com/'
2017-05-14 22:27:28 +00:00
imageSearch = '//div[@id="comic"]//img'
2021-01-18 00:25:03 +00:00
prevSearch = '//a[d:class("pager--prev")]'
2013-11-12 17:33:14 +00:00
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
2022-05-28 17:33:16 +00:00
strips: List[str] = []
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):
2022-06-05 16:31:55 +00:00
url = 'https://classic.cat-nine.net/'
firstStripUrl = url + 'comic/day-first'
imageSearch = '//div[@id="comic"]//img/@data-src-img'
2019-12-13 09:48:13 +00:00
endOfLife = True
class CatNineTakeTwo(WordPressScraper):
2019-12-13 09:48:25 +00:00
name = 'CatNine/TakeTwo'
2022-06-05 16:31:55 +00:00
url = 'https://cat-nine.net/'
firstStripUrl = url + 'comic/episode-1/1-first-day-for-everything/'
2019-12-13 09:48:25 +00:00
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(WordPressWebcomic):
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
2021-04-25 01:11:45 +00:00
class Centralia2050(_ParserScraper):
url = 'https://centralia2050.com/'
2019-07-13 06:37:52 +00:00
stripUrl = url + 'comic/%s/'
firstStripUrl = stripUrl % 'ch1cover'
2021-04-25 01:11:45 +00:00
imageSearch = '//div[@id="spliced-comic"]//img'
prevSearch = '//a[@class="previous-comic"]'
nextSearch = '//a[@class="next-comic"]'
2019-07-13 06:37:52 +00:00
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 ChannelAte(WordPressNavi):
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'
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
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
class ClanOfTheCats(WordPressScraper):
2019-08-10 07:03:13 +00:00
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/')
class ClanOfTheCatsReunion(WordPressScraper):
2019-08-10 07:50:10 +00:00
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'
2021-07-10 07:35:49 +00:00
imageSearch = '//img[contains(@src, "pages/")]'
prevSearch = '//a[./img[@alt="Previous Page"]]'
latestSearch = '//a[./img[@alt="Comic"]]'
2019-07-05 08:30:08 +00:00
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[d:class("comic-image")]'
prevSearch = '//a[./span[contains(text(), "Previous")]]'
2019-06-20 06:28:40 +00:00
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)'
class CommanderKitty(WordPressNavi):
2019-07-11 08:08:01 +00:00
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):
2021-01-18 00:25:03 +00:00
url = 'https://web.archive.org/web/20201127150157/http://www.courting-disaster.com/'
firstStripUrl = 'http://www.courting-disaster.com/comic/courting-disaster-17/'
2021-01-18 00:25:03 +00:00
endOfLife = True
class CraftedFables(WordPressScraper):
2021-01-18 00:25:03 +00:00
url = 'https://web.archive.org/web/20191126025641/http://www.caf-fiends.net/comicpress/'
prevSearch = '//a[@rel="prev"]'
2021-01-18 00:25:03 +00:00
endOfLife = True
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")]'
class CritterCoven(WordPressScraper):
2019-07-14 21:55:13 +00:00
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
class CSectionComics(WordPressScraper):
2022-06-03 20:28:21 +00:00
url = 'https://www.csectioncomics.com/'
firstStripUrl = url + 'comics/one-day-in-country'
namer = joinPathPartsNamer(imageparts=(-3, -2, -1))
2022-06-03 20:28:21 +00:00
multipleImagesPerStrip = True
class CtrlAltDel(WordPressWebcomic):
url = 'https://cad-comic.com/'
stripUrl = url + 'comic/%s/'
firstStripUrl = stripUrl % 'nice-melon'
imageSearch = '//div[@class="comicpage"]//img[contains (@src,"/uploads/")]'
prevSearch = '//a[@rel="prev"]'
class CucumberQuest(WordPressWebcomic):
2021-01-18 00:25:03 +00:00
baseUrl = 'http://cucumber.gigidigi.com/'
stripUrl = baseUrl + 'cq/%s/'
2013-04-10 16:36:33 +00:00
firstStripUrl = stripUrl % 'page-1'
2021-01-18 00:25:03 +00:00
url = firstStripUrl
starter = indirectStarter
2013-04-10 16:36:33 +00:00
help = 'Index format: stripname'
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)
2023-10-08 18:41:39 +00:00
class CyanideAndHappiness(ParserScraper):
url = 'https://explosm.net/'
imageSearch = '//div[@id="comic"]//div[contains(@class,"ComicImage")]/span//img'
prevSearch = '//div[@type="comic"]//a[*[local-name()="svg" and @rotate="180deg"]]'
nextSearch = '//div[@type="comic"]//a[*[local-name()="svg" and @rotate="0deg"]]'
starter = bounceStarter
namer = joinPathPartsNamer(imageparts=range(-4, 0))
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
2020-09-27 13:50:25 +00:00
def shouldSkipUrl(self, url, data):
return '2016/the-end' in url # video