Skip to content

Commit

Permalink
Add Alfie
Browse files Browse the repository at this point in the history
  • Loading branch information
dmoonfire committed Oct 12, 2023
1 parent 85127de commit 9fadc2c
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion dosagelib/plugins/a.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))

Check warning on line 148 in dosagelib/plugins/a.py

View check run for this annotation

Codecov / codecov/patch

dosagelib/plugins/a.py#L147-L148

Added lines #L147 - L148 were not covered by tests

name = sub('^p-?(\d+)', repl, page_url.split('/')[-1])

Check warning on line 150 in dosagelib/plugins/a.py

View check run for this annotation

Codecov / codecov/patch

dosagelib/plugins/a.py#L150

Added line #L150 was not covered by tests

# Some of the first 1k pages were inconsistently named.
renames = {"/comic/p145": "0145-1", "/comic/p-145": "0145-2",

Check warning on line 153 in dosagelib/plugins/a.py

View check run for this annotation

Codecov / codecov/patch

dosagelib/plugins/a.py#L153

Added line #L153 was not covered by tests
"/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

Check warning on line 164 in dosagelib/plugins/a.py

View check run for this annotation

Codecov / codecov/patch

dosagelib/plugins/a.py#L163-L164

Added lines #L163 - L164 were not covered by tests


class Alice(WordPressScraper):
url = 'https://web.archive.org/web/20210115132313/http://www.alicecomics.com/'
latestSearch = '//a[text()="Latest Alice!"]'
Expand Down

0 comments on commit 9fadc2c

Please sign in to comment.