2020-04-18 11:45:44 +00:00
|
|
|
# SPDX-License-Identifier: MIT
|
2024-03-17 20:44:46 +00:00
|
|
|
# SPDX-FileCopyrightText: © 2019 Tobias Gruetzmacher
|
|
|
|
# SPDX-FileCopyrightText: © 2019 Daniel Ring
|
2022-06-06 10:08:32 +00:00
|
|
|
from ..scraper import ParserScraper
|
2019-09-08 02:03:01 +00:00
|
|
|
|
|
|
|
|
2022-06-06 10:08:32 +00:00
|
|
|
class KemonoCafe(ParserScraper):
|
2019-09-08 02:03:01 +00:00
|
|
|
imageSearch = '//div[@id="comic"]//img'
|
|
|
|
prevSearch = '//a[contains(@class, "comic-nav-previous")]'
|
|
|
|
|
|
|
|
def __init__(self, name, sub, first, last=None, adult=False):
|
|
|
|
super(KemonoCafe, self).__init__('KemonoCafe/' + name)
|
|
|
|
|
|
|
|
self.url = 'https://%s.kemono.cafe/' % sub
|
|
|
|
self.stripUrl = self.url + 'comic/%s/'
|
|
|
|
self.firstStripUrl = self.stripUrl % first
|
|
|
|
|
|
|
|
if last:
|
|
|
|
self.url = self.stripUrl % last
|
|
|
|
self.endOfLife = True
|
|
|
|
|
|
|
|
if adult:
|
|
|
|
self.adult = True
|
|
|
|
|
|
|
|
def namer(self, imageUrl, pageUrl):
|
|
|
|
# Strip date from filenames
|
|
|
|
filename = imageUrl.rsplit('/', 1)[-1]
|
2022-05-28 15:52:42 +00:00
|
|
|
if 'ultrarosa' not in pageUrl:
|
2022-01-22 05:28:47 +00:00
|
|
|
if filename[4] == '-' and filename[7] == '-':
|
|
|
|
filename = filename[10:]
|
|
|
|
if filename[0] == '-' or filename[0] == '_':
|
|
|
|
filename = filename[1:]
|
2019-09-08 02:03:01 +00:00
|
|
|
# Fix duplicate filenames
|
|
|
|
if 'paprika' in pageUrl and '69-2' in pageUrl:
|
|
|
|
filename = filename.replace('69', '69-2')
|
|
|
|
elif 'rascals' in pageUrl and '89-2' in pageUrl:
|
|
|
|
filename = filename.replace('89', '90')
|
|
|
|
elif 'rascals' in pageUrl and '133-2' in pageUrl:
|
|
|
|
filename = filename.replace('133', '134')
|
2023-01-10 06:33:06 +00:00
|
|
|
elif 'caughtinorbit' in pageUrl and '26gs' in filename:
|
|
|
|
filename = filename.replace('026gs', '021')
|
|
|
|
elif 'caughtinorbit' in pageUrl and '27gs' in filename:
|
|
|
|
filename = filename.replace('027gs', '022')
|
2019-09-11 02:52:08 +00:00
|
|
|
# Fix unordered filenames
|
|
|
|
if 'addictivescience' in pageUrl:
|
|
|
|
page = self.getPage(pageUrl)
|
2024-03-17 20:44:46 +00:00
|
|
|
num = int(self.match(page, '//div[@id="comic-wrap"]/@class')[0].replace('comic-id-', ''))
|
2019-09-11 02:52:08 +00:00
|
|
|
filename = '%04d_%s' % (num, filename)
|
2023-01-10 06:33:06 +00:00
|
|
|
elif 'CaughtInOrbit' in filename:
|
|
|
|
filename = filename.replace('CaughtInOrbit', 'CIO')
|
2019-09-08 02:03:01 +00:00
|
|
|
return filename
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def getmodules(cls):
|
|
|
|
return (
|
2019-09-11 02:52:08 +00:00
|
|
|
cls('AddictiveScience', 'addictivescience', 'page0001'),
|
2021-09-26 04:07:49 +00:00
|
|
|
cls('Bethellium', 'bethellium', 'c01p00'),
|
2019-09-08 02:03:01 +00:00
|
|
|
cls('CaribbeanBlue', 'cb', 'page000', last='page325'),
|
2023-01-10 06:33:06 +00:00
|
|
|
cls('CaughtInOrbit', 'caughtinorbit', 'comic-cover'),
|
2019-09-08 02:03:01 +00:00
|
|
|
cls('IMew', 'imew', 'imew00', last='imew50'),
|
|
|
|
cls('Knighthood', 'knighthood', 'kh0001'),
|
2020-10-20 07:49:35 +00:00
|
|
|
cls('KnuckleUp', 'knuckle-up', 'page001', adult=True),
|
2019-09-08 02:03:01 +00:00
|
|
|
cls('LasLindas', 'laslindas', 'll0001', adult=True),
|
|
|
|
cls('Paprika', 'paprika', 'page000'),
|
|
|
|
cls('PracticeMakesPerfect', 'pmp', 'title-001'),
|
|
|
|
cls('Rascals', 'rascals', 'rascals-pg-0', adult=True),
|
|
|
|
cls('TheEyeOfRamalach', 'theeye', 'theeye-page01'),
|
|
|
|
cls('TinaOfTheSouth', 'tots', 'tos-01-01'),
|
2022-01-22 05:28:47 +00:00
|
|
|
cls('UltraRosa', 'ultrarosa', 'pg001'),
|
2019-09-08 02:03:01 +00:00
|
|
|
)
|