Add site engine for Derideal
This commit is contained in:
parent
d232d1e43d
commit
b168e05cfd
1 changed files with 58 additions and 0 deletions
58
dosagelib/plugins/derideal.py
Normal file
58
dosagelib/plugins/derideal.py
Normal file
|
@ -0,0 +1,58 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2019-2020 Tobias Gruetzmacher
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
from ..scraper import _ParserScraper
|
||||
from ..helpers import indirectStarter
|
||||
|
||||
|
||||
class Derideal(_ParserScraper):
|
||||
baseUrl = 'https://www.derideal.com/'
|
||||
imageSearch = '//img[contains(@class, "comic-page")]'
|
||||
prevSearch = '//a[i[contains(@class, "fa-angle-left")]]'
|
||||
latestSearch = '//a[i[contains(@class, "fa-angle-double-right")]]'
|
||||
starter = indirectStarter
|
||||
|
||||
def __init__(self, name, sub, first, last=None):
|
||||
if name == 'Derideal':
|
||||
super(Derideal, self).__init__(name)
|
||||
else:
|
||||
super(Derideal, self).__init__('Derideal/' + name)
|
||||
|
||||
self.url = self.baseUrl + sub
|
||||
self.stripUrl = self.url + '/%s/'
|
||||
self.firstStripUrl = self.stripUrl % first
|
||||
self.startUrl = self.firstStripUrl
|
||||
|
||||
if last:
|
||||
self.endOfLife = True
|
||||
|
||||
def starter(self):
|
||||
indexPage = self.getPage(self.url)
|
||||
self.chapters = indexPage.xpath('//a[contains(text(), "Read this episode")]/@href')
|
||||
self.currentChapter = len(self.chapters)
|
||||
return indirectStarter(self)
|
||||
|
||||
def namer(self, imageUrl, pageUrl):
|
||||
filename = pageUrl.rstrip('/').rsplit('/', 1)[-1]
|
||||
filename = filename.replace('espanol-escape-25', 'escape-26')
|
||||
filename = filename.replace('espanol-w-a-l-l-y', 'w-a-l-l-y')
|
||||
filename = filename.replace('hogar-prision', 'home-prison')
|
||||
filename = filename.replace('strip', 'pe').replace('purpurina-effect', 'pe')
|
||||
filename = filename.replace('sector-de-seguridad', 'security-sector')
|
||||
filename = 'ch' + str(self.currentChapter) + '-' + filename
|
||||
if pageUrl in self.chapters:
|
||||
self.currentChapter -= 1
|
||||
return filename
|
||||
|
||||
@classmethod
|
||||
def getmodules(cls):
|
||||
return (
|
||||
cls('Derideal', 'derideal', 'cover-prime'),
|
||||
cls('Legacy', 'derideal-legacy', 'the-dream-cover', last='derideal-is-on-hiatus'),
|
||||
cls('LRE', 'RLE', 'the-leyend-of-the-rose-cover'),
|
||||
cls('ProjectPrime', 'project-prime', 'custus-part-i-cover'),
|
||||
cls('PurpurinaEffect', 'purpurina-effect', 'purpurina-effect-cover'),
|
||||
cls('TheVoid', 'the-void', 'the-void-cover')
|
||||
)
|
Loading…
Reference in a new issue