From 334640515edb6bbf8438812576335ac2f39dc945 Mon Sep 17 00:00:00 2001 From: Tobias Gruetzmacher Date: Mon, 6 Jun 2022 13:07:48 +0200 Subject: [PATCH] Fix SnafuComics --- dosagelib/plugins/old.py | 3 +++ dosagelib/plugins/snafu.py | 23 +++++++++-------------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/dosagelib/plugins/old.py b/dosagelib/plugins/old.py index 2492116f4..97ff91b39 100644 --- a/dosagelib/plugins/old.py +++ b/dosagelib/plugins/old.py @@ -1563,7 +1563,10 @@ class Removed(Scraper): cls('SmackJeeves/ZaenWell'), cls('SmackJeeves/ZeldaTheNewAdventureofLinkIIMajorasMask'), cls('SnafuComics/KOF'), + cls('SnafuComics/MyPanda'), cls('SnafuComics/SF'), + cls('SnafuComics/Snafu'), + cls('SnafuComics/Tin'), cls('SnafuComics/Titan'), cls('StudioKhimera/Eorah', 'mov'), cls('StuffNoOneToldMe'), diff --git a/dosagelib/plugins/snafu.py b/dosagelib/plugins/snafu.py index 0d9d66746..66a1c392a 100644 --- a/dosagelib/plugins/snafu.py +++ b/dosagelib/plugins/snafu.py @@ -2,30 +2,28 @@ # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam # Copyright (C) 2015-2022 Tobias Gruetzmacher -from ..scraper import ParserScraper -from ..helpers import indirectStarter +import re + +from .common import ComicControlScraper -class Snafu(ParserScraper): - # Next and Previous are swapped... - prevSearch = '//a[@class="next"]' - imageSearch = '//div[@class="comicpage"]/img' - latestSearch = '//div[@id="feed"]/a' - starter = indirectStarter +FILENAMECRAP = re.compile(r'_[0-9a-f]{72}(?=\.)') + +class Snafu(ComicControlScraper): def __init__(self, name, path): super().__init__('SnafuComics/' + name) - self.url = 'http://snafu-comics.com/swmseries/' + path + self.url = 'https://snafu-comics.com/' + path def namer(self, image_url, page_url): - year, month, name = image_url.rsplit('/', 3)[1:] - return "%04s_%02s_%s" % (year, month, name) + return FILENAMECRAP.sub('', image_url.rsplit('/', 1)[-1]) @classmethod def getmodules(cls): return ( cls('Braindead', 'braindead'), cls('Bunnywith', 'bunnywith'), + cls('CrawlingCity', 'crawlingcity'), cls('DeliverUsEvil', 'deliverusevil'), cls('EA', 'ea'), cls('FT', 'ft'), @@ -33,18 +31,15 @@ class Snafu(ParserScraper): cls('GrimTalesFromDownBelow', 'grimtales'), cls('HalfboundBlade', 'hbp'), cls('KayosGaiden', 'titan-kayos'), - cls('MyPanda', 'mypanda'), cls('NarutoHeroesPath', 'naruto'), cls('NewSuperMarioAdventures', 'nsma'), cls('PowerPuffGirls', 'powerpuffgirls'), cls('SatansExcrement', 'satansexcrement'), cls('SkullBoy', 'skullboy'), - cls('Snafu', 'snafu'), cls('Soul', 'soul'), cls('Sugar', 'sugarbits'), cls('SureToBeBanD', 'stbb'), cls('TheLeague', 'league'), - cls('Tin', 'tin'), cls('TrunksAndSoto', 'trunks-and-soto'), cls('TW', 'tw'), cls('Zim', 'zim'),