diff --git a/dosagelib/plugins/old.py b/dosagelib/plugins/old.py index 9f06968c2..e9a53c085 100644 --- a/dosagelib/plugins/old.py +++ b/dosagelib/plugins/old.py @@ -1679,6 +1679,7 @@ class Renamed(Scraper): cls('SmackJeeves/TheRealmOfKaerwyn', 'ComicFury/TheRealmOfKaerwyn'), cls('SoloLeveling', 'MangaDex/SoloLeveling'), cls('StudioKhimera/Draconia', 'Draconia'), + cls('StudioKhimera/UberQuest', 'UberQuest'), cls('TracesOfThePast', 'RickGriffinStudios/TracesOfThePast'), cls('TracesOfThePast/NSFW', 'RickGriffinStudios/TracesOfThePastNSFW'), diff --git a/dosagelib/plugins/studiokhimera.py b/dosagelib/plugins/studiokhimera.py index 8a129157f..22ae3808e 100644 --- a/dosagelib/plugins/studiokhimera.py +++ b/dosagelib/plugins/studiokhimera.py @@ -45,21 +45,3 @@ class StudioKhimera(ParserScraper): return ( cls('Mousechievous', 'mousechievous'), ) - - -class UberQuest(WordPressScraper): - name = 'StudioKhimera/UberQuest' - stripUrl = 'https://uberquest.studiokhimera.com/comic/page/%s/' - url = stripUrl % 'latest' - firstStripUrl = stripUrl % 'cover' - imageSearch = '//div[@class="prj--comic-image"]/img' - prevSearch = '//uq-image-button[d:class("prj--comic-control-prev")]' - - def namer(self, imageUrl, pageUrl): - # Fix inconsistent filenames - filename = imageUrl.rsplit('/', 1)[-1] - filename = filename.replace('Page', 'UberQuest') - filename = filename.replace('UberQuest01.', 'UberQuest001.') - filename = filename.replace('UberQuest98.', 'UberQuest098.') - filename = filename.replace('UberQuest99.', 'UberQuest099.') - return filename diff --git a/dosagelib/plugins/u.py b/dosagelib/plugins/u.py index 01ec06e23..12eeb0bbd 100644 --- a/dosagelib/plugins/u.py +++ b/dosagelib/plugins/u.py @@ -3,6 +3,7 @@ # Copyright (C) 2012-2014 Bastian Kleineidam # Copyright (C) 2015-2020 Tobias Gruetzmacher # Copyright (C) 2019-2020 Daniel Ring +import json from re import compile from urllib.parse import urljoin from lxml import etree @@ -13,6 +14,28 @@ from ..util import tagre from .common import ComicControlScraper, WordPressScraper, WordPressNavi +class UberQuest(ParserScraper): + baseUrl = 'https://uberquest.studiokhimera.com/' + url = baseUrl + 'wp-json/keeros_comics/v1/chapters' + stripUrl = baseUrl + 'wp-json/wp/v2/cfx_comic_page?page_number=%s' + firstStripUrl = stripUrl % 'cover' + + def starter(self): + # Retrieve comic metadata from API + data = self.session.get(self.url) + data.raise_for_status() + return self.stripUrl % data.json()[-1]['pages'][-1]['page_number'] + + def getPrevUrl(self, url, data): + return self.stripUrl % json.loads(data.text_content())[0]['prev_id'] + + def fetchUrls(self, url, data, urlSearch): + return [json.loads(data.text_content())[0]['attachment']] + + def namer(self, imageUrl, pageUrl): + return 'UberQuest-' + pageUrl.rsplit('=', 1)[-1] + + class Underling(WordPressNavi): url = ('https://web.archive.org/web/20190806120425/' 'http://underlingcomic.com/')