From 81b92a8c186fa9cdbf2f74f9db7ba2fc63319fff Mon Sep 17 00:00:00 2001 From: Techwolf Date: Sat, 7 Sep 2019 19:03:01 -0700 Subject: [PATCH] Add KemonoCafe site engine --- dosagelib/plugins/kemonocafe.py | 55 +++++++++++++++++++++++++++++++++ dosagelib/plugins/l.py | 12 +------ dosagelib/plugins/old.py | 3 +- 3 files changed, 58 insertions(+), 12 deletions(-) create mode 100644 dosagelib/plugins/kemonocafe.py diff --git a/dosagelib/plugins/kemonocafe.py b/dosagelib/plugins/kemonocafe.py new file mode 100644 index 000000000..e4e37666b --- /dev/null +++ b/dosagelib/plugins/kemonocafe.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2019-2020 Tobias Gruetzmacher + +from __future__ import absolute_import, division, print_function + +from ..scraper import _ParserScraper + + +class KemonoCafe(_ParserScraper): + 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] + if filename[4] == '-' and filename[7] == '-': + filename = filename[10:] + if filename[0] == '-' or filename[0] == '_': + filename = filename[1:] + # 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') + return filename + + @classmethod + def getmodules(cls): + return ( + cls('CaribbeanBlue', 'cb', 'page000', last='page325'), + cls('IMew', 'imew', 'imew00', last='imew50'), + cls('Knighthood', 'knighthood', 'kh0001'), + 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'), + ) diff --git a/dosagelib/plugins/l.py b/dosagelib/plugins/l.py index 93fa3ca29..f5bdeac16 100644 --- a/dosagelib/plugins/l.py +++ b/dosagelib/plugins/l.py @@ -5,7 +5,7 @@ from __future__ import absolute_import, division, print_function -from re import compile, escape +from re import compile from ..scraper import _BasicScraper, _ParserScraper from ..helpers import bounceStarter, indirectStarter @@ -36,16 +36,6 @@ class Laiyu(_WordPressScraper): starter = indirectStarter -class LasLindas(_BasicScraper): - url = 'http://laslindas.katbox.net/' - rurl = escape(url) - stripUrl = url + 'comic/%s/' - imageSearch = compile(tagre("img", "src", r'(%swp-content/uploads/[^"]+)' % rurl, after="attachment-full")) - multipleImagesPerStrip = True - prevSearch = compile(tagre("a", "href", r'(%scomic/[^"]+)' % rurl, after="previous")) - help = 'Index format: stripname' - - class LastResort(_WordPressScraper): url = 'http://www.lastres0rt.com/' stripUrl = url + 'comic/%s/' diff --git a/dosagelib/plugins/old.py b/dosagelib/plugins/old.py index 6fab03154..9f6d95e57 100644 --- a/dosagelib/plugins/old.py +++ b/dosagelib/plugins/old.py @@ -435,7 +435,6 @@ class Removed(Scraper): cls('PensAndTales/FireflyCross'), cls('PetiteSymphony/Kickinrad'), cls('PetiteSymphony/Orangegrind'), - cls('PetiteSymphony/Rascals'), cls('PetiteSymphony/Seed'), cls('Pimpette'), cls('PunksAndNerds', 'mis'), @@ -727,10 +726,12 @@ class Renamed(Scraper): cls('KeenSpot/Newshounds', 'Newshounds'), cls('KeenSpot/SinFest', 'SinFest'), cls('KeenSpot/TheGodChild', 'GodChild'), + cls('LasLindas', 'KemonoCafe/LasLindas'), cls('NicoleAndDerek', 'NamirDeiter/NicoleAndDerek'), cls('OnTheFasttrack', 'ComicsKingdom/OnTheFastrack'), cls('PetiteSymphony/Djandora', 'ComicsBreak/Djandora'), cls('PetiteSymphony/Generation17', 'ComicsBreak/Generation17'), + cls('PetiteSymphony/Rascals', 'KemonoCafe/Rascals'), cls('QuentynQuinnSpaceRanger', 'RHJunior/QuentynQuinnSpaceRanger'), cls('ShermansLagoon', 'ComicsKingdom/ShermansLagoon'), cls('SmackJeeves/CityFolk', 'ComicFury/CityFolk'),