Add common handler for mgsisk's Wordpress Webcomic plugin

This commit is contained in:
Techwolf 2019-10-18 00:49:55 -07:00 committed by Tobias Gruetzmacher
parent c44a5a3b43
commit 241732bbba
12 changed files with 34 additions and 60 deletions

View file

@ -10,7 +10,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, _WPNaviIn
from .common import _WordPressScraper, _WPNavi, _WPNaviIn, _WPWebcomic
class AbbysAgency(_WordPressScraper):
@ -391,12 +391,10 @@ class ARedTailsDream(_BasicScraper):
help = 'Index format: nn'
class ArtificialIncident(_ParserScraper):
class ArtificialIncident(_WPWebcomic):
url = 'https://www.artificialincident.com/'
stripUrl = url + 'comic/%s/'
firstStripUrl = stripUrl % 'issue-one-life-changing'
imageSearch = '//div[@class="webcomic-image"]//img'
prevSearch = '//a[contains(@class, "previous-webcomic-link")]'
class Ashes(_WordPressScraper):

View file

@ -10,7 +10,7 @@ from re import compile, escape
from ..util import tagre
from ..scraper import _BasicScraper, _ParserScraper
from ..helpers import indirectStarter, xpath_class
from .common import _ComicControlScraper, _WordPressScraper, _WPNaviIn
from .common import _ComicControlScraper, _WordPressScraper, _WPNaviIn, _WPWebcomic
class BadassMuthas(_BasicScraper):
@ -95,13 +95,10 @@ class Beetlebum(_BasicScraper):
return name
class Bethellium(_ParserScraper):
class Bethellium(_WPWebcomic):
stripUrl = 'http://dbcomics.darkblueworkshop.com/bethellium/%s/'
firstStripUrl = stripUrl % 'chapter-1/webcomic-bethellium-chapter-1-cover'
url = firstStripUrl
imageSearch = '//div[@class="webcomic-image"]//img'
prevSearch = '//a[contains(@class, "previous-webcomic-link")]'
latestSearch = '//a[contains(@class, "last-webcomic-link")]'
starter = indirectStarter
def namer(self, imageUrl, pageUrl):

View file

@ -10,7 +10,7 @@ from re import compile, escape
from ..scraper import _BasicScraper, _ParserScraper
from ..helpers import bounceStarter, indirectStarter
from ..util import tagre
from .common import _WordPressScraper, _WPNavi
from .common import _WordPressScraper, _WPNavi, _WPWebcomic
class CampComic(_BasicScraper):
@ -179,12 +179,10 @@ class CatVersusHuman(_ParserScraper):
starter = indirectStarter
class CavesAndCritters(_ParserScraper):
class CavesAndCritters(_WPWebcomic):
url = 'https://cavesandcritters.com/?ao_confirm'
stripUrl = 'https://cavesandcritters.com/cnc_webcomic/%s/'
firstStripUrl = stripUrl % '01_000'
imageSearch = '//div[@class="webcomic-image"]//img'
prevSearch = '//a[contains(@class, "previous-webcomic-link")]'
adult = True

View file

@ -29,6 +29,13 @@ class _WPNaviIn(_WordPressScraper):
prevSearch = '//a[%s]' % xpath_class('navi-prev-in')
class _WPWebcomic(_WordPressScraper):
imageSearch = '//div[{}]//img'.format(xpath_class('webcomic-image'))
prevSearch = '//a[{}]'.format(xpath_class('previous-webcomic-link'))
nextSearch = '///a[{}]'.format(xpath_class('next-webcomic-link'))
latestSearch = '//a[{}]'.format(xpath_class('last-webcomic-link'))
class _ComicControlScraper(_ParserScraper):
imageSearch = '//img[@id="cc-comic"]'
prevSearch = '//a[@rel="prev"]'

View file

@ -10,7 +10,7 @@ from re import compile, escape
from ..scraper import _BasicScraper, _ParserScraper
from ..helpers import indirectStarter, bounceStarter, xpath_class
from ..util import tagre
from .common import _ComicControlScraper, _WordPressScraper, _WPNaviIn
from .common import _ComicControlScraper, _WordPressScraper, _WPNaviIn, _WPWebcomic
class Damonk(_BasicScraper):
@ -134,12 +134,10 @@ class DerTodUndDasMaedchen(_ParserScraper):
lang = 'de'
class DesertFox(_ParserScraper):
class DesertFox(_WPWebcomic):
url = 'https://www.desertfoxcomics.net/'
stripUrl = url + 'desertfox/comic/%s/'
firstStripUrl = stripUrl % 'origins-1'
imageSearch = '//div[@class="webcomic-image"]//img'
prevSearch = '//a[contains(@class, "previous-webcomic-link")]'
def namer(self, imageUrl, pageUrl):
# Fix inconsistent filenames
@ -204,12 +202,10 @@ class Dilbert(_ParserScraper):
return "%s" % name
class DocRat(_ParserScraper):
class DocRat(_WPWebcomic):
url = 'https://www.docrat.com.au/'
stripUrl = url + 'comic/%s/'
firstStripUrl = stripUrl % 'begin-with-eye-contact'
imageSearch = '//div[@class="webcomic-image"]//img'
prevSearch = '//a[contains(@class, "previous-webcomic-link")]'
def namer(self, imageUrl, pageUrl):
# Fix inconsistent filenames

