From 8e1e398a8dc6e648948d9cb166ae2eb127d1e366 Mon Sep 17 00:00:00 2001 From: Tobias Gruetzmacher Date: Mon, 6 Jun 2022 12:08:32 +0200 Subject: [PATCH] Deprecate underscore-prefixed parent classes This is trying to strike a balance between updating as much existing classes as possible, but not making the diff too big... --- dosagelib/plugins/a.py | 22 +++++----- dosagelib/plugins/arcamax.py | 8 ++-- dosagelib/plugins/b.py | 36 ++++++++-------- dosagelib/plugins/c.py | 36 ++++++++-------- dosagelib/plugins/clonemanga.py | 8 ++-- dosagelib/plugins/comicfury.py | 6 +-- dosagelib/plugins/comicgenesis.py | 8 ++-- dosagelib/plugins/comicskingdom.py | 4 +- dosagelib/plugins/common.py | 34 +++++++++------ dosagelib/plugins/creators.py | 6 +-- dosagelib/plugins/d.py | 24 +++++------ dosagelib/plugins/derideal.py | 10 ++--- dosagelib/plugins/dmfa.py | 6 +-- dosagelib/plugins/e.py | 26 ++++++------ dosagelib/plugins/f.py | 14 +++---- dosagelib/plugins/flowerlark.py | 4 +- dosagelib/plugins/footloosecomic.py | 6 +-- dosagelib/plugins/g.py | 20 ++++----- dosagelib/plugins/gocomics.py | 4 +- dosagelib/plugins/h.py | 37 +++++++--------- dosagelib/plugins/i.py | 20 ++++----- dosagelib/plugins/j.py | 12 +++--- dosagelib/plugins/k.py | 20 ++++----- dosagelib/plugins/keenspot.py | 6 +-- dosagelib/plugins/kemonocafe.py | 4 +- dosagelib/plugins/krisstraub.py | 4 +- dosagelib/plugins/l.py | 12 +++--- dosagelib/plugins/m.py | 28 ++++++------- dosagelib/plugins/mangadex.py | 8 ++-- dosagelib/plugins/n.py | 18 ++++---- dosagelib/plugins/namirdeiter.py | 8 ++-- dosagelib/plugins/nitrocosm.py | 8 ++-- dosagelib/plugins/nuklearpower.py | 44 ++++++++----------- dosagelib/plugins/num.py | 4 +- dosagelib/plugins/o.py | 16 +++---- dosagelib/plugins/p.py | 20 ++++----- dosagelib/plugins/petitesymphony.py | 6 +-- dosagelib/plugins/projectfuture.py | 6 +-- dosagelib/plugins/q.py | 10 ++--- dosagelib/plugins/r.py | 14 +++---- dosagelib/plugins/rhjunior.py | 6 +-- dosagelib/plugins/rickgriffinstudios.py | 6 +-- dosagelib/plugins/s.py | 56 ++++++++++++------------- dosagelib/plugins/sandraandwoo.py | 4 +- dosagelib/plugins/shivaestudios.py | 14 +++---- dosagelib/plugins/snafu.py | 8 ++-- dosagelib/plugins/studiokhimera.py | 12 +++--- dosagelib/plugins/t.py | 40 +++++++++--------- dosagelib/plugins/tapas.py | 4 +- dosagelib/plugins/u.py | 16 +++---- dosagelib/plugins/w.py | 12 +++--- dosagelib/plugins/webcomicfactory.py | 4 +- dosagelib/plugins/webtoons.py | 4 +- dosagelib/plugins/wlpcomics.py | 20 ++++----- dosagelib/plugins/wrongside.py | 8 ++-- dosagelib/plugins/wumo.py | 6 +-- dosagelib/plugins/x.py | 7 ++-- dosagelib/plugins/y.py | 6 +-- dosagelib/plugins/z.py | 16 +++---- dosagelib/scraper.py | 23 ++++++---- tests/mocks/extra/dummy.py | 6 +-- tests/mocks/plugins/dummy.py | 4 +- tests/modules/conftest.py | 6 +-- tests/test_vote.py | 4 +- tox.ini | 4 +- 65 files changed, 442 insertions(+), 441 deletions(-) diff --git a/dosagelib/plugins/a.py b/dosagelib/plugins/a.py index 1e6c38906..f95caaa24 100644 --- a/dosagelib/plugins/a.py +++ b/dosagelib/plugins/a.py @@ -8,7 +8,7 @@ from re import compile, escape, MULTILINE from ..util import tagre from ..scraper import _BasicScraper, _ParserScraper from ..helpers import regexNamer, bounceStarter, indirectStarter -from .common import _WordPressScraper, _WPNavi, _WPWebcomic +from .common import WordPressScraper, WordPressNavi, WordPressWebcomic class AbstruseGoose(_ParserScraper): @@ -88,7 +88,7 @@ class AdventuresOfFifne(_ParserScraper): return super(AdventuresOfFifne, self).getPrevUrl(url, data) -class AfterStrife(_WPNavi): +class AfterStrife(WordPressNavi): baseUrl = 'http://afterstrife.com/' stripUrl = baseUrl + '?p=%s' url = stripUrl % '262' @@ -117,11 +117,11 @@ class AhoiPolloi(_ParserScraper): help = 'Index format: yyyymmdd' -class AhoyEarth(_WPNavi): +class AhoyEarth(WordPressNavi): url = 'http://www.ahoyearth.com/' -class AirForceBlues(_WordPressScraper): +class AirForceBlues(WordPressScraper): url = 'http://farvatoons.com/' firstStripUrl = url + 'comic/in-texas-there-are-texans/' @@ -136,7 +136,7 @@ class ALessonIsLearned(_BasicScraper): help = 'Index format: nnn' -class Alice(_WordPressScraper): +class Alice(WordPressScraper): url = 'https://web.archive.org/web/20210115132313/http://www.alicecomics.com/' latestSearch = '//a[text()="Latest Alice!"]' starter = indirectStarter @@ -153,12 +153,12 @@ class AlienLovesPredator(_BasicScraper): help = 'Index format: yyyy/mm/dd/name' -class AlienShores(_WordPressScraper): +class AlienShores(WordPressScraper): url = 'http://alienshores.com/alienshores_band/' firstStripUrl = url + 'AScomic/updated-cover/' -class AllTheGrowingThings(_WordPressScraper): +class AllTheGrowingThings(WordPressScraper): url = ('https://web.archive.org/web/20160611212229/' 'http://growingthings.typodmary.com/') stripUrl = url + '%s/' @@ -239,7 +239,7 @@ class AmbersNoBrainers(_ParserScraper): return self.stripUrl % str(pageNum - 1) -class Amya(_WordPressScraper): +class Amya(WordPressScraper): url = 'http://www.amyachronicles.com/' @@ -343,7 +343,7 @@ class ARedTailsDream(_BasicScraper): help = 'Index format: nn' -class ArtificialIncident(_WPWebcomic): +class ArtificialIncident(WordPressWebcomic): url = 'https://www.artificialincident.com/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % 'issue-one-life-changing' @@ -370,12 +370,12 @@ class AstronomyPOTD(_ParserScraper): image_url.split('/')[-1].split('.')[0]) -class ATaleOfTails(_WordPressScraper): +class ATaleOfTails(WordPressScraper): url = 'http://www.feretta.net/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % 'a-tale-of-tails-1-0' adult = True -class AxeCop(_WordPressScraper): +class AxeCop(WordPressScraper): url = 'http://axecop.com/comic/season-two/' diff --git a/dosagelib/plugins/arcamax.py b/dosagelib/plugins/arcamax.py index 170fc14b4..77cf36c14 100644 --- a/dosagelib/plugins/arcamax.py +++ b/dosagelib/plugins/arcamax.py @@ -1,16 +1,16 @@ # SPDX-License-Identifier: MIT # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam -# Copyright (C) 2015-2019 Tobias Gruetzmacher -from ..scraper import _ParserScraper +# Copyright (C) 2015-2022 Tobias Gruetzmacher +from ..scraper import ParserScraper -class Arcamax(_ParserScraper): +class Arcamax(ParserScraper): imageSearch = '//img[@id="comic-zoom"]' prevSearch = '//a[@class="prev"]' def __init__(self, name, path): - super(Arcamax, self).__init__('Arcamax/' + name) + super().__init__('Arcamax/' + name) self.url = 'http://www.arcamax.com/thefunnies/' + path + '/' @classmethod diff --git a/dosagelib/plugins/b.py b/dosagelib/plugins/b.py index ba9c307f0..657f4cc10 100644 --- a/dosagelib/plugins/b.py +++ b/dosagelib/plugins/b.py @@ -8,10 +8,10 @@ from re import compile, escape from ..util import tagre from ..scraper import _BasicScraper, _ParserScraper from ..helpers import indirectStarter -from .common import _ComicControlScraper, _WordPressScraper, _WPNavi, _WPWebcomic +from .common import ComicControlScraper, WordPressScraper, WordPressNavi, WordPressWebcomic -class BackOffice(_WPNavi): +class BackOffice(WordPressNavi): url = 'https://rawrtacular.com/bo/' stripUrl = url + '?comic=%s' firstStripUrl = stripUrl % 'back-office' @@ -37,7 +37,7 @@ class BadMachinery(_ParserScraper): help = 'Index format: yyyymmdd' -class BalderDash(_ComicControlScraper): +class BalderDash(ComicControlScraper): url = 'http://www.balderdashcomic.com/' @@ -52,7 +52,7 @@ class BallerinaMafia(_ParserScraper): endOfLife = True -class Bardsworth(_WordPressScraper): +class Bardsworth(WordPressScraper): url = 'http://www.bardsworth.com/' latestSearch = '//a[@rel="bookmark"]' starter = indirectStarter @@ -68,7 +68,7 @@ class Baroquen(_BasicScraper): help = 'Index format: yyyy/mm/dd/strip-name' -class Bearmageddon(_WordPressScraper): +class Bearmageddon(WordPressScraper): url = 'http://bearmageddon.com/bearmo/page-1/' firstStripUrl = url latestSearch = '//a[d:class("comic-nav-last")]' @@ -98,7 +98,7 @@ class Beetlebum(_BasicScraper): return name + '_' + image_url.split('/')[-1] -class Bethellium(_WPWebcomic): +class Bethellium(WordPressWebcomic): url = 'https://bethellium.darkbluecomics.com/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % 'cover' @@ -114,14 +114,14 @@ class BetterDays(_ParserScraper): endOfLife = True -class BetweenFailures(_WPWebcomic): +class BetweenFailures(WordPressWebcomic): url = 'https://betweenfailures.com/' stripUrl = url + 'comics1/%s' firstStripUrl = stripUrl % 'every-story-has-to-start-somewhere' help = 'Index format: stripname' -class BeyondTheVeil(_WordPressScraper): +class BeyondTheVeil(WordPressScraper): url = 'https://web.archive.org/web/20201009235642/http://beyondtheveilcomic.com/' stripUrl = url + '?comic=%s' firstStripUrl = stripUrl % '01252010' @@ -154,7 +154,7 @@ class BillyTheDunce(_ParserScraper): endOfLife = True -class BirdBoy(_WordPressScraper): +class BirdBoy(WordPressScraper): url = 'https://bird-boy.com/' stripUrl = url + 'comic/{0}-{1}/' firstStripUrl = stripUrl.format('volume-i', 'the-sword-of-mali-mani') @@ -214,12 +214,12 @@ class BlondeSunrise(_ParserScraper): prevSearch = '//a[img[contains(@src, "previous")]]' -class BloodBound(_WordPressScraper): +class BloodBound(WordPressScraper): url = 'http://bloodboundcomic.com/' firstStripUrl = 'http://bloodboundcomic.com/comic/06112006/' -class Bloodline(_WordPressScraper): +class Bloodline(WordPressScraper): url = 'http://w0lfmare.xepher.net/' stripUrl = url + 'comic/%s' firstStripUrl = stripUrl % 'pg-1-2' @@ -230,7 +230,7 @@ class Bloodline(_WordPressScraper): return imageUrl.rsplit('/', 1)[-1].replace('gen-6', 'Bloodline') -class BloomingFaeries(_WordPressScraper): +class BloomingFaeries(WordPressScraper): adult = True url = 'http://www.bloomingfaeries.com/' firstStripUrl = url + 'comic/public/pit-stop/' @@ -255,7 +255,7 @@ class BobWhite(_ParserScraper): prevSearch = '//a[@rel="previous"]' -class BookOfBiff(_WordPressScraper): +class BookOfBiff(WordPressScraper): url = 'https://thebookofbiff.com/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % '4' @@ -271,18 +271,18 @@ class BoredAndEvil(_ParserScraper): help = 'Index format: yyyy-mm-dd' -class BratHalla(_WordPressScraper): +class BratHalla(WordPressScraper): url = 'http://brat-halla.com/' -class Brink(_WordPressScraper): +class Brink(WordPressScraper): stripUrl = 'https://paperfangs.com/brink/?comic=%s' firstStripUrl = stripUrl % 'chapter1coversmall' url = stripUrl % 'brink639small' endOfLife = True -class Buni(_WordPressScraper): +class Buni(WordPressScraper): url = 'http://www.bunicomic.com/' @@ -293,7 +293,7 @@ class BusinessCat(_ParserScraper): endOfLife = True -class ButImACatPerson(_WordPressScraper): +class ButImACatPerson(WordPressScraper): url = 'https://www.bicatperson.com/' stripUrl = url + 'comic/%s/' firstStripUrl = 'sketches-1' @@ -330,7 +330,7 @@ class ButterSafe(_ParserScraper): help = 'Index format: yyyy/mm/dd/stripname' -class ByTheBook(_WordPressScraper): +class ByTheBook(WordPressScraper): url = 'http://www.btbcomic.com/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % 'chapter-1-page-0' diff --git a/dosagelib/plugins/c.py b/dosagelib/plugins/c.py index 2ebdd68d2..63660624e 100644 --- a/dosagelib/plugins/c.py +++ b/dosagelib/plugins/c.py @@ -9,7 +9,7 @@ from typing import List from ..scraper import _BasicScraper, _ParserScraper from ..helpers import bounceStarter, indirectStarter, joinPathPartsNamer from ..util import tagre -from .common import _WordPressScraper, _WPNavi, _WPWebcomic +from .common import WordPressScraper, WordPressNavi, WordPressWebcomic class CampComic(_ParserScraper): @@ -117,7 +117,7 @@ class CatAndGirl(_ParserScraper): prevSearch = '//a[d:class("pager--prev")]' -class CatenaCafe(_WordPressScraper): +class CatenaCafe(WordPressScraper): name = 'CatenaManor/CatenaCafe' url = 'https://catenamanor.com/' stripUrl = url + 'comic/%s/' @@ -153,20 +153,20 @@ class CatenaManor(_ParserScraper): return self.strips.pop(0) -class CatNine(_WordPressScraper): +class CatNine(WordPressScraper): url = 'https://classic.cat-nine.net/' firstStripUrl = url + 'comic/day-first' imageSearch = '//div[@id="comic"]//img/@data-src-img' endOfLife = True -class CatNineTakeTwo(_WordPressScraper): +class CatNineTakeTwo(WordPressScraper): name = 'CatNine/TakeTwo' url = 'https://cat-nine.net/' firstStripUrl = url + 'comic/episode-1/1-first-day-for-everything/' -class CatsAndCameras(_WordPressScraper): +class CatsAndCameras(WordPressScraper): url = 'https://catsncameras.com/cnc/' stripUrl = url + 'comic/%s' firstStripUrl = stripUrl % 'cnc-begins' @@ -181,7 +181,7 @@ class CatVersusHuman(_ParserScraper): starter = indirectStarter -class CavesAndCritters(_WPWebcomic): +class CavesAndCritters(WordPressWebcomic): url = 'https://cavesandcritters.com/?ao_confirm' stripUrl = 'https://cavesandcritters.com/cnc_webcomic/%s/' firstStripUrl = stripUrl % '01_000' @@ -205,7 +205,7 @@ class Centralia2050(_ParserScraper): return page + '.' + ext -class ChannelAte(_WPNavi): +class ChannelAte(WordPressNavi): url = 'http://www.channelate.com/' @@ -218,7 +218,7 @@ class ChasingTheSunset(_BasicScraper): help = 'Index format: n' -class Chester5000XYV(_WordPressScraper): +class Chester5000XYV(WordPressScraper): url = 'http://jessfink.com/Chester5000XYV/' stripUrl = url + '?p=%s' firstStripUrl = stripUrl % '34' @@ -233,7 +233,7 @@ class Chester5000XYV(_WordPressScraper): return tourl -class Chisuji(_WordPressScraper): +class Chisuji(WordPressScraper): url = 'http://www.chisuji.com/' stripUrl = url + '?p=%s' firstStripUrl = stripUrl % '266' @@ -249,7 +249,7 @@ class CigarroAndCerveja(_ParserScraper): prevSearch = '//a[contains(text()," Prev")]' -class ClanOfTheCats(_WordPressScraper): +class ClanOfTheCats(WordPressScraper): url = 'http://www.cotclassic.com/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % 'coming-home-2' @@ -259,7 +259,7 @@ class ClanOfTheCats(_WordPressScraper): return tourl.replace('/2954/', '/2002-06-22/') -class ClanOfTheCatsReunion(_WordPressScraper): +class ClanOfTheCatsReunion(WordPressScraper): name = 'ClanOfTheCats/Reunion' url = 'http://www.clanofthecats.com/' stripUrl = url + 'comic/%s/' @@ -295,7 +295,7 @@ class Comedity(_BasicScraper): help = 'Index format: n (no padding)' -class CommanderKitty(_WPNavi): +class CommanderKitty(WordPressNavi): url = 'http://www.commanderkitty.com/' stripUrl = url + '%s/' firstStripUrl = stripUrl % '2009/01/03/good-to-be-back' @@ -358,13 +358,13 @@ class CorydonCafe(_ParserScraper): multipleImagesPerStrip = True -class CourtingDisaster(_WordPressScraper): +class CourtingDisaster(WordPressScraper): url = 'https://web.archive.org/web/20201127150157/http://www.courting-disaster.com/' firstStripUrl = 'http://www.courting-disaster.com/comic/courting-disaster-17/' endOfLife = True -class CraftedFables(_WordPressScraper): +class CraftedFables(WordPressScraper): url = 'https://web.archive.org/web/20191126025641/http://www.caf-fiends.net/comicpress/' prevSearch = '//a[@rel="prev"]' endOfLife = True @@ -387,7 +387,7 @@ class CrimsonFlag(_ParserScraper): prevSearch = '//a[contains(@class, "prev")]' -class CritterCoven(_WordPressScraper): +class CritterCoven(WordPressScraper): url = 'http://crittercoven.com/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % 'critter-coven' @@ -403,14 +403,14 @@ class CrossTimeCafe(_ParserScraper): endOfLife = True -class CSectionComics(_WordPressScraper): +class CSectionComics(WordPressScraper): url = 'https://www.csectioncomics.com/' firstStripUrl = url + 'comics/one-day-in-country' namer = joinPathPartsNamer((), (-3, -2, -1)) multipleImagesPerStrip = True -class CucumberQuest(_WPWebcomic): +class CucumberQuest(WordPressWebcomic): baseUrl = 'http://cucumber.gigidigi.com/' stripUrl = baseUrl + 'cq/%s/' firstStripUrl = stripUrl % 'page-1' @@ -419,7 +419,7 @@ class CucumberQuest(_WPWebcomic): help = 'Index format: stripname' -class Curtailed(_WordPressScraper): +class Curtailed(WordPressScraper): url = 'https://www.curtailedcomic.com/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % '001-sneeze' diff --git a/dosagelib/plugins/clonemanga.py b/dosagelib/plugins/clonemanga.py index 30a4482a6..6db519550 100644 --- a/dosagelib/plugins/clonemanga.py +++ b/dosagelib/plugins/clonemanga.py @@ -1,13 +1,13 @@ # SPDX-License-Identifier: MIT # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam -# Copyright (C) 2015-2020 Tobias Gruetzmacher +# Copyright (C) 2015-2022 Tobias Gruetzmacher from ..helpers import indirectStarter -from ..scraper import _ParserScraper +from ..scraper import ParserScraper from ..util import getQueryParams -class CloneManga(_ParserScraper): +class CloneManga(ParserScraper): baseUrl = 'http://manga.clone-army.org' imageSearch = '//div[d:class("subsectionContainer")]//img' prevSearch = '//a[span[text()="<<"]]' @@ -16,7 +16,7 @@ class CloneManga(_ParserScraper): help = 'Index format: n' def __init__(self, name, shortName, endOfLife=False): - super(CloneManga, self).__init__('CloneManga/' + name) + super().__init__('CloneManga/' + name) self.stripUrl = '%s/viewer.php?page=%%s&lang=&series=%s&HUDoff=' % ( self.baseUrl, shortName) self.url = self.stripUrl % '1' diff --git a/dosagelib/plugins/comicfury.py b/dosagelib/plugins/comicfury.py index b0085e268..ba5811ba5 100644 --- a/dosagelib/plugins/comicfury.py +++ b/dosagelib/plugins/comicfury.py @@ -5,14 +5,14 @@ # Copyright (C) 2019-2020 Daniel Ring import os -from ..scraper import _ParserScraper +from ..scraper import ParserScraper from ..helpers import bounceStarter XPATH_LINK = '//a[d:class("%s") and contains(text(), "%s")]' XPATH_IMG = '//div[d:class("comicnav")]//a[img[contains(@alt, "%s")]]' -class ComicFury(_ParserScraper): +class ComicFury(ParserScraper): imageSearch = ( '//img[@id="comicimage"]', '//div[@id="comicimagewrap"]//embed', @@ -56,7 +56,7 @@ class ComicFury(_ParserScraper): starter = bounceStarter def __init__(self, name, sub, lang=None, adult=False, endOfLife=False, segmented=False): - super(ComicFury, self).__init__('ComicFury/' + name) + super().__init__('ComicFury/' + name) self.prefix = name self.url = 'https://%s.webcomic.ws/comics/' % sub self.stripUrl = self.url + '%s' diff --git a/dosagelib/plugins/comicgenesis.py b/dosagelib/plugins/comicgenesis.py index 59c35eb75..c0041fe57 100644 --- a/dosagelib/plugins/comicgenesis.py +++ b/dosagelib/plugins/comicgenesis.py @@ -1,15 +1,15 @@ # SPDX-License-Identifier: MIT # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam -# Copyright (C) 2015-2020 Tobias Gruetzmacher +# Copyright (C) 2015-2022 Tobias Gruetzmacher # Copyright (C) 2019-2020 Daniel Ring -from ..scraper import _ParserScraper +from ..scraper import ParserScraper # Comicgenesis has a lot of comics, but most of them are disallowed by # robots.txt -class ComicGenesis(_ParserScraper): +class ComicGenesis(ParserScraper): multipleImagesPerStrip = True imageSearch = '//img[contains(@src, "/comics/")]' prevSearch = ( @@ -19,7 +19,7 @@ class ComicGenesis(_ParserScraper): help = 'Index format: yyyymmdd' def __init__(self, name, sub=None, last=None, baseUrl=None, lang=None): - super(ComicGenesis, self).__init__('ComicGenesis/' + name) + super().__init__('ComicGenesis/' + name) if sub: baseUrl = 'http://%s.comicgenesis.com/' % sub diff --git a/dosagelib/plugins/comicskingdom.py b/dosagelib/plugins/comicskingdom.py index b78485fc5..f87115a44 100644 --- a/dosagelib/plugins/comicskingdom.py +++ b/dosagelib/plugins/comicskingdom.py @@ -4,10 +4,10 @@ from importlib.resources import path as get_path from ..helpers import bounceStarter, joinPathPartsNamer -from ..scraper import _ParserScraper +from ..scraper import ParserScraper -class ComicsKingdom(_ParserScraper): +class ComicsKingdom(ParserScraper): imageSearch = '//img[@id="theComicImage"]' prevSearch = '//a[./img[contains(@alt, "Previous")]]' nextSearch = '//a[./img[contains(@alt, "Next")]]' diff --git a/dosagelib/plugins/common.py b/dosagelib/plugins/common.py index 00afc71a2..c14a5b7fb 100644 --- a/dosagelib/plugins/common.py +++ b/dosagelib/plugins/common.py @@ -5,43 +5,51 @@ # Copyright (C) 2019-2020 Daniel Ring from typing import Sequence, Union -from ..scraper import _ParserScraper +from ..scraper import ParserScraper # Common base classes for comics with the same structure (same hosting # software, for example) go here. Since those are shared by many modules, # please don't use lists of expression, as that makes it hard to track which # expression is for which comics. +__all__ = ( + 'ComicControlScraper', + 'WordPressNavi', + 'WordPressNaviIn', + 'WordPressScraper', + 'WordPressSpliced', + 'WordPressWebcomic', +) -class _WordPressScraper(_ParserScraper): +class ComicControlScraper(ParserScraper): + imageSearch: Union[Sequence[str], str] = '//img[@id="cc-comic"]' + prevSearch = '//a[@rel="prev"]' + nextSearch = '//a[@rel="next"]' + latestSearch = '//a[@rel="last"]' + + +class WordPressScraper(ParserScraper): imageSearch = '//div[@id="comic"]//img' prevSearch = '//a[d:class("comic-nav-previous")]' nextSearch = '//a[d:class("comic-nav-next")]' latestSearch = '//a[d:class("comic-nav-last")]' -class _WordPressSpliced(_ParserScraper): +class WordPressSpliced(ParserScraper): imageSearch = '//div[@id="one-comic-option"]//img' prevSearch = '//a[d:class("previous-comic")]' -class _WPNavi(_WordPressScraper): +class WordPressNavi(WordPressScraper): prevSearch = '//a[d:class("navi-prev")]' -class _WPNaviIn(_WordPressScraper): +class WordPressNaviIn(WordPressScraper): prevSearch = '//a[d:class("navi-prev-in")]' -class _WPWebcomic(_ParserScraper): +class WordPressWebcomic(ParserScraper): imageSearch = '//div[d:class("webcomic-image")]//img' prevSearch = '//a[d:class("previous-webcomic-link")]' nextSearch = '///a[d:class("next-webcomic-link")]' latestSearch = '//a[d:class("last-webcomic-link")]' - - -class _ComicControlScraper(_ParserScraper): - imageSearch: Union[Sequence[str], str] = '//img[@id="cc-comic"]' - prevSearch = '//a[@rel="prev"]' - nextSearch = '//a[@rel="next"]' - latestSearch = '//a[@rel="last"]' diff --git a/dosagelib/plugins/creators.py b/dosagelib/plugins/creators.py index bc202cf0a..250b390b8 100644 --- a/dosagelib/plugins/creators.py +++ b/dosagelib/plugins/creators.py @@ -1,12 +1,12 @@ # SPDX-License-Identifier: MIT # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam -# Copyright (C) 2015-2020 Tobias Gruetzmacher -from ..scraper import _ParserScraper +# Copyright (C) 2015-2022 Tobias Gruetzmacher +from ..scraper import ParserScraper from ..helpers import indirectStarter -class Creators(_ParserScraper): +class Creators(ParserScraper): imageSearch = '//a[contains(@class,"fancybox")]/img' prevSearch = '//a[@id="nav_prev"]' latestSearch = '//div[contains(@class,"caption")]/a' diff --git a/dosagelib/plugins/d.py b/dosagelib/plugins/d.py index 23945d94b..fd53b440f 100644 --- a/dosagelib/plugins/d.py +++ b/dosagelib/plugins/d.py @@ -8,8 +8,8 @@ from re import compile, escape from ..scraper import _BasicScraper, _ParserScraper from ..helpers import indirectStarter, bounceStarter from ..util import tagre -from .common import (_ComicControlScraper, _WordPressScraper, _WPNavi, - _WPWebcomic) +from .common import (ComicControlScraper, WordPressScraper, WordPressNavi, + WordPressWebcomic) class Damonk(_BasicScraper): @@ -22,12 +22,12 @@ class Damonk(_BasicScraper): help = 'Index format: yyyymmdd' -class DangerouslyChloe(_ComicControlScraper): +class DangerouslyChloe(ComicControlScraper): url = 'http://www.dangerouslychloe.com/' firstStripUrl = url + 'strips-dc/Chapter_1_-_That_damned_girl' -class DarkWhite(_WordPressScraper): +class DarkWhite(WordPressScraper): url = 'https://www.darkwhitecomic.com/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % 'chapter-1-sleep' @@ -52,7 +52,7 @@ class DasLebenIstKeinPonyhof(_ParserScraper): lang = 'de' -class DaughterOfTheLilies(_ComicControlScraper): +class DaughterOfTheLilies(ComicControlScraper): url = 'https://www.daughterofthelilies.com/' firstStripUrl = url + 'dotl/part-1-a-girl-with-no-face' @@ -97,7 +97,7 @@ class DeerMe(_ParserScraper): starter = bounceStarter -class Delve(_WordPressScraper): +class Delve(WordPressScraper): url = 'https://thisis.delvecomic.com/NewWP/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % 'in-too-deep' @@ -138,7 +138,7 @@ class DerTodUndDasMaedchen(_ParserScraper): lang = 'de' -class DesertFox(_WPWebcomic): +class DesertFox(WordPressWebcomic): url = 'https://desertfoxcomics.net/' stripUrl = url + 'comics/%s/' firstStripUrl = stripUrl % 'origins-1' @@ -206,7 +206,7 @@ class Dilbert(_ParserScraper): return "%s" % name -class DocRat(_WPWebcomic): +class DocRat(WordPressWebcomic): url = 'https://www.docrat.com.au/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % 'begin-with-eye-contact' @@ -239,7 +239,7 @@ class DoemainOfOurOwn(_ParserScraper): return filename -class DoesNotPlayWellWithOthers(_WPNavi): +class DoesNotPlayWellWithOthers(WordPressNavi): url = 'http://www.doesnotplaywellwithothers.com/' stripUrl = url + 'comic/%s' firstStripUrl = stripUrl % 'pwc-0001' @@ -283,7 +283,7 @@ class DoomsdayMyDear(_ParserScraper): prevSearch = '//a[d:class("previous-webcomic-link")]' -class Draconia(_WPWebcomic): +class Draconia(WordPressWebcomic): url = 'https://www.draconiachronicles.com/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % 'chapter-1-page-1' @@ -372,7 +372,7 @@ class Drowtales(_ParserScraper): help = 'Index format: number' -class DungeonsAndDenizens(_WPNavi): +class DungeonsAndDenizens(WordPressNavi): url = ('https://web.archive.org/web/20160308001834/' 'http://dungeond.com/') stripUrl = url + '%s/' @@ -380,7 +380,7 @@ class DungeonsAndDenizens(_WPNavi): endOfLife = True -class DumbingOfAge(_WPNavi): +class DumbingOfAge(WordPressNavi): url = 'http://www.dumbingofage.com/' stripUrl = url + '%s/' help = 'Index format: yyyy/comic/book-num/seriesname/stripname' diff --git a/dosagelib/plugins/derideal.py b/dosagelib/plugins/derideal.py index f0fd9bdbf..7b8d2e298 100644 --- a/dosagelib/plugins/derideal.py +++ b/dosagelib/plugins/derideal.py @@ -1,11 +1,11 @@ # SPDX-License-Identifier: MIT -# Copyright (C) 2019-2020 Tobias Gruetzmacher +# Copyright (C) 2019-2022 Tobias Gruetzmacher # Copyright (C) 2019-2020 Daniel Ring -from ..scraper import _ParserScraper +from ..scraper import ParserScraper from ..helpers import indirectStarter -class Derideal(_ParserScraper): +class Derideal(ParserScraper): baseUrl = 'https://www.derideal.com/' imageSearch = '//img[contains(@class, "comic-page")]' prevSearch = '//a[i[contains(@class, "fa-angle-left")]]' @@ -13,9 +13,9 @@ class Derideal(_ParserScraper): def __init__(self, name, sub, first, last=None): if name == 'Derideal': - super(Derideal, self).__init__(name) + super().__init__(name) else: - super(Derideal, self).__init__('Derideal/' + name) + super().__init__('Derideal/' + name) self.url = self.baseUrl + sub self.stripUrl = self.url + '/%s/' diff --git a/dosagelib/plugins/dmfa.py b/dosagelib/plugins/dmfa.py index d4b2a1fbb..e8732fc31 100644 --- a/dosagelib/plugins/dmfa.py +++ b/dosagelib/plugins/dmfa.py @@ -1,11 +1,11 @@ # SPDX-License-Identifier: MIT -# Copyright (C) 2019-2020 Tobias Gruetzmacher +# Copyright (C) 2019-2022 Tobias Gruetzmacher # Copyright (C) 2019-2020 Daniel Ring from ..helpers import bounceStarter -from .common import _ParserScraper +from ..scraper import ParserScraper -class DMFA(_ParserScraper): +class DMFA(ParserScraper): url = 'http://www.missmab.com/' stripUrl = url + 'Comics/%s.php' imageSearch = '//center//img' diff --git a/dosagelib/plugins/e.py b/dosagelib/plugins/e.py index 0cc8b2168..eded2c6ba 100644 --- a/dosagelib/plugins/e.py +++ b/dosagelib/plugins/e.py @@ -9,7 +9,7 @@ from re import compile, IGNORECASE from ..helpers import bounceStarter, indirectStarter from ..scraper import _BasicScraper, _ParserScraper from ..util import tagre -from .common import _ComicControlScraper, _WordPressScraper, _WPNavi +from .common import ComicControlScraper, WordPressScraper, WordPressNavi class EarthsongSaga(_ParserScraper): @@ -51,10 +51,10 @@ class EatLiver(_ParserScraper): latestSearch = '//a[@rel="bookmark"]' -class EatThatToast(_WordPressScraper): +class EatThatToast(WordPressScraper): url = 'http://eatthattoast.com/' firstStripUrl = url + 'comic/thewizard/' - textSearch = _WordPressScraper.imageSearch + '/@alt' + textSearch = WordPressScraper.imageSearch + '/@alt' class EdibleDirt(_BasicScraper): @@ -67,7 +67,7 @@ class EdibleDirt(_BasicScraper): help = 'Index format: number' -class EdmundFinney(_WPNavi): +class EdmundFinney(WordPressNavi): url = 'http://eqcomics.com/' firstStripUrl = url + '2009/03/08/sunday-aliens/' @@ -82,11 +82,11 @@ class ElfOnlyInn(_BasicScraper): help = 'Index format: yyyymmdd' -class ElGoonishShive(_ComicControlScraper): +class ElGoonishShive(ComicControlScraper): url = 'http://www.egscomics.com/' -class ElGoonishShiveNP(_ComicControlScraper): +class ElGoonishShiveNP(ComicControlScraper): url = 'http://www.egscomics.com/egsnp.php' @@ -165,12 +165,12 @@ class ErrantStory(_BasicScraper): help = 'Index format: yyyy-mm-dd/num' -class Erstwhile(_WPNavi): +class Erstwhile(WordPressNavi): url = 'http://www.erstwhiletales.com/' endOfLife = True -class Everblue(_ComicControlScraper): +class Everblue(ComicControlScraper): url = 'http://www.everblue-comic.com/comic/' stripUrl = url + '%s' firstStripUrl = stripUrl % '1' @@ -186,7 +186,7 @@ class EverybodyLovesEricRaymond(_ParserScraper): prevSearch = '//a[@rel="prev"]' -class EvilDiva(_WordPressScraper): +class EvilDiva(WordPressScraper): url = ('https://web.archive.org/web/20190221223751/' 'https://www.evildivacomics.com/') firstStripUrl = url + 'comic/evil-diva-issue-1-cover/' @@ -210,19 +210,19 @@ class Evilish(_ParserScraper): help = 'Index format: yyyymmdd' -class Evon(_WordPressScraper): +class Evon(WordPressScraper): url = 'http://evoncomics.com/' stripUrl = url + '?comic=%s' firstStripUrl = stripUrl % 'chapter-1' adult = True -class Exiern(_WordPressScraper): +class Exiern(WordPressScraper): url = 'http://www.exiern.com/' firstStripUrl = url + '2005/09/06/so-far/' -class ExploitationNow(_WPNavi): +class ExploitationNow(WordPressNavi): url = 'http://www.exploitationnow.com/' firstStripUrl = url + '2000-07-07/9' endOfLife = True @@ -237,7 +237,7 @@ class Exvulnerum(_ParserScraper): prevSearch = '//a[./img[contains(@src, "nav_prev")]]' -class ExtraFabulousComics(_WordPressScraper): +class ExtraFabulousComics(WordPressScraper): url = 'https://extrafabulouscomics.com/' firstStripUrl = url + 'comic/buttfly/' starter = bounceStarter diff --git a/dosagelib/plugins/f.py b/dosagelib/plugins/f.py index 0078d69db..fa259e5f2 100644 --- a/dosagelib/plugins/f.py +++ b/dosagelib/plugins/f.py @@ -8,7 +8,7 @@ from re import compile, escape from ..util import tagre from ..scraper import _BasicScraper, _ParserScraper from ..helpers import indirectStarter, joinPathPartsNamer -from .common import _ComicControlScraper, _WPNaviIn, _WordPressScraper +from .common import ComicControlScraper, WordPressNaviIn, WordPressScraper class FalconTwin(_BasicScraper): @@ -38,7 +38,7 @@ class FalseStart(_ParserScraper): return self.archive[self.archive.index(url) - 1] -class Faneurysm(_WPNaviIn): +class Faneurysm(WordPressNaviIn): url = 'http://hijinksensue.com/comic/think-only-tree/' firstStripUrl = 'http://hijinksensue.com/comic/captains-prerogative/' endOfLife = True @@ -55,7 +55,7 @@ class FantasyRealms(_ParserScraper): help = 'Index format: nnn' -class FarToTheNorth(_ComicControlScraper): +class FarToTheNorth(ComicControlScraper): url = 'http://www.farnorthcomic.com/' stripUrl = url + 'comic/%s' firstStripUrl = stripUrl % 'don39t-tell' @@ -70,7 +70,7 @@ class FauxPas(_ParserScraper): help = 'Index format: nnn' -class FireflyCross(_WordPressScraper): +class FireflyCross(WordPressScraper): url = 'http://www.fireflycross.pensandtales.com/' firstStripUrl = url + '?comic=05062002' @@ -135,7 +135,7 @@ class FonFlatter(_ParserScraper): ) -class ForestHill(_WordPressScraper): +class ForestHill(WordPressScraper): url = 'https://www.foresthillcomic.org/' @@ -226,7 +226,7 @@ class FreighterTails(_ParserScraper): endOfLife = True -class FriendsYouAreStuckWith(_WordPressScraper): +class FriendsYouAreStuckWith(WordPressScraper): url = 'http://friendsyasw.com/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % 'wanted' @@ -247,7 +247,7 @@ class FullFrontalNerdity(_BasicScraper): help = 'Index format: number' -class FunInJammies(_WordPressScraper): +class FunInJammies(WordPressScraper): url = ('https://web.archive.org/web/20170205105241/' 'http://funinjammies.com/') stripUrl = url + 'comic.php?issue=%s' diff --git a/dosagelib/plugins/flowerlark.py b/dosagelib/plugins/flowerlark.py index 77c66889f..a5edc12d4 100644 --- a/dosagelib/plugins/flowerlark.py +++ b/dosagelib/plugins/flowerlark.py @@ -1,10 +1,10 @@ # SPDX-License-Identifier: MIT # Copyright (C) 2021 Tobias Gruetzmacher from ..helpers import indirectStarter -from .common import _WordPressScraper +from .common import WordPressScraper -class FlowerlarkStudios(_WordPressScraper): +class FlowerlarkStudios(WordPressScraper): starter = indirectStarter def __init__(self, name, sub): diff --git a/dosagelib/plugins/footloosecomic.py b/dosagelib/plugins/footloosecomic.py index 230cb38c6..67a578161 100644 --- a/dosagelib/plugins/footloosecomic.py +++ b/dosagelib/plugins/footloosecomic.py @@ -1,11 +1,11 @@ # SPDX-License-Identifier: MIT # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam -# Copyright (C) 2015-2016 Tobias Gruetzmacher -from ..scraper import _ParserScraper +# Copyright (C) 2015-2022 Tobias Gruetzmacher +from ..scraper import ParserScraper -class Footloose(_ParserScraper): +class Footloose(ParserScraper): url = 'http://footloosecomic.com/footloose.php' imageSearch = '//body/p[1]//img' prevSearch = '//body/a[2]' diff --git a/dosagelib/plugins/g.py b/dosagelib/plugins/g.py index 47fbda7f8..aa2726144 100644 --- a/dosagelib/plugins/g.py +++ b/dosagelib/plugins/g.py @@ -8,10 +8,10 @@ from re import compile, escape from ..scraper import _BasicScraper, _ParserScraper from ..helpers import indirectStarter from ..util import tagre -from .common import _ComicControlScraper, _WordPressScraper, _WPNavi +from .common import ComicControlScraper, WordPressScraper, WordPressNavi -class Galaxion(_WPNavi): +class Galaxion(WordPressNavi): url = 'http://galaxioncomics.com/' stripUrl = url + '%s/' firstStripUrl = stripUrl % '1-comic/the-story-so-far/the-story-so-far' @@ -19,7 +19,7 @@ class Galaxion(_WPNavi): help = 'Index format: n-comic/book-n/chapter-n/title-nnn' -class Garanos(_WordPressScraper): +class Garanos(WordPressScraper): stripUrl = ('https://web.archive.org/web/20180314181433/' 'http://garanos.alexheberling.com/pages/%s/') url = stripUrl % 'page-487' @@ -59,7 +59,7 @@ class GeeksNextDoor(_ParserScraper): help = 'Index format: yyyy-mm-dd' -class Ginpu(_WPNavi): +class Ginpu(WordPressNavi): url = 'https://www.ginpu.us/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % 'filler-2' @@ -98,7 +98,7 @@ class GirlsWithSlingshots(_BasicScraper): help = 'Index format: stripname' -class GleefulNihilism(_WordPressScraper): +class GleefulNihilism(WordPressScraper): url = ('https://web.archive.org/web/20170911203122/' 'http://gleefulnihilism.com/') stripUrl = url + 'comic/%s/' @@ -107,15 +107,15 @@ class GleefulNihilism(_WordPressScraper): help = 'Index format: stripname' -class GoblinsComic(_ComicControlScraper): +class GoblinsComic(ComicControlScraper): url = 'http://www.goblinscomic.org/' -class GodChild(_WordPressScraper): +class GodChild(WordPressScraper): url = 'http://godchild.keenspot.com/' -class GoGetARoomie(_ComicControlScraper): +class GoGetARoomie(ComicControlScraper): url = 'http://www.gogetaroomie.com' @@ -135,7 +135,7 @@ class GoneWithTheBlastwave(_BasicScraper): return '%02d' % int(compile(r'nro=(\d+)').search(page_url).group(1)) -class GrrlPower(_WordPressScraper): +class GrrlPower(WordPressScraper): url = 'https://grrlpowercomic.com/' stripUrl = url + 'archives/comic/%s/' firstStripUrl = stripUrl % 'gp0001' @@ -145,7 +145,7 @@ class GrrlPower(_WordPressScraper): self.session.add_throttle('grrlpowercomic.com', 1.0, 1.5) -class GuildedAge(_WordPressScraper): +class GuildedAge(WordPressScraper): url = 'http://guildedage.net/' firstStripUrl = url + 'comic/chapter-1-cover/' diff --git a/dosagelib/plugins/gocomics.py b/dosagelib/plugins/gocomics.py index 081bc80bf..f9ee7bce2 100644 --- a/dosagelib/plugins/gocomics.py +++ b/dosagelib/plugins/gocomics.py @@ -2,11 +2,11 @@ # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam # Copyright (C) 2015-2022 Tobias Gruetzmacher -from ..scraper import _ParserScraper +from ..scraper import ParserScraper from ..helpers import indirectStarter -class GoComics(_ParserScraper): +class GoComics(ParserScraper): url = 'https://www.gocomics.com/' imageSearch = '//picture[d:class("item-comic-image")]/img' prevSearch = '//a[d:class("js-previous-comic")]' diff --git a/dosagelib/plugins/h.py b/dosagelib/plugins/h.py index 21b0fbcc3..4ed5f75bf 100644 --- a/dosagelib/plugins/h.py +++ b/dosagelib/plugins/h.py @@ -1,17 +1,17 @@ # SPDX-License-Identifier: MIT # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam -# Copyright (C) 2015-2020 Tobias Gruetzmacher +# Copyright (C) 2015-2022 Tobias Gruetzmacher # Copyright (C) 2019-2020 Daniel Ring from re import compile, escape -from ..scraper import _BasicScraper, _ParserScraper +from ..scraper import BasicScraper, ParserScraper from ..util import tagre from ..helpers import bounceStarter, indirectStarter -from .common import _ComicControlScraper, _WordPressScraper, _WPNaviIn +from .common import ComicControlScraper, WordPressScraper, WordPressNaviIn -class Hackles(_ParserScraper): +class Hackles(ParserScraper): url = 'http://hackles.org/' stripUrl = url + 'cgi-bin/archives.pl?request=%s' firstStripUrl = stripUrl % '1' @@ -20,7 +20,7 @@ class Hackles(_ParserScraper): endOfLife = True -class HagarTheHorrible(_BasicScraper): +class HagarTheHorrible(BasicScraper): url = 'http://www.hagarthehorrible.net/' stripUrl = 'http://www.hagardunor.net/comicstrips_us.php?serietype=9&colortype=1&serieno=%s' firstStripUrl = stripUrl % '1' @@ -38,12 +38,7 @@ class HagarTheHorrible(_BasicScraper): return self.fetchUrls(url, data, pattern)[-1] -# "Hiatus", navigation missing -class _HappyJar(_WordPressScraper): - url = 'http://www.happyjar.com/' - - -class HarkAVagrant(_BasicScraper): +class HarkAVagrant(BasicScraper): url = 'http://www.harkavagrant.com/' rurl = escape(url) starter = bounceStarter @@ -63,60 +58,60 @@ class HarkAVagrant(_BasicScraper): return '%s-%s' % (num, filename) -class HavocInc(_WordPressScraper): +class HavocInc(WordPressScraper): url = 'http://www.radiocomix.com/havoc-inc/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % 'havoc-cover' -class HeadlessBliss(_ComicControlScraper): +class HeadlessBliss(ComicControlScraper): url = 'http://headlessbliss.com/' -class HeyFox(_WordPressScraper): +class HeyFox(WordPressScraper): url = 'http://www.steamclaw.com/heyfox/' stripUrl = url + 'archives/comic/%s' firstStripUrl = stripUrl % '11092004' adult = True -class HeyKitty(_WordPressScraper): +class HeyKitty(WordPressScraper): url = 'http://heykittycomic.com/' stripUrl = url + '?comic=%s' firstStripUrl = stripUrl % 'it-begins' -class Hipsters(_WordPressScraper): +class Hipsters(WordPressScraper): url = 'http://www.hipsters-comic.com/' firstStripUrl = 'http://www.hipsters-comic.com/comic/hip01/' -class HijinksEnsue(_WPNaviIn): +class HijinksEnsue(WordPressNaviIn): url = 'http://hijinksensue.com/' latestSearch = '//a[text()="Latest HijiNKS ENSUE"]' firstStripUrl = 'http://hijinksensue.com/comic/who-is-your-daddy-and-what-does-he-do/' starter = indirectStarter -class HijinksEnsueClassic(_WPNaviIn): +class HijinksEnsueClassic(WordPressNaviIn): url = 'http://hijinksensue.com/comic/open-your-eyes/' firstStripUrl = 'http://hijinksensue.com/comic/a-soul-as-black-as-eyeliner/' endOfLife = True -class HijinksEnsueConvention(_WPNaviIn): +class HijinksEnsueConvention(WordPressNaviIn): url = 'http://hijinksensue.com/comic/emerald-city-comicon-2015-fancy-sketches-part-4/' firstStripUrl = 'http://hijinksensue.com/comic/whatever-dad-im-outta-here/' endOfLife = True -class HijinksEnsuePhoto(_WPNaviIn): +class HijinksEnsuePhoto(WordPressNaviIn): url = 'http://hijinksensue.com/comic/emerald-city-comicon-2015-fancy-photo-comic-part-2/' firstStripUrl = 'http://hijinksensue.com/comic/san-diego-comic-con-fancy-picto-comic-pt-1/' endOfLife = True -class HowToBeAWerewolf(_ComicControlScraper): +class HowToBeAWerewolf(ComicControlScraper): url = 'http://howtobeawerewolf.com/' stripUrl = url + 'comic/%s' firstStripUrl = stripUrl % 'coming-february-3rd' diff --git a/dosagelib/plugins/i.py b/dosagelib/plugins/i.py index 1cf6a907b..460bc49af 100644 --- a/dosagelib/plugins/i.py +++ b/dosagelib/plugins/i.py @@ -5,12 +5,12 @@ # Copyright (C) 2019-2020 Daniel Ring from re import compile, escape -from ..scraper import _BasicScraper, _ParserScraper +from ..scraper import BasicScraper, ParserScraper from ..util import tagre -from .common import _WordPressScraper, _WPNavi +from .common import WordPressScraper, WordPressNavi -class IAmArg(_BasicScraper): +class IAmArg(BasicScraper): url = 'http://iamarg.com/' rurl = escape(url) stripUrl = url + '%s/' @@ -20,7 +20,7 @@ class IAmArg(_BasicScraper): help = 'Index format: yyyy/mm/dd/stripname' -class ICanBarelyDraw(_BasicScraper): +class ICanBarelyDraw(BasicScraper): url = 'http://www.icanbarelydraw.com/comic/' rurl = escape(url) stripUrl = url + '%s' @@ -30,18 +30,18 @@ class ICanBarelyDraw(_BasicScraper): help = 'Index format: number' -class IDreamOfAJeanieBottle(_WordPressScraper): +class IDreamOfAJeanieBottle(WordPressScraper): url = 'http://jeaniebottle.com/' -class InternetWebcomic(_WPNavi): +class InternetWebcomic(WordPressNavi): url = 'http://www.internet-webcomic.com/' stripUrl = url + '?p=%s' firstStripUrl = stripUrl % '30' help = 'Index format: n' -class IrregularWebcomic(_BasicScraper): +class IrregularWebcomic(BasicScraper): url = 'http://www.irregularwebcomic.net/' stripUrl = url + '%s.html' firstStripUrl = stripUrl % '1' @@ -50,7 +50,7 @@ class IrregularWebcomic(_BasicScraper): help = 'Index format: nnn' -class IslaAukate(_ParserScraper): +class IslaAukate(ParserScraper): url = 'https://overlordcomic.com/archive/default/latest' stripUrl = 'https://overlordcomic.com/archive/default/pages/%s' firstStripUrl = stripUrl % '001' @@ -62,7 +62,7 @@ class IslaAukate(_ParserScraper): return filename.rsplit('_', 1)[0] + '.' + filename.rsplit('.', 1)[-1] -class IslaAukateColor(_ParserScraper): +class IslaAukateColor(ParserScraper): url = 'https://overlordcomic.com/archive/color/latest' stripUrl = 'https://overlordcomic.com/archive/color/pages/%s' firstStripUrl = stripUrl % '001' @@ -77,5 +77,5 @@ class IslaAukateColor(_ParserScraper): return filename.rsplit('_', 1)[0] + '.' + filename.rsplit('.', 1)[-1] -class ItsWalky(_WordPressScraper): +class ItsWalky(WordPressScraper): url = 'http://www.itswalky.com/' diff --git a/dosagelib/plugins/j.py b/dosagelib/plugins/j.py index c7be98daf..770fea028 100644 --- a/dosagelib/plugins/j.py +++ b/dosagelib/plugins/j.py @@ -4,13 +4,13 @@ # Copyright (C) 2015-2022 Tobias Gruetzmacher from re import compile, escape -from ..scraper import _BasicScraper +from ..scraper import BasicScraper from ..util import tagre from ..helpers import indirectStarter -from .common import _ComicControlScraper +from .common import ComicControlScraper -class JackCannon(_BasicScraper): +class JackCannon(BasicScraper): url = 'http://fancyadventures.com/' rurl = escape(url) stripUrl = url + '%s/' @@ -20,7 +20,7 @@ class JackCannon(_BasicScraper): help = 'Index format: yyyy/mm/dd/page-nnn' -class JimBenton(_BasicScraper): +class JimBenton(BasicScraper): url = 'http://www.jimbenton.com/page14/page14.html' stripUrl = 'http://www.jimbenton.com/page14/files/JimBentonComic-%s.html' starter = indirectStarter @@ -32,7 +32,7 @@ class JimBenton(_BasicScraper): help = 'Index format: stripname' -class JoeAndMonkey(_BasicScraper): +class JoeAndMonkey(BasicScraper): url = 'http://www.joeandmonkey.com/' stripUrl = url + '%s' imageSearch = compile(r'"(/comic/[^"]+)"') @@ -40,7 +40,7 @@ class JoeAndMonkey(_BasicScraper): help = 'Index format: nnn' -class JohnnyWander(_ComicControlScraper): +class JohnnyWander(ComicControlScraper): imageSearch = ('//ul[d:class("cc-showbig")]/li/@data-src', '//img[@id="cc-comic"]') url = 'http://www.johnnywander.com/' diff --git a/dosagelib/plugins/k.py b/dosagelib/plugins/k.py index 2ce37d9ad..b9deae4b6 100644 --- a/dosagelib/plugins/k.py +++ b/dosagelib/plugins/k.py @@ -5,11 +5,11 @@ # Copyright (C) 2019-2020 Daniel Ring from re import compile, IGNORECASE -from ..scraper import _BasicScraper, _ParserScraper -from .common import _ComicControlScraper, _WordPressScraper, _WPNavi, _WPWebcomic +from ..scraper import BasicScraper, ParserScraper +from .common import ComicControlScraper, WordPressScraper, WordPressNavi, WordPressWebcomic -class Kaspall(_ParserScraper): +class Kaspall(ParserScraper): stripUrl = 'http://www.kaspall.com/comic/%s' url = stripUrl % '2015/10/11' firstStripUrl = '2004/08/05' @@ -18,7 +18,7 @@ class Kaspall(_ParserScraper): endOfLife = True -class KevinAndKell(_BasicScraper): +class KevinAndKell(BasicScraper): url = 'http://www.kevinandkell.com/' stripUrl = url + '%s/kk%s%s.html' firstStripUrl = stripUrl % ('1995', '09', '03') @@ -33,31 +33,31 @@ class KevinAndKell(_BasicScraper): return self.stripUrl % tuple(map(int, index.split('-'))) -class KickInTheHead(_WPNavi): +class KickInTheHead(WordPressNavi): url = 'http://www.kickinthehead.org/' firstStripUrl = url + '2003/03/20/ipod-envy/' -class KillSixBillionDemons(_WPNavi): +class KillSixBillionDemons(WordPressNavi): url = 'http://killsixbilliondemons.com/' firstStripUrl = url + 'comic/kill-six-billion-demons-chapter-1/' multipleImagesPerStrip = True adult = True -class Kitfox(_WordPressScraper): +class Kitfox(WordPressScraper): url = 'http://www.kitfox.com/wordpress/' stripUrl = url + '?comic=%s' firstStripUrl = stripUrl % 'the-adventure-begins-almost' -class KiwiBlitz(_ComicControlScraper): +class KiwiBlitz(ComicControlScraper): url = 'http://www.kiwiblitz.com/' stripUrl = url + 'comic/%s' firstStripUrl = stripUrl % 'welcome-to-kb' -class Krakow(_BasicScraper): +class Krakow(BasicScraper): url = 'http://www.krakow.krakowstudios.com/' stripUrl = url + 'archive.php?date=%s' firstStripUrl = stripUrl % '20081111' @@ -67,7 +67,7 @@ class Krakow(_BasicScraper): help = 'Index format: yyyymmdd' -class KuroShouri(_WPWebcomic): +class KuroShouri(WordPressWebcomic): url = 'http://kuroshouri.com/' stripUrl = url + 'kuroshouri/%s/' firstStripUrl = stripUrl % 'kuro-shouri' diff --git a/dosagelib/plugins/keenspot.py b/dosagelib/plugins/keenspot.py index 7156d8467..ea00485c9 100644 --- a/dosagelib/plugins/keenspot.py +++ b/dosagelib/plugins/keenspot.py @@ -1,12 +1,12 @@ # SPDX-License-Identifier: MIT # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam -# Copyright (C) 2015-2020 Tobias Gruetzmacher +# Copyright (C) 2015-2022 Tobias Gruetzmacher # Copyright (C) 2019-2020 Daniel Ring -from ..scraper import _ParserScraper +from ..scraper import ParserScraper -class KeenSpot(_ParserScraper): +class KeenSpot(ParserScraper): multipleImagesPerStrip = True imageSearch = ( '//img[contains(@src, "/comics/")]', diff --git a/dosagelib/plugins/kemonocafe.py b/dosagelib/plugins/kemonocafe.py index 8af2094f9..119303816 100644 --- a/dosagelib/plugins/kemonocafe.py +++ b/dosagelib/plugins/kemonocafe.py @@ -1,10 +1,10 @@ # SPDX-License-Identifier: MIT # Copyright (C) 2019-2022 Tobias Gruetzmacher # Copyright (C) 2019-2020 Daniel Ring -from ..scraper import _ParserScraper +from ..scraper import ParserScraper -class KemonoCafe(_ParserScraper): +class KemonoCafe(ParserScraper): imageSearch = '//div[@id="comic"]//img' prevSearch = '//a[contains(@class, "comic-nav-previous")]' diff --git a/dosagelib/plugins/krisstraub.py b/dosagelib/plugins/krisstraub.py index 90597f040..49efaf36e 100644 --- a/dosagelib/plugins/krisstraub.py +++ b/dosagelib/plugins/krisstraub.py @@ -1,9 +1,9 @@ # SPDX-License-Identifier: MIT # Copyright (C) 2021 Tobias Gruetzmacher -from .common import _WordPressScraper +from .common import WordPressScraper -class KrisStraub(_WordPressScraper): +class KrisStraub(WordPressScraper): prevSearch = '//a[text()="Previous"]' endOfLife = True help = 'Index format: yyyymmdd' diff --git a/dosagelib/plugins/l.py b/dosagelib/plugins/l.py index 75f4558cd..5cca8f8fc 100644 --- a/dosagelib/plugins/l.py +++ b/dosagelib/plugins/l.py @@ -8,7 +8,7 @@ from re import compile from ..scraper import _BasicScraper, _ParserScraper from ..helpers import bounceStarter, indirectStarter from ..util import tagre -from .common import _ComicControlScraper, _WordPressScraper, _WPNaviIn +from .common import ComicControlScraper, WordPressScraper, WordPressNaviIn class Lackadaisy(_ParserScraper): @@ -28,7 +28,7 @@ class Lackadaisy(_ParserScraper): return 'lackadaisy_%s.%s' % (num, ext) -class LastResort(_WordPressScraper): +class LastResort(WordPressScraper): url = 'http://www.lastres0rt.com/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % 'that-sound-you-hear-is-a-shattered-stereotype' @@ -68,11 +68,11 @@ class LeastICouldDo(_ParserScraper): help = 'Index format: yyyymmdd' -class LetsSpeakEnglish(_ComicControlScraper): +class LetsSpeakEnglish(ComicControlScraper): url = 'http://www.marycagle.com' -class LifeAintNoPonyFarm(_WordPressScraper): +class LifeAintNoPonyFarm(WordPressScraper): url = ('https://web.archive.org/web/20181221154155/' 'http://sarahburrini.com/en/') firstStripUrl = url + 'comic/my-first-webcomic/' @@ -137,7 +137,7 @@ class LifeAsRendered(_ParserScraper): return None -class LilithsWord(_ComicControlScraper): +class LilithsWord(ComicControlScraper): url = 'http://www.lilithword.com/' stripUrl = url + 'comic/%s' firstStripUrl = stripUrl % 'prologue-page-00' @@ -188,7 +188,7 @@ class LoadingArtist(_ParserScraper): prevSearch = "//a[contains(concat(' ', @class, ' '), ' prev ')]" -class LoFiJinks(_WPNaviIn): +class LoFiJinks(WordPressNaviIn): baseUrl = 'https://hijinksensue.com/comic/' url = baseUrl + 'learning-to-love-again/' firstStripUrl = baseUrl + 'lo-fijinks-everything-i-know-anout-james-camerons-avatar-movie/' diff --git a/dosagelib/plugins/m.py b/dosagelib/plugins/m.py index cd96a6ce2..baf4d7f6e 100644 --- a/dosagelib/plugins/m.py +++ b/dosagelib/plugins/m.py @@ -10,7 +10,7 @@ from ..helpers import indirectStarter from ..scraper import _BasicScraper, _ParserScraper from ..util import tagre from ..xml import NS -from .common import _ComicControlScraper, _WordPressScraper, _WPWebcomic +from .common import ComicControlScraper, WordPressScraper, WordPressWebcomic class MacHall(_BasicScraper): @@ -29,12 +29,12 @@ class MadamAndEve(_BasicScraper): multipleImagesPerStrip = True -class Magellan(_WordPressScraper): +class Magellan(WordPressScraper): url = 'https://magellanverse.com/' firstStripUrl = url + 'comic/20040307wannabe/' -class MagickChicks(_ComicControlScraper): +class MagickChicks(ComicControlScraper): url = 'https://pixietrixcomix.com/magick-chicks/' stripUrl = url + '%s' firstStripUrl = stripUrl % 'tis-but-a-trifle-2' @@ -52,7 +52,7 @@ class ManlyGuysDoingManlyThings(_ParserScraper): help = 'Index format: ddmmyyyy' -class MareInternum(_WordPressScraper): +class MareInternum(WordPressScraper): url = 'https://www.marecomic.com/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % 'intro-page-1' @@ -98,7 +98,7 @@ class MaxOveracts(_ParserScraper): help = 'Index format: nnn' -class Meek(_WordPressScraper): +class Meek(WordPressScraper): url = 'https://www.meekcomic.com/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % 'chapter-1-cover' @@ -113,27 +113,27 @@ class MegaTokyo(_BasicScraper): help = 'Index format: nnnn' -class Meiosis(_WordPressScraper): +class Meiosis(WordPressScraper): url = 'http://meiosiswebcomic.com/' -class Melonpool(_WordPressScraper): +class Melonpool(WordPressScraper): url = 'http://www.melonpool.com/' allow_errors = (500,) -class MenageA3(_ComicControlScraper): +class MenageA3(ComicControlScraper): adult = True url = 'https://pixietrixcomix.com/menage-a-3/' firstStripUrl = url + 'for-new-readers' endOfLife = True -class Metacarpolis(_ComicControlScraper): +class Metacarpolis(ComicControlScraper): url = 'http://www.metacarpolis.com' -class Misfile(_ComicControlScraper): +class Misfile(ComicControlScraper): url = 'http://www.misfile.com/misfile/' stripUrl = url + '%s' firstStripUrl = stripUrl % '2004-02-22' @@ -149,7 +149,7 @@ class MisfileHellHigh(Misfile): help = 'Index format: yyyy-mm-dd' -class MistyTheMouse(_WordPressScraper): +class MistyTheMouse(WordPressScraper): url = 'http://www.mistythemouse.com/' prevSearch = '//a[@rel="prev"]' firstStripUrl = 'http://www.mistythemouse.com/?p=12' @@ -176,13 +176,13 @@ class MonsieurLeChien(_BasicScraper): help = 'Index format: n' -class MonsterSoup(_WordPressScraper): +class MonsterSoup(WordPressScraper): url = 'https://monstersoupcomic.com/' stripUrl = url + '?comic=%s' firstStripUrl = stripUrl % 'chapter-1-cover' -class Moonlace(_WPWebcomic): +class Moonlace(WordPressWebcomic): url = 'https://moonlace.darkbluecomics.com/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % 'page-0-1' @@ -272,7 +272,7 @@ class MysteriesOfTheArcana(_ParserScraper): prevSearch = '//a[@class="navprevious"]' -class MonsterUnderTheBed(_WordPressScraper): +class MonsterUnderTheBed(WordPressScraper): url = 'http://themonsterunderthebed.net/' stripUrl = url + '?comic=%s' firstStripUrl = stripUrl % 'test-post' diff --git a/dosagelib/plugins/mangadex.py b/dosagelib/plugins/mangadex.py index cc45c3c35..dd5d1cf91 100644 --- a/dosagelib/plugins/mangadex.py +++ b/dosagelib/plugins/mangadex.py @@ -1,16 +1,16 @@ # SPDX-License-Identifier: MIT -# Copyright (C) 2019-2021 Tobias Gruetzmacher +# Copyright (C) 2019-2022 Tobias Gruetzmacher # Copyright (C) 2019-2020 Daniel Ring import json -from ..scraper import _ParserScraper +from ..scraper import ParserScraper -class MangaDex(_ParserScraper): +class MangaDex(ParserScraper): multipleImagesPerStrip = True def __init__(self, name, mangaId): - super(MangaDex, self).__init__('MangaDex/' + name) + super().__init__('MangaDex/' + name) baseUrl = 'https://api.mangadex.org/' self.url = baseUrl + 'manga/%s' % mangaId diff --git a/dosagelib/plugins/n.py b/dosagelib/plugins/n.py index 2c45ddc53..8387bccf2 100644 --- a/dosagelib/plugins/n.py +++ b/dosagelib/plugins/n.py @@ -8,10 +8,10 @@ from re import compile, escape from ..scraper import _BasicScraper, _ParserScraper from ..helpers import indirectStarter, bounceStarter from ..util import tagre -from .common import _ComicControlScraper, _WordPressScraper, _WPNavi, _WPWebcomic +from .common import ComicControlScraper, WordPressScraper, WordPressNavi, WordPressWebcomic -class Namesake(_ComicControlScraper): +class Namesake(ComicControlScraper): url = 'http://namesakecomic.com/' stripUrl = url + 'comic/%s' firstStripUrl = stripUrl % 'the-journey-begins' @@ -32,7 +32,7 @@ class NatalieDee(_BasicScraper): return '%s-%s' % (date, filename) -class Nedroid(_WordPressScraper): +class Nedroid(WordPressScraper): url = 'http://nedroid.com/' prevSearch = '//a[@rel="prev"]' @@ -55,7 +55,7 @@ class NeoEarth(_BasicScraper): help = 'Index format: yyyy-mm-dd' -class NerfNow(_WordPressScraper): +class NerfNow(WordPressScraper): url = 'https://www.nerfnow.com/' prevSearch = '//li[@id="nav_previous"]/a' @@ -75,7 +75,7 @@ class Newshounds(_ParserScraper): return super(Newshounds, self).getPrevUrl(url, data) -class NewWorld(_WordPressScraper): +class NewWorld(WordPressScraper): url = ('https://web.archive.org/web/20190718012133/' 'http://www.tfsnewworld.com/') stripUrl = url + '%s/' @@ -85,7 +85,7 @@ class NewWorld(_WordPressScraper): help = 'Index format: yyyy/mm/dd/stripn' -class NeverSatisfied(_ComicControlScraper): +class NeverSatisfied(ComicControlScraper): url = 'https://www.neversatisfiedcomic.com/' stripUrl = url + 'comic/%s' firstStripUrl = stripUrl % 'never-satisfied' @@ -107,13 +107,13 @@ class NichtLustig(_BasicScraper): return '%s' % (filename) -class Nicky510(_WPNavi): +class Nicky510(WordPressNavi): url = ('https://web.archive.org/web/20160510215718/' 'http://www.nickyitis.com/') endOfLife = True -class Nightshift(_WPWebcomic): +class Nightshift(WordPressWebcomic): url = 'https://poecatcomix.com/nightshift-static/' stripUrl = 'https://poecatcomix.com/nightshift/%s/' firstStripUrl = stripUrl % 'ns-cover' @@ -189,7 +189,7 @@ class NonPlayerCharacter(_ParserScraper): return pageUrl.rstrip('/').rsplit('/', 1)[-1] -class NotAVillain(_WPWebcomic): +class NotAVillain(WordPressWebcomic): url = 'http://navcomic.com/' stripUrl = url + 'not-a-villain/%s/' firstStripUrl = stripUrl % 'v1-001' diff --git a/dosagelib/plugins/namirdeiter.py b/dosagelib/plugins/namirdeiter.py index 2163fa8cc..f40ff203d 100644 --- a/dosagelib/plugins/namirdeiter.py +++ b/dosagelib/plugins/namirdeiter.py @@ -1,10 +1,10 @@ # SPDX-License-Identifier: MIT -# Copyright (C) 2019-2020 Tobias Gruetzmacher +# Copyright (C) 2019-2022 Tobias Gruetzmacher # Copyright (C) 2019-2020 Daniel Ring -from .common import _ParserScraper +from ..scraper import ParserScraper -class NamirDeiter(_ParserScraper): +class NamirDeiter(ParserScraper): imageSearch = '//img[contains(@src, "comics/")]' prevSearch = ('//a[@rel="prev"]', '//a[./img[contains(@src, "previous")]]', @@ -46,7 +46,7 @@ class NamirDeiter(_ParserScraper): ) -class UnlikeMinerva(_ParserScraper): +class UnlikeMinerva(ParserScraper): name = 'NamirDeiter/UnlikeMinerva' baseUrl = 'https://unlikeminerva.com/archive/index.php' stripUrl = baseUrl + '?week=%s' diff --git a/dosagelib/plugins/nitrocosm.py b/dosagelib/plugins/nitrocosm.py index d9c1a6d61..40724aca2 100644 --- a/dosagelib/plugins/nitrocosm.py +++ b/dosagelib/plugins/nitrocosm.py @@ -1,16 +1,16 @@ # SPDX-License-Identifier: MIT # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam -# Copyright (C) 2015-2016 Tobias Gruetzmacher -from ..scraper import _ParserScraper +# Copyright (C) 2015-2022 Tobias Gruetzmacher +from ..scraper import ParserScraper -class Nitrocosm(_ParserScraper): +class Nitrocosm(ParserScraper): imageSearch = '//img[@class="gallery_display"]' prevSearch = '//a[@class="nav_btn_previous"]' def __init__(self, name, path): - super(Nitrocosm, self).__init__(name) + super().__init__(name) self.url = 'http://www.nitrocosm.com/go/' + path @classmethod diff --git a/dosagelib/plugins/nuklearpower.py b/dosagelib/plugins/nuklearpower.py index 887e1e9d5..6485d3e37 100644 --- a/dosagelib/plugins/nuklearpower.py +++ b/dosagelib/plugins/nuklearpower.py @@ -1,38 +1,28 @@ # SPDX-License-Identifier: MIT # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam -# Copyright (C) 2015-2016 Tobias Gruetzmacher -from ..scraper import _ParserScraper +# Copyright (C) 2015-2022 Tobias Gruetzmacher +from ..scraper import ParserScraper +from .common import ComicControlScraper -class _NuklearPower(_ParserScraper): +class NuklearPower(ParserScraper): prevSearch = '//a[@rel="prev"]' imageSearch = '//div[@id="comic"]/img' - def __init__(self, name): - super(_NuklearPower, self).__init__('NuklearPower/' + name[2:]) + def __init__(self, name, path): + super().__init__('NuklearPower/' + name) + self.url = 'http://www.nuklearpower.com/' + path + '/' - @property - def url(self): - return 'http://www.nuklearpower.com/' + self.path + '/' + @classmethod + def getmodules(cls): + return ( + cls('8BitTheater', '8-bit-theater'), + cls('HowIKilledYourMaster', 'hikym'), + cls('TheDreadful', 'dreadful'), + cls('Warbot', 'warbot'), + ) - -class NP8BitTheater(_NuklearPower): - path = '8-bit-theater' - - -class NPAtomicRobo(_NuklearPower): +class NPAtomicRobo(ComicControlScraper): + name = 'NuklearPower/AtomicRobo' url = 'http://www.atomic-robo.com/' - imageSearch = '//img[@id="cc-comic"]' - - -class NPHowIKilledYourMaster(_NuklearPower): - path = 'hikym' - - -class NPTheDreadful(_NuklearPower): - path = 'dreadful' - - -class NPWarbot(_NuklearPower): - path = 'warbot' diff --git a/dosagelib/plugins/num.py b/dosagelib/plugins/num.py index edea61443..0dc483da5 100644 --- a/dosagelib/plugins/num.py +++ b/dosagelib/plugins/num.py @@ -3,9 +3,9 @@ # Copyright (C) 2012-2014 Bastian Kleineidam # Copyright (C) 2015-2020 Tobias Gruetzmacher # Copyright (C) 2019-2020 Daniel Ring -from .common import _WordPressScraper +from .common import WordPressScraper -class NineteenSeventySeven(_WordPressScraper): +class NineteenSeventySeven(WordPressScraper): name = '1977' url = 'http://1977thecomic.com/' diff --git a/dosagelib/plugins/o.py b/dosagelib/plugins/o.py index 2c5903d7e..284623353 100644 --- a/dosagelib/plugins/o.py +++ b/dosagelib/plugins/o.py @@ -8,7 +8,7 @@ from re import compile, escape from ..helpers import bounceStarter, indirectStarter from ..scraper import _BasicScraper, _ParserScraper from ..util import tagre -from .common import _WordPressScraper, _WPNavi +from .common import WordPressScraper, WordPressNavi class OctopusPie(_ParserScraper): @@ -71,7 +71,7 @@ class Oglaf(_ParserScraper): return urls -class OhJoySexToy(_WPNavi): +class OhJoySexToy(WordPressNavi): url = 'http://www.ohjoysextoy.com/' firstStripUrl = url + 'introduction/' textSearch = '//div[@id="comic"]//img/@alt' @@ -99,25 +99,25 @@ class OmakeTheater(_ParserScraper): help = 'Index format: number (unpadded)' -class OnTheEdge(_WordPressScraper): +class OnTheEdge(WordPressScraper): url = 'http://ontheedgecomics.com/' firstStripUrl = 'http://ontheedgecomics.com/comic/ote0001/' -class OopsComicAdventure(_WordPressScraper): +class OopsComicAdventure(WordPressScraper): url = ('https://web.archive.org/web/20190102215141/' 'http://oopscomicadventure.com/') endOfLife = True -class Optipess(_WPNavi): +class Optipess(WordPressNavi): url = 'http://www.optipess.com/' firstStripUrl = url + '2008/12/01/jason-friend-of-the-butterflies/' textSearch = '//div[@id="comic"]//img/@alt' textOptional = True -class OrderOfTheBlackDog(_WordPressScraper): +class OrderOfTheBlackDog(WordPressScraper): url = 'http://orderoftheblackdog.com/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % 'issue-1-cover' @@ -147,7 +147,7 @@ class OurHomePlanet(_ParserScraper): help = 'Index format: n (unpadded)' -class OutOfPlacers(_WordPressScraper): +class OutOfPlacers(WordPressScraper): url = 'http://www.valsalia.com/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % 'prologue/01' @@ -164,7 +164,7 @@ class OverCompensating(_BasicScraper): help = 'Index format: number' -class OzyAndMillie(_WordPressScraper): +class OzyAndMillie(WordPressScraper): stripUrl = 'https://ozyandmillie.org/comic/%s/' url = stripUrl % 'ozy-and-millie-2131' firstStripUrl = stripUrl % 'ozy-and-millie-2' diff --git a/dosagelib/plugins/p.py b/dosagelib/plugins/p.py index 9a9733915..42212a9cd 100644 --- a/dosagelib/plugins/p.py +++ b/dosagelib/plugins/p.py @@ -8,7 +8,7 @@ from re import compile, escape from ..scraper import _BasicScraper, _ParserScraper from ..helpers import bounceStarter, queryNamer, indirectStarter from ..util import tagre -from .common import _ComicControlScraper, _WordPressScraper, _WPNavi +from .common import ComicControlScraper, WordPressScraper, WordPressNavi class PandyLand(_ParserScraper): @@ -47,12 +47,12 @@ class ParallelUniversum(_BasicScraper): lang = 'de' -class ParaNatural(_ComicControlScraper): +class ParaNatural(ComicControlScraper): url = 'https://www.paranatural.net/' firstStripUrl = url + 'comic/chapter-1' -class PartiallyClips(_WordPressScraper): +class PartiallyClips(WordPressScraper): url = ('https://web.archive.org/web/20180509161332/' 'http://partiallyclips.com/') firstStripUrl = url + 'comic/screaming-woman/' @@ -117,7 +117,7 @@ class PennyArcade(_ParserScraper): help = 'Index format: yyyy/mm/dd' -class PeppermintSaga(_WPNavi): +class PeppermintSaga(WordPressNavi): url = 'http://www.pepsaga.com/' stripUrl = url + '?p=%s' firstStripUrl = stripUrl % '3' @@ -125,7 +125,7 @@ class PeppermintSaga(_WPNavi): adult = True -class PeppermintSagaBGR(_WPNavi): +class PeppermintSagaBGR(WordPressNavi): url = 'http://bgr.pepsaga.com/' stripUrl = url + '?p=%s' firstStripUrl = stripUrl % '4' @@ -176,11 +176,11 @@ class PHDComics(_ParserScraper): ) -class Picklewhistle(_ComicControlScraper): +class Picklewhistle(ComicControlScraper): url = 'http://www.picklewhistle.com/' -class PicPakDog(_WordPressScraper): +class PicPakDog(WordPressScraper): url = 'http://www.picpak.net/' firstStripUrl = url + 'comic/dogs-cant-spell/' @@ -243,7 +243,7 @@ class PoorlyDrawnLines(_ParserScraper): prevSearch = '//a[@rel="prev"]' -class PoppyOPossum(_WordPressScraper): +class PoppyOPossum(WordPressScraper): baseUrl = 'https://www.poppy-opossum.com/' url = baseUrl + '?latest' stripUrl = baseUrl + 'comic/%s' @@ -274,7 +274,7 @@ class Precocious(_ParserScraper): help = 'Index format: yyyy/mm/dd' -class PrinceOfSartar(_WPNavi): +class PrinceOfSartar(WordPressNavi): url = 'http://www.princeofsartar.com/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % 'introduction-chapter-1' @@ -289,7 +289,7 @@ class PrinceOfSartar(_WPNavi): return '%s.%s' % (title, image_ext) -class ProphecyOfTheCircle(_WPNavi): +class ProphecyOfTheCircle(WordPressNavi): url = 'https://www.prophecyofthecircle.com/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % 'prologue' diff --git a/dosagelib/plugins/petitesymphony.py b/dosagelib/plugins/petitesymphony.py index a068cc084..d5a0052f3 100644 --- a/dosagelib/plugins/petitesymphony.py +++ b/dosagelib/plugins/petitesymphony.py @@ -3,10 +3,10 @@ # Copyright (C) 2012-2014 Bastian Kleineidam # Copyright (C) 2015-2020 Tobias Gruetzmacher # Copyright (C) 2019-2020 Daniel Ring -from .common import _WordPressScraper, _WPNavi +from .common import WordPressScraper, WordPressNavi -class PetiteSymphony(_WPNavi): +class PetiteSymphony(WordPressNavi): multipleImagesPerStrip = True help = 'Index format: named number' @@ -24,7 +24,7 @@ class PetiteSymphony(_WPNavi): ) -class ComicsBreak(_WordPressScraper): +class ComicsBreak(WordPressScraper): def __init__(self, name, archive=None, adult=False): super(ComicsBreak, self).__init__('ComicsBreak/' + name) self.url = 'http://%s.comicsbreak.com/' % name.lower() diff --git a/dosagelib/plugins/projectfuture.py b/dosagelib/plugins/projectfuture.py index 1ebad3055..ac7c6ed33 100644 --- a/dosagelib/plugins/projectfuture.py +++ b/dosagelib/plugins/projectfuture.py @@ -1,10 +1,10 @@ # SPDX-License-Identifier: MIT -# Copyright (C) 2019-2020 Tobias Gruetzmacher +# Copyright (C) 2019-2022 Tobias Gruetzmacher # Copyright (C) 2019-2020 Daniel Ring -from .common import _ParserScraper +from ..scraper import ParserScraper -class ProjectFuture(_ParserScraper): +class ProjectFuture(ParserScraper): imageSearch = '//td[@class="tamid"]/img' prevSearch = '//a[./img[@alt="Previous"]]' diff --git a/dosagelib/plugins/q.py b/dosagelib/plugins/q.py index 999bb6f79..26f620830 100644 --- a/dosagelib/plugins/q.py +++ b/dosagelib/plugins/q.py @@ -1,12 +1,12 @@ # SPDX-License-Identifier: MIT # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam -# Copyright (C) 2015-2020 Tobias Gruetzmacher +# Copyright (C) 2015-2022 Tobias Gruetzmacher # Copyright (C) 2019-2020 Daniel Ring -from ..scraper import _ParserScraper +from ..scraper import ParserScraper -class QuantumVibe(_ParserScraper): +class QuantumVibe(ParserScraper): url = 'https://www.quantumvibe.com/' stripUrl = url + 'strip?page=%s' firstStripUrl = stripUrl % '1' @@ -14,7 +14,7 @@ class QuantumVibe(_ParserScraper): prevSearch = '//a[./img[@alt="Previous Strip"]]' -class QuestionableContent(_ParserScraper): +class QuestionableContent(ParserScraper): url = 'http://www.questionablecontent.net/' stripUrl = url + 'view.php?comic=%s' firstStripUrl = stripUrl % '1' @@ -23,7 +23,7 @@ class QuestionableContent(_ParserScraper): help = 'Index format: n (unpadded)' -class Qwantz(_ParserScraper): +class Qwantz(ParserScraper): url = 'http://www.qwantz.com/index.php' stripUrl = url + '?comic=%s' firstStripUrl = stripUrl % '1' diff --git a/dosagelib/plugins/r.py b/dosagelib/plugins/r.py index 69947e968..035fef337 100644 --- a/dosagelib/plugins/r.py +++ b/dosagelib/plugins/r.py @@ -9,14 +9,14 @@ from urllib.parse import urljoin from ..helpers import bounceStarter from ..scraper import _BasicScraper, _ParserScraper from ..util import tagre -from .common import _WordPressScraper, _WPNavi, _WPWebcomic +from .common import WordPressScraper, WordPressNavi, WordPressWebcomic -class RalfTheDestroyer(_WordPressScraper): +class RalfTheDestroyer(WordPressScraper): url = 'http://ralfthedestroyer.com/' -class RayFox(_WPNavi): +class RayFox(WordPressNavi): url = 'https://www.rayfoxthecomic.com/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % 'not-a-super-hero/it-begins' @@ -39,12 +39,12 @@ class RayFox(_WPNavi): return filename + '.' + ext -class RaynaOnTheRiver(_WordPressScraper): +class RaynaOnTheRiver(WordPressScraper): url = 'http://www.catomix.com/rayna/' firstStripUrl = url + 'archives/comic/teaser-poster' -class RealLife(_WordPressScraper): +class RealLife(WordPressScraper): url = 'https://reallifecomics.com/' stripUrl = url + 'comic.php?comic=%s' firstStripUrl = stripUrl % 'title-1' @@ -106,7 +106,7 @@ class RedMeat(_ParserScraper): return '_'.join(parts[1:3]) -class Requiem(_WordPressScraper): +class Requiem(WordPressScraper): baseUrl = 'http://requiem.spiderforest.com/' url = baseUrl + '?latest' stripUrl = baseUrl + 'comic/%s' @@ -146,7 +146,7 @@ class Replay(_ParserScraper): return name -class RiversideExtras(_WPWebcomic): +class RiversideExtras(WordPressWebcomic): url = 'https://riversidecomics.com/' diff --git a/dosagelib/plugins/rhjunior.py b/dosagelib/plugins/rhjunior.py index bda2d841b..65d351a3e 100644 --- a/dosagelib/plugins/rhjunior.py +++ b/dosagelib/plugins/rhjunior.py @@ -1,10 +1,10 @@ # SPDX-License-Identifier: MIT -# Copyright (C) 2019-2020 Tobias Gruetzmacher +# Copyright (C) 2019-2022 Tobias Gruetzmacher # Copyright (C) 2019-2020 Daniel Ring -from ..scraper import _ParserScraper +from ..scraper import ParserScraper -class RHJunior(_ParserScraper): +class RHJunior(ParserScraper): stripUrl = 'https://www.rhjunior.com/%s/' imageSearch = '//div[contains(@class, "entry-content")]//img' multipleImagesPerStrip = True diff --git a/dosagelib/plugins/rickgriffinstudios.py b/dosagelib/plugins/rickgriffinstudios.py index c7a73f7d0..f9c732e40 100644 --- a/dosagelib/plugins/rickgriffinstudios.py +++ b/dosagelib/plugins/rickgriffinstudios.py @@ -2,16 +2,16 @@ # Copyright (C) 2019-2020 Tobias Gruetzmacher # Copyright (C) 2019-2022 Daniel Ring from ..helpers import indirectStarter -from .common import _WordPressScraper, _WPNaviIn +from .common import WordPressScraper, WordPressNaviIn -class Housepets(_WordPressScraper): +class Housepets(WordPressScraper): url = 'http://www.housepetscomic.com/' stripUrl = url + 'comic/%s/' firstStripUrl = '2008/06/02/when-boredom-strikes' -class RickGriffinStudios(_WPNaviIn): +class RickGriffinStudios(WordPressNaviIn): baseUrl = 'http://rickgriffinstudios.com/' stripUrl = baseUrl + 'comic-post/%s/' latestSearch = '//a[contains(@title, "Permanent Link")]' diff --git a/dosagelib/plugins/s.py b/dosagelib/plugins/s.py index 7e5e9f70d..6f1b544d0 100644 --- a/dosagelib/plugins/s.py +++ b/dosagelib/plugins/s.py @@ -9,7 +9,7 @@ from os.path import splitext from ..scraper import _BasicScraper, _ParserScraper from ..helpers import indirectStarter, bounceStarter, joinPathPartsNamer from ..util import tagre -from .common import _ComicControlScraper, _WordPressScraper, _WPNavi, _WPWebcomic +from .common import ComicControlScraper, WordPressScraper, WordPressNavi, WordPressWebcomic class SabrinaOnline(_BasicScraper): @@ -33,17 +33,17 @@ class SabrinaOnline(_BasicScraper): return archivepages[-1] -class SafelyEndangered(_WPNavi): +class SafelyEndangered(WordPressNavi): url = 'http://www.safelyendangered.com/' firstStripUrl = url + 'comic/ignored/' -class SaffronAndSage(_WordPressScraper): +class SaffronAndSage(WordPressScraper): url = 'https://www.saffroncomic.com/' firstStripUrl = url + 'comic/p0001/' -class SailorsunOrg(_WordPressScraper): +class SailorsunOrg(WordPressScraper): url = 'http://sailorsun.org/' @@ -56,7 +56,7 @@ class SamAndFuzzy(_ParserScraper): help = 'Index format: n (unpadded)' -class SandraOnTheRocks(_ComicControlScraper): +class SandraOnTheRocks(ComicControlScraper): url = 'https://pixietrixcomix.com/sandra-on-the-rocks/' stripUrl = url + '%s' firstStripUrl = stripUrl % 'start-by-running' @@ -64,7 +64,7 @@ class SandraOnTheRocks(_ComicControlScraper): help = 'Index format: name' -class Savestate(_WPNavi): +class Savestate(WordPressNavi): url = 'http://www.savestatecomic.com/' stripUrl = url + '%s' firstStripUrl = stripUrl % '2014/02/pokemon-bank' @@ -189,7 +189,7 @@ class ShadesOfGray(_ParserScraper): return pageUrl.rstrip('/').rsplit('/', 1)[-1] -class Sharksplode(_WordPressScraper): +class Sharksplode(WordPressScraper): url = 'http://sharksplode.com/' textSearch = '//div[@id="comic"]//img/@alt' allow_errors = (403,) @@ -206,13 +206,13 @@ class Sheldon(_BasicScraper): help = 'Index format: yymmdd' -class Shifters(_WPNavi): +class Shifters(WordPressNavi): url = 'http://shiftersonline.com/' stripUrl = url + '%s/' firstStripUrl = stripUrl % 'shifters-redux-promo' -class ShipInABottle(_WordPressScraper): +class ShipInABottle(WordPressScraper): url = 'http://shipinbottle.pepsaga.com/' stripUrl = url + '?p=%s' firstStripUrl = stripUrl % '281' @@ -229,7 +229,7 @@ class Shortpacked(_ParserScraper): help = 'Index format: nnn' -class ShotgunShuffle(_WordPressScraper): +class ShotgunShuffle(WordPressScraper): url = 'http://shotgunshuffle.com/' firstStripUrl = url + 'comic/pilot/' @@ -244,30 +244,30 @@ class SinFest(_ParserScraper): help = 'Index format: yyyy-mm-dd' -class SisterClaire(_ComicControlScraper): +class SisterClaire(ComicControlScraper): url = 'https://www.sisterclaire.com/comic/' firstStripUrl = url + 'book-one' -class SixGunMage(_ComicControlScraper): +class SixGunMage(ComicControlScraper): url = 'http://www.6gunmage.com/comic/' stripUrl = url + '%s' firstStripUrl = stripUrl % '6-gun-mage-kickoff' -class SixPackOfOtters(_WPWebcomic): +class SixPackOfOtters(WordPressWebcomic): url = 'http://sixpackofotters.com/' stripUrl = url + 'pages/%s/' firstStripUrl = stripUrl % 'chapter-01-tandem' -class SkinDeep(_WPWebcomic): +class SkinDeep(WordPressWebcomic): url = 'http://www.skindeepcomic.com/' stripUrl = url + 'archive/%s/' firstStripUrl = stripUrl % 'issue-1-cover' -class SleeplessDomain(_ComicControlScraper): +class SleeplessDomain(ComicControlScraper): url = 'http://www.sleeplessdomain.com/' stripUrl = url + 'comic/%s' firstStripUrl = stripUrl % 'chapter-1-cover' @@ -277,7 +277,7 @@ class SleeplessDomain(_ComicControlScraper): return pageUrl.rsplit('/', 1)[-1] + '.' + imageUrl.rsplit('.', 1)[-1] -class SlightlyDamned(_ComicControlScraper): +class SlightlyDamned(ComicControlScraper): url = 'http://www.sdamned.com/' firstStripUrl = url + 'comic/prologue' @@ -307,7 +307,7 @@ class SluggyFreelance(_ParserScraper): return imageurl.rsplit('/', 1)[-1].split('.pagespeed', 1)[0] -class SMBC(_ComicControlScraper): +class SMBC(ComicControlScraper): url = 'https://www.smbc-comics.com/' stripUrl = url + 'comic/%s' firstStripUrl = stripUrl % '2002-09-05' @@ -325,7 +325,7 @@ class SMBC(_ComicControlScraper): return filename -class SnowFlame(_WordPressScraper): +class SnowFlame(WordPressScraper): url = ('https://web.archive.org/web/20160905071051/' 'http://www.snowflamecomic.com/') stripUrl = url + '?comic=snowflame-%s-%s' @@ -346,7 +346,7 @@ class SnowFlame(_WordPressScraper): return "%s-%s-%s" % (chapter, page, filename) -class SodiumEyes(_WordPressScraper): +class SodiumEyes(WordPressScraper): url = 'https://web.archive.org/web/20200220041406/http://sodiumeyes.com/' starter = indirectStarter endOfLife = True @@ -362,7 +362,7 @@ class SomethingPositive(_ParserScraper): help = 'Index format: mmddyyyy' -class Sorcery101(_WPWebcomic): +class Sorcery101(WordPressWebcomic): baseUrl = 'https://kelmcdonald.com/sorcery-101/' stripUrl = baseUrl + '%s/' url = stripUrl % 'sorcery101-ch-01' @@ -426,11 +426,11 @@ class SpareParts(_BasicScraper): help = 'Index format: yyyymmdd' -class Spinnerette(_ComicControlScraper): +class Spinnerette(ComicControlScraper): url = 'http://www.spinnyverse.com' -class SPQRBlues(_WordPressScraper): +class SPQRBlues(WordPressScraper): url = 'http://spqrblues.com/IV/' @@ -517,7 +517,7 @@ class StarCrossdDestiny(_ParserScraper): return directory + '-' + filename -class StarfireAgency(_WPWebcomic): +class StarfireAgency(WordPressWebcomic): url = 'https://poecatcomix.com/starfire-agency-static/' stripUrl = 'https://poecatcomix.com/starfire-agency/%s/' firstStripUrl = stripUrl % '2005-09-201' @@ -543,7 +543,7 @@ class StarfireAgency(_WPWebcomic): return filename -class StarTrip(_ComicControlScraper): +class StarTrip(ComicControlScraper): url = 'https://www.startripcomic.com/' @@ -566,11 +566,11 @@ class StickyDillyBuns(_BasicScraper): help = 'Index format: name' -class StreetFighter(_ComicControlScraper): +class StreetFighter(ComicControlScraper): url = 'http://www.streetfightercomics.com' -class StringTheory(_WPNavi): +class StringTheory(WordPressNavi): url = 'http://www.stringtheorycomic.com/' firstStripUrl = url + 'comics/chapterone/chapterone/' @@ -617,7 +617,7 @@ class SuburbanJungle(_ParserScraper): prevSearch = '//div[@class="nav-previous"]/a' -class SuburbanJungleRoughHousing(_WordPressScraper): +class SuburbanJungleRoughHousing(WordPressScraper): url = 'http://roughhouse.suburbanjungle.com/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % 'rough-housing-issue-1-cover' @@ -632,7 +632,7 @@ class Supercell(_ParserScraper): prevSearch = '//div[@class="comicnav"]/a[./img[contains(@src, "comnav_02")]]' -class SupernormalStep(_ComicControlScraper): +class SupernormalStep(ComicControlScraper): url = 'http://supernormalstep.com/' diff --git a/dosagelib/plugins/sandraandwoo.py b/dosagelib/plugins/sandraandwoo.py index aeb769a3e..1b3b5ad09 100644 --- a/dosagelib/plugins/sandraandwoo.py +++ b/dosagelib/plugins/sandraandwoo.py @@ -2,10 +2,10 @@ # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam # Copyright (C) 2015-2020 Tobias Gruetzmacher -from .common import _WordPressScraper +from .common import WordPressScraper -class SandraAndWoo(_WordPressScraper): +class SandraAndWoo(WordPressScraper): prevSearch = '//a[@rel="prev"]' def __init__(self, name, urlName, firstUrl, lang='en'): diff --git a/dosagelib/plugins/shivaestudios.py b/dosagelib/plugins/shivaestudios.py index 4d28ca44d..cc984531b 100644 --- a/dosagelib/plugins/shivaestudios.py +++ b/dosagelib/plugins/shivaestudios.py @@ -1,22 +1,22 @@ # SPDX-License-Identifier: MIT # Copyright (C) 2019-2021 Tobias Gruetzmacher # Copyright (C) 2019-2021 Daniel Ring -from .common import _WordPressSpliced +from .common import WordPressSpliced -class _WithSid(_WordPressSpliced): +class _WithSid(WordPressSpliced): def __init__(self, name, sid, eol=False): super().__init__(name) self.stripUrl = self.baseUrl + 'comic/%s/?sid={}'.format(sid) -class AbbysAgency(_WordPressSpliced): +class AbbysAgency(WordPressSpliced): url = 'https://abbysagency.us/' stripUrl = url + 'blog/comic/%s/' firstStripUrl = stripUrl % 'a' -class AlienDice(_WordPressSpliced): +class AlienDice(WordPressSpliced): url = 'https://aliendice.com/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % '05162001' @@ -32,7 +32,7 @@ class AlienDice(_WordPressSpliced): return imageUrl.rsplit('/', 1)[-1].replace('20010831', '2001-08-31') -class AlienDiceLegacy(_WordPressSpliced): +class AlienDiceLegacy(WordPressSpliced): name = 'AlienDice/Legacy' baseUrl = 'https://aliendice.com/' url = baseUrl + 'series/legacy/' @@ -45,7 +45,7 @@ class AlienDiceLegacy(_WordPressSpliced): return super(AlienDiceLegacy, self).isfirststrip(url.rsplit('?', 1)[0]) -class BlackRose(_WordPressSpliced): +class BlackRose(WordPressSpliced): url = 'https://www.blackrose.monster/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % '2004-11-01' @@ -80,7 +80,7 @@ class TheCyantianChronicles(_WithSid): ) -class Shivae(_WordPressSpliced): +class Shivae(WordPressSpliced): url = 'https://shivae.com/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % '09202001' diff --git a/dosagelib/plugins/snafu.py b/dosagelib/plugins/snafu.py index 934d4156c..0d9d66746 100644 --- a/dosagelib/plugins/snafu.py +++ b/dosagelib/plugins/snafu.py @@ -1,12 +1,12 @@ # SPDX-License-Identifier: MIT # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam -# Copyright (C) 2015-2021 Tobias Gruetzmacher -from ..scraper import _ParserScraper +# Copyright (C) 2015-2022 Tobias Gruetzmacher +from ..scraper import ParserScraper from ..helpers import indirectStarter -class Snafu(_ParserScraper): +class Snafu(ParserScraper): # Next and Previous are swapped... prevSearch = '//a[@class="next"]' imageSearch = '//div[@class="comicpage"]/img' @@ -14,7 +14,7 @@ class Snafu(_ParserScraper): starter = indirectStarter def __init__(self, name, path): - super(Snafu, self).__init__('SnafuComics/' + name) + super().__init__('SnafuComics/' + name) self.url = 'http://snafu-comics.com/swmseries/' + path def namer(self, image_url, page_url): diff --git a/dosagelib/plugins/studiokhimera.py b/dosagelib/plugins/studiokhimera.py index 66dd0447c..8a129157f 100644 --- a/dosagelib/plugins/studiokhimera.py +++ b/dosagelib/plugins/studiokhimera.py @@ -1,16 +1,16 @@ # SPDX-License-Identifier: MIT -# Copyright (C) 2019-2020 Tobias Gruetzmacher +# Copyright (C) 2019-2022 Tobias Gruetzmacher # Copyright (C) 2019-2020 Daniel Ring -from ..scraper import _ParserScraper -from .common import _WordPressScraper +from ..scraper import ParserScraper +from .common import WordPressScraper -class StudioKhimera(_ParserScraper): +class StudioKhimera(ParserScraper): imageSearch = '//figure[@class="gallery-item"]//img/@data-src' prevSearch = '//a[@rel="prev"]' def __init__(self, name, sub, last=None, adult=False, fixNames=False): - super(StudioKhimera, self).__init__('StudioKhimera/' + name) + super().__init__('StudioKhimera/' + name) self.baseUrl = 'https://%s.studiokhimera.com/' % sub self.stripUrl = self.baseUrl + '%s/' @@ -47,7 +47,7 @@ class StudioKhimera(_ParserScraper): ) -class UberQuest(_WordPressScraper): +class UberQuest(WordPressScraper): name = 'StudioKhimera/UberQuest' stripUrl = 'https://uberquest.studiokhimera.com/comic/page/%s/' url = stripUrl % 'latest' diff --git a/dosagelib/plugins/t.py b/dosagelib/plugins/t.py index 6eb97c3b4..b20933e72 100644 --- a/dosagelib/plugins/t.py +++ b/dosagelib/plugins/t.py @@ -12,7 +12,7 @@ except ImportError: from ..scraper import _BasicScraper, _ParserScraper from ..helpers import indirectStarter from ..util import tagre -from .common import _ComicControlScraper, _WordPressScraper, _WPNavi, _WPWebcomic +from .common import ComicControlScraper, WordPressScraper, WordPressNavi, WordPressWebcomic class TailsAndTactics(_ParserScraper): @@ -23,13 +23,13 @@ class TailsAndTactics(_ParserScraper): prevSearch = '//a[text()=" Back"]' -class TekMage(_WPNavi): +class TekMage(WordPressNavi): url = 'https://tekmagecomic.com/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % 'chapter-1-page-1' -class Tamberlane(_WPWebcomic): +class Tamberlane(WordPressWebcomic): baseUrl = 'https://www.tamberlanecomic.com/' url = baseUrl + 'latest/' stripUrl = baseUrl + 'tamberlane/%s/' @@ -38,7 +38,7 @@ class Tamberlane(_WPWebcomic): prevSearch = '//a[@class="previous-link"]' -class TheBoyWhoFell(_ComicControlScraper): +class TheBoyWhoFell(ComicControlScraper): url = 'https://www.boywhofell.com/' firstStripUrl = url + 'comic/ch00p00' @@ -54,7 +54,7 @@ class TheBrads(_ParserScraper): endOfLife = True -class TheChroniclesOfHuxcyn(_WordPressScraper): +class TheChroniclesOfHuxcyn(WordPressScraper): url = 'https://huxcyn.com/' stripUrl = url + 'comic/%s' firstStripUrl = stripUrl % 'opening-001' @@ -85,7 +85,7 @@ class TheClassMenagerie(_ParserScraper): endOfLife = True -class TheDepths(_WPWebcomic): +class TheDepths(WordPressWebcomic): url = 'https://www.thedepthscomic.com/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % 'page-01' @@ -101,18 +101,18 @@ class TheDepths(_WPWebcomic): return filename -class TheDevilsPanties(_WPNavi): +class TheDevilsPanties(WordPressNavi): url = 'https://thedevilspanties.com/' stripUrl = url + 'archives/%s' firstStripUrl = stripUrl % '300' help = 'Index format: number' -class TheDreamlandChronicles(_WordPressScraper): +class TheDreamlandChronicles(WordPressScraper): url = 'http://www.thedreamlandchronicles.com/' -class TheForgottenOrder(_ComicControlScraper): +class TheForgottenOrder(ComicControlScraper): url = 'http://www.forgottenordercomic.com/' firstStripUrl = url + 'comic/prolouge-01-book-1' @@ -126,11 +126,11 @@ class TheGamerCat(_ParserScraper): help = 'Index format: stripname' -class TheGentlemansArmchair(_WordPressScraper): +class TheGentlemansArmchair(WordPressScraper): url = 'http://thegentlemansarmchair.com/' -class TheGentleWolf(_WordPressScraper): +class TheGentleWolf(WordPressScraper): url = 'https://thegentlewolf.net/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % 'tgw-001' @@ -143,12 +143,12 @@ class TheGentleWolf(_WordPressScraper): return filename -class TheGlassScientists(_ComicControlScraper): +class TheGlassScientists(ComicControlScraper): url = 'https://www.theglassscientists.com/' firstStripUrl = url + 'comic/chapter-i' -class TheJunkHyenasDiner(_WordPressScraper): +class TheJunkHyenasDiner(WordPressScraper): url = 'http://junkhyenasdiner.com/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % 'intro' @@ -164,7 +164,7 @@ class TheLandscaper(_ParserScraper): endOfLife = True -class TheMelvinChronicles(_WordPressScraper): +class TheMelvinChronicles(WordPressScraper): url = 'http://melvin.jeaniebottle.com/' @@ -179,7 +179,7 @@ class TheNightBelongsToUs(_ParserScraper): adult = True -class TheNoob(_WordPressScraper): +class TheNoob(WordPressScraper): url = 'http://thenoobcomic.com/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % '1' @@ -247,7 +247,7 @@ class TheWhiteboard(_ParserScraper): return self.url + tourl -class TheWotch(_WordPressScraper): +class TheWotch(WordPressScraper): url = 'http://www.thewotch.com/' firstStripUrl = url + '?comic=enter-the-wotch' @@ -263,7 +263,7 @@ class ThisIsIndexed(_BasicScraper): help = 'Index format: number' -class ThreePanelSoul(_ComicControlScraper): +class ThreePanelSoul(ComicControlScraper): url = 'http://threepanelsoul.com/' firstStripUrl = url + 'comic/a-test-comic' @@ -283,7 +283,7 @@ class TinyDickAdventures(_ParserScraper): return page + '.' + ext -class ToonHole(_WordPressScraper): +class ToonHole(WordPressScraper): url = 'http://toonhole.com/' firstStripUrl = url + 'comic/toon-hole-coming-soon-2010/' @@ -300,7 +300,7 @@ class TrippingOverYou(_BasicScraper): help = 'Index format: stripname' -class TumbleDryComics(_WordPressScraper): +class TumbleDryComics(WordPressScraper): url = 'https://www.tumbledrycomics.com/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % 'we-need-to-get-high-jpg' @@ -348,7 +348,7 @@ class Turnoff(_ParserScraper): return "%03d-%s" % (index, file_name) -class TwinDragons(_WordPressScraper): +class TwinDragons(WordPressScraper): url = 'http://www.twindragonscomic.com/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % 'the-beginning' diff --git a/dosagelib/plugins/tapas.py b/dosagelib/plugins/tapas.py index 9754ac5e1..81765c66e 100644 --- a/dosagelib/plugins/tapas.py +++ b/dosagelib/plugins/tapas.py @@ -2,11 +2,11 @@ # Copyright (C) 2019-2022 Tobias Gruetzmacher # Copyright (C) 2019-2022 Daniel Ring from ..output import out -from ..scraper import _ParserScraper +from ..scraper import ParserScraper from ..xml import NS -class Tapas(_ParserScraper): +class Tapas(ParserScraper): baseUrl = 'https://tapas.io/' imageSearch = '//article[contains(@class, "js-episode-article")]//img/@data-src' prevSearch = '//a[contains(@class, "js-prev-ep-btn")]' diff --git a/dosagelib/plugins/u.py b/dosagelib/plugins/u.py index 983d565f5..01ec06e23 100644 --- a/dosagelib/plugins/u.py +++ b/dosagelib/plugins/u.py @@ -7,20 +7,20 @@ from re import compile from urllib.parse import urljoin from lxml import etree -from ..scraper import _BasicScraper, _ParserScraper +from ..scraper import BasicScraper, ParserScraper from ..helpers import indirectStarter from ..util import tagre -from .common import _ComicControlScraper, _WordPressScraper, _WPNavi +from .common import ComicControlScraper, WordPressScraper, WordPressNavi -class Underling(_WPNavi): +class Underling(WordPressNavi): url = ('https://web.archive.org/web/20190806120425/' 'http://underlingcomic.com/') firstStripUrl = url + 'page-one/' endOfLife = True -class Undertow(_BasicScraper): +class Undertow(BasicScraper): url = 'http://undertow.dreamshards.org/' imageSearch = compile(tagre("img", "src", r'([^"]+\.jpg)')) prevSearch = compile(r'href="(.+?)".+?teynpoint') @@ -28,7 +28,7 @@ class Undertow(_BasicScraper): starter = indirectStarter -class unDivine(_ComicControlScraper): +class unDivine(ComicControlScraper): url = 'https://www.undivinecomic.com/' stripUrl = url + 'comic/%s' firstStripUrl = stripUrl % 'page-1' @@ -46,7 +46,7 @@ class unDivine(_ComicControlScraper): return filename -class UnicornJelly(_BasicScraper): +class UnicornJelly(BasicScraper): baseUrl = 'http://unicornjelly.com/' url = baseUrl + 'uni666.html' stripUrl = baseUrl + 'uni%s.html' @@ -56,7 +56,7 @@ class UnicornJelly(_BasicScraper): help = 'Index format: nnn' -class Unsounded(_ParserScraper): +class Unsounded(ParserScraper): url = 'http://www.casualvillain.com/Unsounded/' startUrl = url + 'comic+index/' stripUrl = url + 'comic/ch%s/ch%s_%s.html' @@ -95,7 +95,7 @@ class Unsounded(_ParserScraper): return self.stripUrl % (chapter, chapter, num) -class UrgentTransformationCrisis(_WordPressScraper): +class UrgentTransformationCrisis(WordPressScraper): url = 'http://www.catomix.com/utc/' firstStripUrl = url + 'comic/cover1' diff --git a/dosagelib/plugins/w.py b/dosagelib/plugins/w.py index ab1f0f901..e86128365 100644 --- a/dosagelib/plugins/w.py +++ b/dosagelib/plugins/w.py @@ -8,10 +8,10 @@ from re import compile, escape, IGNORECASE from ..scraper import _BasicScraper, _ParserScraper from ..util import tagre from ..helpers import bounceStarter -from .common import _ComicControlScraper, _WPNaviIn, _WPWebcomic +from .common import ComicControlScraper, WordPressNaviIn, WordPressWebcomic -class WapsiSquare(_WPNaviIn): +class WapsiSquare(WordPressNaviIn): url = 'http://wapsisquare.com/' firstStripUrl = url + 'comic/09092001/' @@ -81,14 +81,14 @@ class WereIWolf(_ParserScraper): return self.stripUrl % (index[0], index[1]) -class WhiteNoise(_WPWebcomic): +class WhiteNoise(WordPressWebcomic): url = 'http://whitenoisecomic.com/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % 'book-one' imageSearch = '//div[@id="comic"]//img' -class WhiteNoiseLee(_ComicControlScraper): +class WhiteNoiseLee(ComicControlScraper): url = 'http://www.white-noise-comic.com/' stripUrl = url + 'comic/%s' firstStripUrl = stripUrl % '1-0' @@ -98,7 +98,7 @@ class WhiteNoiseLee(_ComicControlScraper): return pageUrl.rsplit('/', 1)[-1] + '.' + imageUrl.rsplit('.', 1)[-1] -class Whomp(_ComicControlScraper): +class Whomp(ComicControlScraper): url = 'http://www.whompcomic.com/' firstStripUrl = url + 'comic/06152010' textSearch = '//img[@id="cc-comic"]/@title' @@ -127,7 +127,7 @@ class Wigu(_ParserScraper): help = 'Index format: n' -class WildeLife(_ComicControlScraper): +class WildeLife(ComicControlScraper): url = 'http://www.wildelifecomic.com/' stripUrl = url + 'comic/%s' firstStripUrl = stripUrl % '1' diff --git a/dosagelib/plugins/webcomicfactory.py b/dosagelib/plugins/webcomicfactory.py index faaaf35b8..24da4039e 100644 --- a/dosagelib/plugins/webcomicfactory.py +++ b/dosagelib/plugins/webcomicfactory.py @@ -3,11 +3,11 @@ # Copyright (C) 2012-2014 Bastian Kleineidam # Copyright (C) 2015-2020 Tobias Gruetzmacher # Copyright (C) 2019-2020 Daniel Ring -from .common import _WordPressScraper +from .common import WordPressScraper from ..helpers import indirectStarter -class WebcomicFactory(_WordPressScraper): +class WebcomicFactory(WordPressScraper): starter = indirectStarter def __init__(self, name, url): diff --git a/dosagelib/plugins/webtoons.py b/dosagelib/plugins/webtoons.py index 56358e273..dcb0fb1f5 100644 --- a/dosagelib/plugins/webtoons.py +++ b/dosagelib/plugins/webtoons.py @@ -1,10 +1,10 @@ # SPDX-License-Identifier: MIT # Copyright (C) 2019-2022 Tobias Gruetzmacher # Copyright (C) 2019-2022 Daniel Ring -from ..scraper import _ParserScraper +from ..scraper import ParserScraper -class WebToons(_ParserScraper): +class WebToons(ParserScraper): imageSearch = '//img[contains(@class, "_images")]/@data-url' prevSearch = '//a[contains(@class, "_prevEpisode")]' multipleImagesPerStrip = True diff --git a/dosagelib/plugins/wlpcomics.py b/dosagelib/plugins/wlpcomics.py index e5755045d..965223251 100644 --- a/dosagelib/plugins/wlpcomics.py +++ b/dosagelib/plugins/wlpcomics.py @@ -1,15 +1,15 @@ # SPDX-License-Identifier: MIT # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam -# Copyright (C) 2015-2021 Tobias Gruetzmacher +# Copyright (C) 2015-2022 Tobias Gruetzmacher # Copyright (C) 2019-2020 Daniel Ring import re -from ..scraper import _ParserScraper +from ..scraper import ParserScraper from ..helpers import bounceStarter -class _WLPComics(_ParserScraper): +class WLPComics(ParserScraper): imageSearch = '//img[contains(@alt, " Comic")]' prevSearch = '//a[contains(text(), "Previous ")]' nextSearch = '//a[contains(text(), "Next ")]' @@ -17,20 +17,20 @@ class _WLPComics(_ParserScraper): help = 'Index format: nnn' def __init__(self, name): - super(_WLPComics, self).__init__('WLP/' + name) + super().__init__('WLP/' + name) def namer(self, image_url, page_url): return (page_url.rsplit('/', 1)[-1].split('.')[0] + '_' + image_url.rsplit('/', 1)[-1]) -class ChichiChan(_WLPComics): +class ChichiChan(WLPComics): url = 'http://www.wlpcomics.com/adult/chichi/' stripUrl = url + '%s.html' adult = True -class ChocolateMilkMaid(_WLPComics): +class ChocolateMilkMaid(WLPComics): # Newer pages seem to be broken stripUrl = 'http://www.wlpcomics.com/adult/cm/%s.html' url = stripUrl % '264' @@ -46,12 +46,12 @@ class ChocolateMilkMaid(_WLPComics): return tourl -class MaidAttack(_WLPComics): +class MaidAttack(WLPComics): url = 'http://www.wlpcomics.com/general/maidattack/' stripUrl = url + '%s.html' -class PeterIsTheWolfAdult(_WLPComics): +class PeterIsTheWolfAdult(WLPComics): stripUrl = 'http://www.peteristhewolf.com/adult/%s.html' # navigation to newest page is broken url = stripUrl % '427' @@ -74,7 +74,7 @@ class PeterIsTheWolfAdult(_WLPComics): return super(PeterIsTheWolfAdult, self).getPrevUrl(url, data) -class PeterIsTheWolfGeneral(_WLPComics): +class PeterIsTheWolfGeneral(WLPComics): stripUrl = 'http://www.peteristhewolf.com/general/%s.html' # navigation to newest page is broken url = stripUrl % '427' @@ -94,7 +94,7 @@ class PeterIsTheWolfGeneral(_WLPComics): return super(PeterIsTheWolfGeneral, self).getPrevUrl(url, data) -class Stellar(_WLPComics): +class Stellar(WLPComics): url = 'http://www.wlpcomics.com/adult/stellar/' stripUrl = url + '%s.html' adult = True diff --git a/dosagelib/plugins/wrongside.py b/dosagelib/plugins/wrongside.py index 785ed7ec5..78bc4a080 100644 --- a/dosagelib/plugins/wrongside.py +++ b/dosagelib/plugins/wrongside.py @@ -1,11 +1,11 @@ # SPDX-License-Identifier: MIT -# Copyright (C) 2019-2020 Tobias Gruetzmacher +# Copyright (C) 2019-2022 Tobias Gruetzmacher # Copyright (C) 2019-2022 Daniel Ring -from ..scraper import _ParserScraper +from ..scraper import ParserScraper from ..helpers import indirectStarter -class Wrongside(_ParserScraper): +class Wrongside(ParserScraper): baseUrl = 'http://ayzewi.com/maingallery3/' url = baseUrl + 'index.php?/category/5' stripUrl = baseUrl + 'picture.php?%s' @@ -41,7 +41,7 @@ class WrongsideBeginnings(Wrongside): firstStripUrl = stripUrl % '/2/category/18' -class WrongsideSideStories(_ParserScraper): +class WrongsideSideStories(ParserScraper): baseUrl = 'http://ayzewi.com/maingallery3/' stripUrl = baseUrl + 'picture.php?%s' imageSearch = '//img[@id="theMainImage"]/@src' diff --git a/dosagelib/plugins/wumo.py b/dosagelib/plugins/wumo.py index accc9783d..832994a06 100644 --- a/dosagelib/plugins/wumo.py +++ b/dosagelib/plugins/wumo.py @@ -1,11 +1,11 @@ # SPDX-License-Identifier: MIT # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam -# Copyright (C) 2015-2016 Tobias Gruetzmacher -from ..scraper import _ParserScraper +# Copyright (C) 2015-2022 Tobias Gruetzmacher +from ..scraper import ParserScraper -class KindOfNormal(_ParserScraper): +class KindOfNormal(ParserScraper): imageSearch = '//article[1]//div[@class="box-content"]//img' prevSearch = '//a[@class="prev"]' diff --git a/dosagelib/plugins/x.py b/dosagelib/plugins/x.py index 0dcab26ce..1686d95de 100644 --- a/dosagelib/plugins/x.py +++ b/dosagelib/plugins/x.py @@ -1,14 +1,13 @@ # SPDX-License-Identifier: MIT # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam -# Copyright (C) 2015-2020 Tobias Gruetzmacher +# Copyright (C) 2015-2022 Tobias Gruetzmacher # Copyright (C) 2019-2020 Daniel Ring -from ..scraper import _ParserScraper +from ..scraper import ParserScraper from ..helpers import bounceStarter -class XKCD(_ParserScraper): - name = 'xkcd' +class xkcd(ParserScraper): url = 'https://xkcd.com/' stripUrl = url + '%s/' firstStripUrl = stripUrl % '1' diff --git a/dosagelib/plugins/y.py b/dosagelib/plugins/y.py index 8a3a2ff15..4fd50cf4e 100644 --- a/dosagelib/plugins/y.py +++ b/dosagelib/plugins/y.py @@ -3,10 +3,10 @@ # Copyright (C) 2012-2014 Bastian Kleineidam # Copyright (C) 2015-2022 Tobias Gruetzmacher # Copyright (C) 2019-2020 Daniel Ring -from .common import _WordPressScraper, _WPWebcomic +from .common import WordPressScraper, WordPressWebcomic -class YAFGC(_WordPressScraper): +class YAFGC(WordPressScraper): baseUrl = 'https://www.yafgc.net/' url = baseUrl + '?latest' stripUrl = baseUrl + 'comic/%s' @@ -17,7 +17,7 @@ class YAFGC(_WordPressScraper): self.session.add_throttle('www.yafgc.net', 3.0, 15.5) -class YoshSaga(_WPWebcomic): +class YoshSaga(WordPressWebcomic): url = 'https://www.yoshsaga.com/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % 'introduction' diff --git a/dosagelib/plugins/z.py b/dosagelib/plugins/z.py index 22389f284..f7556110a 100644 --- a/dosagelib/plugins/z.py +++ b/dosagelib/plugins/z.py @@ -1,23 +1,23 @@ # SPDX-License-Identifier: MIT # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam -# Copyright (C) 2015-2021 Tobias Gruetzmacher +# Copyright (C) 2015-2022 Tobias Gruetzmacher from re import compile, escape -from ..scraper import _BasicScraper, _ParserScraper +from ..scraper import BasicScraper, ParserScraper from ..util import tagre from ..helpers import bounceStarter, joinPathPartsNamer -from .common import _WPNavi +from .common import WordPressNavi -class ZapComic(_ParserScraper): +class ZapComic(ParserScraper): url = 'http://www.zapcomic.com/' css = True imageSearch = 'img.comic-item' prevSearch = 'a.previous-comic-link' -class Zapiro(_ParserScraper): +class Zapiro(ParserScraper): url = 'http://mg.co.za/zapiro/' starter = bounceStarter imageSearch = '//div[@id="cartoon"]/img' @@ -26,7 +26,7 @@ class Zapiro(_ParserScraper): namer = joinPathPartsNamer((-1,), ()) -class ZenPencils(_WPNavi): +class ZenPencils(WordPressNavi): url = 'https://web.archive.org/web/20200723091741/https://zenpencils.com/' multipleImagesPerStrip = True firstStripUrl = url + 'comic/1-ralph-waldo-emerson-make-them-cry/' @@ -36,7 +36,7 @@ class ZenPencils(_WPNavi): endOfLife = True -class ZombieHunters(_BasicScraper): +class ZombieHunters(BasicScraper): url = 'http://www.thezombiehunters.com/' stripUrl = url + '?strip_id=%s' firstStripUrl = stripUrl % '1' @@ -45,7 +45,7 @@ class ZombieHunters(_BasicScraper): help = 'Index format: n(unpadded)' -class Zwarwald(_BasicScraper): +class Zwarwald(BasicScraper): url = "http://www.zwarwald.de/" rurl = escape(url) stripUrl = url + 'index.php/page/%s/' diff --git a/dosagelib/scraper.py b/dosagelib/scraper.py index eb141448a..d65c8be09 100644 --- a/dosagelib/scraper.py +++ b/dosagelib/scraper.py @@ -2,12 +2,14 @@ # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam # Copyright (C) 2015-2022 Tobias Gruetzmacher +from __future__ import annotations + import html import os import re import warnings from urllib.parse import urljoin -from typing import Dict, List, Optional, Union, Pattern, Sequence +from typing import Collection, Dict, List, Optional, Type, Union, Pattern, Sequence import lxml from lxml.html.defs import link_attrs as html_link_attrs @@ -99,11 +101,13 @@ class Scraper: session: http.Session = http.default_session @classmethod - def getmodules(cls): + def getmodules(cls) -> Collection[Scraper]: + if cls.url is None: + return () name = cls.__name__ if hasattr(cls, 'name'): name = cls.name - return [cls(name)] + return (cls(name),) @property def indexes(self): @@ -361,7 +365,7 @@ class Scraper: raise GeoblockedException() -class _BasicScraper(Scraper): +class BasicScraper(Scraper): """ Scraper base class that matches regular expressions against HTML pages. @@ -376,7 +380,7 @@ class _BasicScraper(Scraper): BASE_SEARCH = re.compile(tagre("base", "href", '([^"]*)')) def getPage(self, url): - content = super(_BasicScraper, self).getPage(url).text + content = super().getPage(url).text # determine base URL baseUrl = None match = self.BASE_SEARCH.search(content) @@ -426,7 +430,7 @@ class _BasicScraper(Scraper): return None -class _ParserScraper(Scraper): +class ParserScraper(Scraper): """ Scraper base class that uses a HTML parser and XPath expressions. @@ -452,7 +456,7 @@ class _ParserScraper(Scraper): css = False def getPage(self, url): - page = super(_ParserScraper, self).getPage(url) + page = super().getPage(url) if page.encoding: # Requests figured out the encoding, so we can deliver Unicode to # LXML. Unfortunatly, LXML feels betrayed if there is still an XML @@ -535,6 +539,11 @@ class _ParserScraper(Scraper): return res +# Legacy aliases +_BasicScraper = BasicScraper +_ParserScraper = ParserScraper + + class Cache: """Cache for comic scraper objects. The cache is initialized on first use. This is cached, since iterating & loading a complete package might be quite diff --git a/tests/mocks/extra/dummy.py b/tests/mocks/extra/dummy.py index c32584991..59d072779 100644 --- a/tests/mocks/extra/dummy.py +++ b/tests/mocks/extra/dummy.py @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT -# Copyright (C) 2021 Tobias Gruetzmacher -from ..scraper import _ParserScraper +# Copyright (C) 2021-2022 Tobias Gruetzmacher +from ..scraper import ParserScraper -class AnotherDummyTestScraper(_ParserScraper): +class AnotherDummyTestScraper(ParserScraper): url = 'https://dummy.example/' diff --git a/tests/mocks/plugins/dummy.py b/tests/mocks/plugins/dummy.py index 591344ae9..10fc3800e 100644 --- a/tests/mocks/plugins/dummy.py +++ b/tests/mocks/plugins/dummy.py @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT # Copyright (C) 2020 Tobias Gruetzmacher -from ..scraper import _ParserScraper +from ..scraper import ParserScraper -class ADummyTestScraper(_ParserScraper): +class ADummyTestScraper(ParserScraper): url = 'https://dummy.example/' diff --git a/tests/modules/conftest.py b/tests/modules/conftest.py index 43498c062..a2ee4b538 100644 --- a/tests/modules/conftest.py +++ b/tests/modules/conftest.py @@ -22,11 +22,11 @@ def get_test_scrapers(): else: # Get limited number of scraper tests as default testscrapernames = [ - # "classic" _BasicScraper + # "classic" BasicScraper 'AbstruseGoose', - # complex _ParserScraper + # complex ParserScraper 'GoComics/CalvinAndHobbes', - # _WordPressScraper + # WordPressScraper 'GrrlPower', ] scraper_pattern = '^(' + '|'.join(testscrapernames) + ')$' diff --git a/tests/test_vote.py b/tests/test_vote.py index 57e11ac98..675133ba1 100644 --- a/tests/test_vote.py +++ b/tests/test_vote.py @@ -1,13 +1,13 @@ # SPDX-License-Identifier: MIT # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam -# Copyright (C) 2015-2019 Tobias Gruetzmacher +# Copyright (C) 2015-2022 Tobias Gruetzmacher import responses from dosagelib import scraper -class ATestScraper(scraper._BasicScraper): +class ATestScraper(scraper.BasicScraper): pass diff --git a/tox.ini b/tox.ini index cbfd785f2..a314ddcd3 100644 --- a/tox.ini +++ b/tox.ini @@ -35,7 +35,7 @@ commands = [flake8] # we aim for 79, but this suppresses warnings for now... max-line-length = 100 -ignore = E127,E128,E241,FI12,FI14,FI15,FI18,FI50,FI51,FI53,FI54,FI55,W504 +ignore = E127,E128,E241,FI12,FI14,FI15,FI18,FI50,FI51,FI53,FI54,FI55,FI58,W504 require-code = True no-accept-encodings = True min-version = 3.7 @@ -43,7 +43,7 @@ min-version = 3.7 # Duplicated for CodeClimate... [pep8] max-line-length = 100 -ignore = E127,E128,E241,FI12,FI14,FI15,FI18,FI50,FI51,FI53,FI54,FI55,W504 +ignore = E127,E128,E241,FI12,FI14,FI15,FI18,FI50,FI51,FI53,FI54,FI55,FI58,W504 [pytest] filterwarnings = default