Skip to content

Commit

Permalink
Add Alfie
Browse files Browse the repository at this point in the history
  • Loading branch information
dmoonfire committed Sep 24, 2023
1 parent 92bdd00 commit f8d5ff7
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 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,45 @@ class ALessonIsLearned(_BasicScraper):
help = 'Index format: nnn'


class Alfie(WordPressScraper):
url = 'https://buttsmithy.com/'
stripUrl = url + 'archives/comic/%s'
firstStripUrl = stripUrl % 'p1'
adult = True

def namer(self, image_url, page_url):
def repl(m):
return "{0}".format(m.group(1).zfill(4))

if page_url == "https://buttsmithy.com/":
page = self.getPage(page_url)
links = page.xpath('//h2[@class="post-title"]/a/@href')
page_url = links[0]

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

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

View check run for this annotation

Jenkins - Dosage / Flake8

W605

NORMAL: invalid escape sequence '\d'

if name == "o-525":
name = "0525"
if name == "0369-2":
name = "0469"
if name == "1404":
name = "0378"
if name == "0338-2":
name = "0339"
if page_url == "https://buttsmithy.com/archives/comic/1186":
name = "0324"
if page_url == "https://buttsmithy.com/archives/comic/1169":
name = "0319"
if page_url == "https://buttsmithy.com/archives/comic/1132":
name = "0313"
if page_url == "https://buttsmithy.com/archives/comic/p-145":
name = "0145-2"
if page_url == "https://buttsmithy.com/archives/comic/p145":
name = "0145-1"

return name


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 f8d5ff7

Please sign in to comment.