View file

@ -11,7 +11,7 @@ from re import compile, escape, IGNORECASE
from ..helpers import indirectStarter, xpath_class
from ..scraper import _BasicScraper, _ParserScraper
from ..util import tagre
from .common import _ComicControlScraper, _WordPressScraper
from .common import _ComicControlScraper, _WordPressScraper, _WPWebcomic
class MacHall(_BasicScraper):
@ -175,13 +175,10 @@ class MonsieurLeChien(_BasicScraper):
help = 'Index format: n'
class Moonlace(_ParserScraper):
class Moonlace(_WPWebcomic):
stripUrl = 'http://dbcomics.darkblueworkshop.com/moonlace/%s/'
firstStripUrl = stripUrl % 'prologue/page-1'
url = firstStripUrl
imageSearch = '//div[@class="webcomic-image"]//img'
prevSearch = '//a[contains(@class, "previous-webcomic-link")]'
latestSearch = '//a[contains(@class, "last-webcomic-link")]'
adult = True
def starter(self):

View file

@ -10,7 +10,7 @@ from re import compile, escape
from ..scraper import _BasicScraper, _ParserScraper
from ..helpers import indirectStarter, xpath_class
from ..util import tagre
from .common import _ComicControlScraper, _WordPressScraper, _WPNavi
from .common import _ComicControlScraper, _WordPressScraper, _WPNavi, _WPWebcomic
class Namesake(_ComicControlScraper):
@ -180,12 +180,10 @@ class NonPlayerCharacter(_ParserScraper):
return pageUrl.rstrip('/').rsplit('/', 1)[-1]
class NotAVillain(_ParserScraper):
class NotAVillain(_WPWebcomic):
url = 'http://navcomic.com/'
stripUrl = url + 'not-a-villain/%s/'
firstStripUrl = stripUrl % 'v1-001'
imageSearch = '//div[@class="webcomic-image"]//img'
prevSearch = '//a[contains(@class, "previous-webcomic-link")]'
def namer(self, imageUrl, pageUrl):
filename = imageUrl.rsplit('/', 1)[-1]

View file

@ -11,7 +11,7 @@ from six.moves.urllib.parse import urljoin
from ..helpers import bounceStarter, xpath_class
from ..scraper import _BasicScraper, _ParserScraper
from ..util import tagre
from .common import _WordPressScraper
from .common import _WordPressScraper, _WPWebcomic
class RalfTheDestroyer(_WordPressScraper):
@ -101,10 +101,8 @@ class Replay(_ParserScraper):
return name
class RiversideExtras(_ParserScraper):
class RiversideExtras(_WPWebcomic):
url = 'https://riversidecomics.com/'
imageSearch = '//div[{}]//img'.format(xpath_class('webcomic-image'))
prevSearch = '//a[{}]'.format(xpath_class('previous-webcomic-link'))
class RomanticallyApocalyptic(_ParserScraper):
@ -137,13 +135,10 @@ class Ruthe(_BasicScraper):
help = 'Index format: number'
class Ryugou(_ParserScraper):
class Ryugou(_WPWebcomic):
url = 'http://ryugou.swashbuckledcomics.com/'
stripUrl = url + 'comic/%s/'
firstStripUrl = 'ryugou-chapter-1-cover'
imageSearch = '//div[@class="webcomic-image"]//img'
prevSearch = '//a[contains(@class, "previous-webcomic-link")]'
nextSearch = '//a[contains(@class, "next-webcomic-link")]'
starter = bounceStarter
def namer(self, imageUrl, pageUrl):

View file

