From bafe3ecb316b8c63bc2ad3faab087e1e7fbaace2 Mon Sep 17 00:00:00 2001 From: "D. Moonfire" Date: Sun, 24 Sep 2023 00:23:37 -0500 Subject: [PATCH] Add Alfie --- dosagelib/plugins/a.py | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/dosagelib/plugins/a.py b/dosagelib/plugins/a.py index 32a5b42ce..e3fc866ca 100644 --- a/dosagelib/plugins/a.py +++ b/dosagelib/plugins/a.py @@ -3,7 +3,7 @@ # Copyright (C) 2012-2014 Bastian Kleineidam # Copyright (C) 2015-2022 Tobias Gruetzmacher # Copyright (C) 2019-2020 Daniel Ring -from re import compile, escape, MULTILINE +from re import compile, escape, sub, MULTILINE from ..util import tagre from ..scraper import BasicScraper, ParserScraper, _BasicScraper, _ParserScraper @@ -136,6 +136,34 @@ class ALessonIsLearned(_BasicScraper): help = 'Index format: nnn' +class Alfie(WordPressScraper): + url = 'https://buttsmithy.com/' + stripUrl = url + 'archives/comic/%s' + firstStripUrl = stripUrl % 'p1' + adult = True + starter = bounceStarter + + def namer(self, image_url, page_url): + def repl(m): + return "{0}".format(m.group(1).zfill(4)) + + name = sub('^p-?(\d+)', repl, page_url.split('/')[-1]) + + # Some of the first 1k pages were inconsistently named. + renames = {"/comic/p145": "0145-1", "/comic/p-145": "0145-2", + "/comic/268": "0268", "/comic/1132": "0313", + "/comic/1169": "0319", "/comic/1186": "0324", + "/comic/1404": "0378", "/comic/0338-2": "0339", + "/comic/0369-2": "0469", "/comic/2080": "0517", + "/comic/o-525": "0525", "/comic/p-361": "0553", + "/comic/p-668-2": "0678", "/comic/p-670-2": "0670", + "/comic/p-679-2": "0690", "/comic/3140": "0805"} + for rename in renames: + if rename in page_url: + name = renames[rename] + return name + + class Alice(WordPressScraper): url = 'https://web.archive.org/web/20210115132313/http://www.alicecomics.com/' latestSearch = '//a[text()="Latest Alice!"]'