dosage/dosagelib/plugins/a.py

393 lines
13 KiB
Python
Raw Normal View History

# SPDX-License-Identifier: MIT
2024-02-18 23:53:36 +00:00
# SPDX-FileCopyrightText: © 2004 Tristan Seligmann and Jonathan Jacobs
# SPDX-FileCopyrightText: © 2012 Bastian Kleineidam
# SPDX-FileCopyrightText: © 2015 Tobias Gruetzmacher
# SPDX-FileCopyrightText: © 2019 Daniel Ring
2023-09-24 05:23:37 +00:00
from re import compile, escape, sub, MULTILINE
2012-09-26 12:42:28 +00:00
from ..util import tagre
2024-02-18 23:53:36 +00:00
from ..scraper import ParserScraper, _BasicScraper, _ParserScraper
from ..helpers import joinPathPartsNamer, bounceStarter, indirectStarter
from .common import WordPressScraper, WordPressNavi, WordPressWebcomic
2019-07-10 04:18:09 +00:00
2024-02-18 23:53:36 +00:00
class AbstruseGoose(ParserScraper):
url = 'https://web.archive.org/web/20230930172141/https://abstrusegoose.com/'
starter = bounceStarter
stripUrl = url + '%s'
firstStripUrl = stripUrl % '1'
2020-01-09 21:59:12 +00:00
imageSearch = '//img[contains(@src, "/strips/")]'
textSearch = imageSearch + '/@title'
textOptional = True
prevSearch = '//a[contains(text(), "Previous")]'
nextSearch = '//a[contains(text(), "Next")]'
2012-06-20 19:58:13 +00:00
help = 'Index format: n (unpadded)'
2020-01-09 21:59:12 +00:00
def namer(self, imageurl, pageurl):
index = int(pageurl.rsplit('/', 1)[1])
name = imageurl.rsplit('/', 1)[1]
2012-06-20 19:58:13 +00:00
return 'c%03d-%s' % (index, name)
class AbsurdNotions(_BasicScraper):
baseUrl = 'http://www.absurdnotions.org/'
url = baseUrl + 'page129.html'
stripUrl = baseUrl + 'page%s.html'
firstStripUrl = stripUrl % '1'
imageSearch = compile(tagre('img', 'src', r'(an[^"]+)'))
multipleImagesPerStrip = True
prevSearch = compile(tagre('a', 'href', r'([^"]+)') +
2018-05-22 22:54:40 +00:00
tagre('img', 'src', r'nprev\.gif'))
help = 'Index format: n (unpadded)'
2024-02-18 23:53:36 +00:00
class Achewood(ParserScraper):
baseUrl = 'https://achewood.com/'
stripUrl = baseUrl + '%s/title.html'
url = stripUrl % '2016/12/25'
firstStripUrl = stripUrl % '2001/10/01'
imageSearch = '//img[d:class("comicImage")]'
prevSearch = '//a[d:class("comic_prev")]'
namer = joinPathPartsNamer(pageparts=range(0, 2))
help = 'Index format: yyyy/mm/dd'
endOfLife = True
2013-04-10 16:36:33 +00:00
2019-07-13 08:49:30 +00:00
class AdventuresOfFifne(_ParserScraper):
stripUrl = 'http://fifine.purrsia.com/%s.html'
url = stripUrl % 'COMICS'
firstStripUrl = stripUrl % 'Fifine01'
imageSearch = '//img[contains(@src, "jpg")]'
prevSearch = '//a[text()="PREVIOUS"]'
multipleImagesPerStrip = True
endOfLife = True
def namer(self, imageUrl, pageUrl):
# Prepend chapter number to image filename
filename = imageUrl.rsplit('/', 1)[-1]
if filename[0] == 'p':
filename = filename.replace('p', '1_p')
filename = filename.replace('TIL', '2_TIL')
filename = filename.replace('NS', '3_NS')
filename = filename.replace('LG', '4_LG')
filename = filename.replace('WM', '5_WM')
return filename
def getPrevUrl(self, url, data):
# Fix broken navigation links
if url == self.stripUrl % 'lg06':
return self.stripUrl % 'lg05'
return super(AdventuresOfFifne, self).getPrevUrl(url, data)
class AfterStrife(WordPressNavi):
2013-04-13 18:58:00 +00:00
baseUrl = 'http://afterstrife.com/'
stripUrl = baseUrl + '?p=%s'
2013-04-10 21:57:09 +00:00
url = stripUrl % '262'
firstStripUrl = stripUrl % '1'
2013-04-10 16:36:33 +00:00
help = 'Index format: nnn'
endOfLife = True
2013-04-10 16:36:33 +00:00
class AGirlAndHerFed(_ParserScraper):
url = 'https://agirlandherfed.com/'
2013-04-10 16:36:33 +00:00
stripUrl = url + '1.%s.html'
firstStripUrl = stripUrl % '1'
imageSearch = '//div[@id="comic-image"]/img'
prevSearch = '//div[@id="comic-nav"]/a[.//img[contains(@src, "back")]]'
2013-04-10 16:36:33 +00:00
help = 'Index format: nnn'
class AhoiPolloi(_ParserScraper):
2016-04-07 21:21:31 +00:00
url = 'https://ahoipolloi.blogger.de/'
2013-03-07 22:51:55 +00:00
stripUrl = url + '?day=%s'
firstStripUrl = stripUrl % '20060306'
2013-03-07 22:51:55 +00:00
multipleImagesPerStrip = True
2013-03-08 21:33:05 +00:00
lang = 'de'
imageSearch = '//img[contains(@src, "/static/antville/ahoipolloi/")]'
prevSearch = '//a[contains(@href, "/?day=")]'
2013-03-07 22:51:55 +00:00
help = 'Index format: yyyymmdd'
class AirForceBlues(WordPressScraper):
2024-02-18 23:53:36 +00:00
url = 'https://web.archive.org/web/20210102113825/http://farvatoons.com/'
2016-04-07 21:21:31 +00:00
firstStripUrl = url + 'comic/in-texas-there-are-texans/'
2013-04-10 16:36:33 +00:00
2013-03-06 19:21:10 +00:00
class ALessonIsLearned(_BasicScraper):
url = 'http://www.alessonislearned.com/'
prevSearch = compile(tagre("a", "href", r"(index\.php\?comic=\d+)",
quote="'") + r"[^>]+previous")
2013-03-06 19:21:10 +00:00
stripUrl = url + 'index.php?comic=%s'
firstStripUrl = stripUrl % '1'
2013-03-06 19:21:10 +00:00
imageSearch = compile(tagre("img", "src", r"(cmx/lesson\d+\.[a-z]+)"))
help = 'Index format: nnn'
2023-09-24 05:23:37 +00:00
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!"]'
starter = indirectStarter
endOfLife = True
2012-06-20 19:58:13 +00:00
class AlienLovesPredator(_BasicScraper):
url = 'http://alienlovespredator.com/'
stripUrl = url + '%s/'
firstStripUrl = stripUrl % '2004/10/12/unavoidable-delay'
imageSearch = compile(tagre("img", "src", r'([^"]+)',
after='border="1" alt="" width="750"'))
prevSearch = compile(tagre("a", "href", r'([^"]+)', after="prev"))
help = 'Index format: yyyy/mm/dd/name'
2012-06-20 19:58:13 +00:00
class AlienShores(WordPressScraper):
2016-04-07 21:21:31 +00:00
url = 'http://alienshores.com/alienshores_band/'
firstStripUrl = url + 'AScomic/updated-cover/'
2013-04-10 16:36:33 +00:00
class AllTheGrowingThings(WordPressScraper):
url = ('https://web.archive.org/web/20160611212229/'
'http://growingthings.typodmary.com/')
2013-04-10 16:36:33 +00:00
stripUrl = url + '%s/'
firstStripUrl = stripUrl % 'all-the-growing-things'
endOfLife = True
2013-04-10 16:36:33 +00:00
2023-06-07 04:00:32 +00:00
class AlphaLuna(ParserScraper):
url = 'https://alphalunacomic.net/'
2019-06-24 05:24:20 +00:00
stripUrl = url + 'comic/%s/'
firstStripUrl = stripUrl % 'issue-1-cover'
imageSearch = '//main[@id="comic"]//img'
prevSearch = '//a[@rel="prev"]'
2023-06-07 04:00:32 +00:00
class AlphaLunaSpanish(ParserScraper):
2013-02-20 22:34:55 +00:00
name = 'AlphaLuna/Spanish'
2013-03-08 21:33:05 +00:00
lang = 'es'
2023-06-07 04:00:32 +00:00
url = 'https://alphalunacomic.net/spanish/'
2019-06-24 05:24:20 +00:00
stripUrl = url + 'comic/%s/'
firstStripUrl = stripUrl % 'issue-1-cover'
imageSearch = '//main[@id="comic"]//img'
prevSearch = '//a[@rel="prev"]'
2013-02-20 22:34:55 +00:00
2019-06-24 05:28:30 +00:00
class Altermeta(_ParserScraper):
url = 'http://altermeta.net/'
stripUrl = url + 'archive.php?comic=%s'
firstStripUrl = stripUrl % '0'
2019-06-24 05:28:30 +00:00
imageSearch = '//img[contains(@src, "comics/")]'
prevSearch = '//a[./img[contains(@src, "back")]]'
nextSearch = '//a[./img[contains(@src, "forward")]]'
starter = bounceStarter
2012-06-20 19:58:13 +00:00
help = 'Index format: n (unpadded)'
2019-06-24 05:28:30 +00:00
def namer(self, imageUrl, pageUrl):
return pageUrl.rsplit('=', 1)[-1] + '_' + imageUrl.rsplit('/', 1)[-1]
2012-06-20 19:58:13 +00:00
2020-01-09 16:41:07 +00:00
class AltermetaOld(_ParserScraper):
2013-04-10 21:57:09 +00:00
url = Altermeta.url + 'oldarchive/index.php'
stripUrl = Altermeta.url + 'oldarchive/archive.php?comic=%s'
firstStripUrl = stripUrl % '0'
2020-01-09 16:41:07 +00:00
imageSearch = '//img[contains(@src, "comics/")]'
prevSearch = '//a[text()="Back"]'
help = 'Index format: n (unpadded)'
2012-06-20 19:58:13 +00:00
2024-02-18 23:53:36 +00:00
class AmazingSuperPowers(WordPressNavi):
url = 'https://www.amazingsuperpowers.com/'
stripUrl = url + '%s/'
firstStripUrl = stripUrl % '2007/09/heredity'
2024-02-18 23:53:36 +00:00
imageSearch = '//div[d:class("comicpane")]/img'
2012-12-28 04:41:26 +00:00
def shouldSkipUrl(self, url, data):
2013-05-25 21:24:33 +00:00
"""Skip pages without images."""
return url in (
# video
self.stripUrl % '2013/05/orbital-deathray-kickstarter',
)
2012-12-28 04:41:26 +00:00
2019-07-14 06:31:24 +00:00
class AmbersNoBrainers(_ParserScraper):
baseUrl = 'https://foxyverse.com/'
url = baseUrl + 'comics/'
stripUrl = baseUrl + 'ambers-no-brainers-%s/'
firstStripUrl = stripUrl % '1'
imageSearch = '//img[contains(@src, "Page")]'
latestSearch = '//a[contains(@href, "ambers-no-brainers")]'
starter = indirectStarter
def getPrevUrl(self, url, data):
# Replace missing navigation links
pageNum = int(url.rstrip('/').rsplit('-', 1)[-1])
return self.stripUrl % str(pageNum - 1)
class Amya(WordPressScraper):
url = 'http://www.amyachronicles.com/'
2024-03-17 20:44:46 +00:00
class Angband(ParserScraper):
2013-04-10 16:36:33 +00:00
url = 'http://angband.calamarain.net/'
2021-01-18 00:25:03 +00:00
stripUrl = url + '%s'
imageSearch = '//img'
multipleImagesPerStrip = True
endOfLife = True
def starter(self):
page = self.getPage(self.url)
2024-03-17 20:44:46 +00:00
self.pages = self.match(page, '//p/a[not(contains(@href, "cast"))]/@href')
2021-01-18 00:25:03 +00:00
self.firstStripUrl = self.pages[0]
return self.pages[-1]
def getPrevUrl(self, url, data):
return self.pages[self.pages.index(url) - 1]
2013-04-10 16:36:33 +00:00
2016-04-07 21:21:31 +00:00
class Annyseed(_ParserScraper):
baseUrl = ('https://web.archive.org/web/20190511031451/'
'http://www.mirrorwoodcomics.com/')
2016-04-07 21:21:31 +00:00
stripUrl = baseUrl + 'Annyseed%s.htm'
url = stripUrl % 'Latest'
firstStripUrl = stripUrl % '000'
2016-04-07 21:21:31 +00:00
imageSearch = '//div/img[contains(@src, "Annyseed")]'
prevSearch = '//a[img[@name="Previousbtn"]]'
endOfLife = True
2013-04-10 16:36:33 +00:00
help = 'Index format: nnn'
2017-02-05 23:05:05 +00:00
FIX_RE = compile(r'Annyseed/Finished%20For%20Print/')
def imageUrlModifier(self, image_url, data):
return self.FIX_RE.sub('', image_url)
2013-04-10 16:36:33 +00:00
def link_modifier(self, fromurl, tourl):
"""Fix circular link."""
if 'Annyseed150' in fromurl and 'Annyseed150' in tourl:
return self.stripUrl % '149'
return tourl
2013-04-10 16:36:33 +00:00
2018-05-22 22:54:40 +00:00
2024-03-17 20:44:46 +00:00
class AntiheroForHire(ParserScraper):
2019-08-03 07:10:29 +00:00
stripUrl = 'https://www.giantrobot.club/antihero-for-hire/%s'
firstStripUrl = stripUrl % '2016/6/8/entrance-vigil'
url = firstStripUrl
imageSearch = '//div[@class="image-wrapper"]//img[not(@class="thumb-image")]'
multipleImagesPerStrip = True
endOfLife = True
def starter(self):
# Build list of chapters for navigation
page = self.getPage(self.url)
2024-03-17 20:44:46 +00:00
self.chapters = self.match(page, '//ul[d:class("archive-group-list")]//a[d:class("archive-item-link")]/@href')
2020-04-29 08:39:17 +00:00
return self.chapters[0]
2019-08-03 07:10:29 +00:00
def getPrevUrl(self, url, data):
# Retrieve previous chapter from list
2020-04-29 08:39:17 +00:00
index = self.chapters.index(url) + 1
return self.chapters[index] if index < len(self.chapters) else None
2019-08-03 07:10:29 +00:00
2012-06-20 19:58:13 +00:00
class AppleGeeks(_BasicScraper):
url = 'http://www.applegeeks.com/'
stripUrl = url + 'comics/viewcomic.php?issue=%s'
firstStripUrl = stripUrl % '1'
2012-12-02 17:35:06 +00:00
imageSearch = compile(tagre("img", "src", r'((?:/comics/)?issue\d+\.jpg)'))
2012-06-20 19:58:13 +00:00
prevSearch = compile(r'<div class="caption">Previous Comic</div>\s*<p><a href="([^"]+)">', MULTILINE)
allow_errors = (404,)
2012-06-20 19:58:13 +00:00
help = 'Index format: n (unpadded)'
2013-04-25 18:37:27 +00:00
class ARedTailsDream(_BasicScraper):
baseUrl = 'http://www.minnasundberg.fi/'
stripUrl = baseUrl + 'comic/page%s.php'
firstStripUrl = stripUrl % '00'
url = baseUrl + 'comic/recent.php'
imageSearch = compile(tagre('img', 'src', r'(chapter.+?/eng[^"]*)'))
prevSearch = compile(tagre('a', 'href', r'(page\d+\.php)') +
tagre("img", "src", r'.*?aprev.*?'))
2013-04-25 18:37:27 +00:00
help = 'Index format: nn'
class ArtificialIncident(WordPressWebcomic):
2019-08-27 07:55:38 +00:00
url = 'https://www.artificialincident.com/'
stripUrl = url + 'comic/%s/'
firstStripUrl = stripUrl % 'issue-one-life-changing'
2024-03-17 20:44:46 +00:00
class AstronomyPOTD(ParserScraper):
2016-04-07 21:21:31 +00:00
baseUrl = 'http://apod.nasa.gov/apod/'
2013-04-13 18:58:00 +00:00
url = baseUrl + 'astropix.html'
starter = bounceStarter
2013-04-13 18:58:00 +00:00
stripUrl = baseUrl + 'ap%s.html'
firstStripUrl = stripUrl % '061012'
2016-04-07 21:21:31 +00:00
imageSearch = '//a/img'
2012-12-07 23:45:18 +00:00
multipleImagesPerStrip = True
2016-04-07 21:21:31 +00:00
prevSearch = '//a[text()="<"]'
nextSearch = '//a[text()=">"]'
2012-06-20 19:58:13 +00:00
help = 'Index format: yymmdd'
def shouldSkipUrl(self, url, data):
"""Skip pages without images."""
2024-03-17 20:44:46 +00:00
return self.match(data, '//iframe') # videos
def namer(self, image_url, page_url):
2016-04-07 21:21:31 +00:00
return '%s-%s' % (page_url.split('/')[-1].split('.')[0][2:],
image_url.split('/')[-1].split('.')[0])
class ATaleOfTails(WordPressScraper):
2019-06-20 05:00:34 +00:00
url = 'http://www.feretta.net/'
stripUrl = url + 'comic/%s/'
firstStripUrl = stripUrl % 'a-tale-of-tails-1-0'
adult = True
class Awaken(ParserScraper):
url = "https://www.awakencomic.com/"
stripUrl = url + 'comic/%s'
firstStripUrl = stripUrl % 'comic-cover'
imageSearch = '//div[@id="cc-comicbody"]//img'
prevSearch = '//a[@rel="prev"]'
help = 'Index format: chapter-n-page-n (unpadded)'
class AwkwardZombie(ParserScraper):
url = 'https://www.awkwardzombie.com/'
stripUrl = url + 'awkward-zombie/%s'
firstStripUrl = stripUrl % 'coin-battle'
imageSearch = '//div[@id="cc-comicbody"]//img'
prevSearch = '//a[@rel="prev"]'
help = 'Index format: variable :('
class AxeCop(WordPressScraper):
url = 'http://axecop.com/comic/season-two/'