dosage/dosagelib/plugins/derideal.py

50 lines
1.9 KiB
Python
Raw Normal View History

# SPDX-License-Identifier: MIT
2024-03-17 20:44:46 +00:00
# SPDX-FileCopyrightText: © 2019 Tobias Gruetzmacher
# SPDX-FileCopyrightText: © 2019 Daniel Ring
import itertools
from ..scraper import ParserScraper
from ..helpers import indirectStarter, joinPathPartsNamer
2020-01-11 10:13:28 +00:00
class Derideal(ParserScraper):
baseUrl = 'https://derideal.com/'
imageSearch = '//img[d:class("comic-page") or d:class("comic-pag")]'
prevSearch = '//a[text()="<"]'
starter = indirectStarter
namer = joinPathPartsNamer(imageparts=range(-3, 0))
def __init__(self, name, lang, sub, first, eol=False, multi=False):
if lang == 'en':
base = 'Derideal'
lateststr = 'Read latest update'
2020-01-11 10:13:28 +00:00
else:
base = 'DeridealSpanish'
sub = f'{lang}/{sub}'
lateststr = 'Leer última actualización'
2020-01-11 10:13:28 +00:00
if not name:
super().__init__(base)
else:
super().__init__(f'{base}/{name}')
2020-01-11 10:13:28 +00:00
self.url = f'{self.baseUrl}{sub}'
self.firstStripUrl = f'{self.url}/{first}/'
self.latestSearch = f'//a[contains(text(), "{lateststr}")]'
self.lang = lang
self.endOfLife = eol
self.multipleImagesPerStrip = multi
2020-01-11 10:13:28 +00:00
@classmethod
def getmodules(cls):
return itertools.chain.from_iterable((
cls('', lang, 'derideal', 'chimeras-cover'),
cls('Legacy', lang, 'derideal-legacy', 'the-dream-cover', eol=True),
cls('LostMemories', lang, 'lost-memories', 'lost-memories-pixi', multi=True),
cls('Nova', lang, 'nova', 'xen-prelude-cover'),
cls('ProjectPrime', lang, 'project-prime', 'custus-part-i-cover'),
cls('PurpurinaEffect', lang, 'purpurina-effect', 'purpurina-effect-cover'),
cls('RLE', lang, 'RLE', 'the-leyend-of-the-rose-cover'),
cls('TheVoid', lang, 'the-void', 'the-void-cover'),
) for lang in ('en', 'es'))