@ -11,7 +11,7 @@ from os.path import splitext
from ..scraper import _BasicScraper, _ParserScraper
from ..helpers import indirectStarter, bounceStarter, joinPathPartsNamer, xpath_class
from ..util import tagre
from .common import _ComicControlScraper, _WordPressScraper, _WPNavi, _WPNaviIn
from .common import _ComicControlScraper, _WordPressScraper, _WPNavi, _WPNaviIn, _WPWebcomic
class SabrinaOnline(_BasicScraper):
@ -243,20 +243,16 @@ class SinFest(_BasicScraper):
help = 'Index format: yyyy-mm-dd'
class SixPackOfOtters(_ParserScraper):
class SixPackOfOtters(_WPWebcomic):
url = 'http://sixpackofotters.com/'
stripUrl = url + 'pages/%s/'
firstStripUrl = stripUrl % 'chapter-01-tandem'
imageSearch = '//div[contains(@class, "webcomic-image")]//img'
prevSearch = '//a[contains(@class, "previous-webcomic-link")]'
class SkinDeep(_ParserScraper):
class SkinDeep(_WPWebcomic):
url = 'http://www.skindeepcomic.com/'
stripUrl = url + 'archive/%s/'
firstStripUrl = stripUrl % 'issue-1-cover'
imageSearch = '//a[%s]/img' % xpath_class('webcomic-link')
prevSearch = '//a[%s]' % xpath_class('previous-webcomic-link')
class SleeplessDomain(_ComicControlScraper):
@ -346,14 +342,11 @@ class SomethingPositive(_ParserScraper):
help = 'Index format: mmddyyyy'
class Sorcery101(_ParserScraper):
class Sorcery101(_WPWebcomic):
baseUrl = 'http://www.sorcery101.net/sorcery-101/'
stripUrl = baseUrl + '%s/'
url = stripUrl % 'sorcery101-ch-01'
firstStripUrl = url
imageSearch = '//div[@class="webcomic-image"]/img'
prevSearch = '//a[@rel="prev"]'
latestSearch = '//a[%s]' % xpath_class('last-webcomic-link')
starter = indirectStarter
allow_errors = (500,)
help = 'Index format: stripname'

View file

@ -14,7 +14,7 @@ except ImportError:
from ..scraper import _BasicScraper, _ParserScraper
from ..helpers import indirectStarter, xpath_class
from ..util import tagre
from .common import _ComicControlScraper, _WordPressScraper, _WPNavi, _WPNaviIn
from .common import _ComicControlScraper, _WordPressScraper, _WPNavi, _WPNaviIn, _WPWebcomic
class TailsAndTactics(_ParserScraper):
@ -25,13 +25,11 @@ class TailsAndTactics(_ParserScraper):
prevSearch = '//a[text()=" Back"]'
class Tamberlane(_ParserScraper):
class Tamberlane(_WPWebcomic):
baseUrl = 'https://www.tamberlanecomic.com/'
url = baseUrl + 'latest/'
stripUrl = baseUrl + 'tamberlane/%s/'
firstStripUrl = stripUrl % 'page-1'
imageSearch = '//div[@class="webcomic-image"]//img'
prevSearch = '//a[contains(@class, "previous-webcomic-link")]'
def namer(self, imageUrl, pageUrl):
# Fix inconsistent filenames

View file

@ -10,7 +10,7 @@ from re import compile, escape, IGNORECASE
from ..scraper import _BasicScraper, _ParserScraper
from ..util import tagre
from ..helpers import bounceStarter, indirectStarter, xpath_class
from .common import _ComicControlScraper, _WordPressScraper, _WPNavi
from .common import _ComicControlScraper, _WordPressScraper, _WPNavi, _WPWebcomic
class WapsiSquare(_WordPressScraper):
@ -93,11 +93,11 @@ class WereIWolf(_ParserScraper):
return self.stripUrl % (index[0], index[1])
class WhiteNoise(_WordPressScraper):
class WhiteNoise(_WPWebcomic):
url = 'http://whitenoisecomic.com/'
stripUrl = url + 'comic/%s/'
firstStripUrl = stripUrl % 'book-one'
prevSearch = '//a[%s]' % xpath_class('previous-webcomic-link')
imageSearch = '//div[@id="comic"]//img'
class WhiteNoiseLee(_ComicControlScraper):

View file

@ -5,17 +5,14 @@
from __future__ import absolute_import, division, print_function
from ..scraper import _ParserScraper
from .common import _WordPressScraper
from .common import _WordPressScraper, _WPWebcomic
class YAFGC(_WordPressScraper):
url = 'http://yafgc.net/'
class YoshSaga(_ParserScraper):
class YoshSaga(_WPWebcomic):
url = 'https://www.yoshsaga.com/'
stripUrl = url + 'comic/%s/'
firstStripUrl = stripUrl % 'introduction'
imageSearch = '//div[@class="webcomic-image"]//img'
prevSearch = '//a[contains(@class, "previous-webcomic-link")]'