Fix ComicsKingdom (fixes #205)

This commit is contained in:
Tobias Gruetzmacher 2022-02-15 00:24:15 +01:00
parent 45162bf7f2
commit 44c78f4765

View file

@ -1,24 +1,22 @@
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
# Copyright (C) 2019-2022 Tobias Gruetzmacher # Copyright (C) 2019-2022 Tobias Gruetzmacher
# Copyright (C) 2019 Thomas W. Littauer # Copyright (C) 2019 Thomas W. Littauer
import re
from importlib.resources import path as get_path from importlib.resources import path as get_path
from ..scraper import _BasicScraper
from ..helpers import bounceStarter, joinPathPartsNamer from ..helpers import bounceStarter, joinPathPartsNamer
from ..scraper import _ParserScraper
class ComicsKingdom(_BasicScraper): class ComicsKingdom(_ParserScraper):
imageSearch = re.compile(r'property="og:image" content="(https://[^"]*img\.php\?[^"]+)"') imageSearch = '//img[@id="theComicImage"]/@data-wpfc-original-src'
prevSearch = re.compile(r':is-left-arrow="true"[^>]*date-slug="(\d\d\d\d-\d\d-\d\d)"') prevSearch = '//a[./img[contains(@alt, "Previous")]]'
nextSearch = re.compile(r':is-left-arrow="false"[^>]*date-slug="(\d\d\d\d-\d\d-\d\d)"') nextSearch = '//a[./img[contains(@alt, "Next")]]'
starter = bounceStarter starter = bounceStarter
namer = joinPathPartsNamer((-2, -1), ()) namer = joinPathPartsNamer((-2, -1), ())
help = 'Index format: yyyy-mm-dd' help = 'Index format: yyyy-mm-dd'
def __init__(self, name, path): def __init__(self, name, path):
super(ComicsKingdom, self).__init__('ComicsKingdom/' + name) super().__init__('ComicsKingdom/' + name)
self.url = 'https://comicskingdom.com/' + path self.url = 'https://comicskingdom.com/' + path
self.stripUrl = self.url + '/%s' self.stripUrl = self.url + '/%s'
@ -30,11 +28,6 @@ class ComicsKingdom(_BasicScraper):
'verify': str(self.cert_ctx.__enter__()), 'verify': str(self.cert_ctx.__enter__()),
}) })
def link_modifier(self, url, tourl):
if self.url not in tourl:
tourl = self.url + '/' + tourl.rsplit("/", 1)[1]
return tourl
@classmethod @classmethod
def getmodules(cls): # noqa: Allowed to be long def getmodules(cls): # noqa: Allowed to be long
return ( return (