dosage/dosagelib/plugins/f.py

269 lines
8.9 KiB
Python
Raw Normal View History

# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: © 2004 Tristan Seligmann and Jonathan Jacobs
# SPDX-FileCopyrightText: © 2012 Bastian Kleineidam
# SPDX-FileCopyrightText: © 2015 Tobias Gruetzmacher
# SPDX-FileCopyrightText: © 2019 Daniel Ring
from re import compile, escape
2012-06-20 19:58:13 +00:00
2012-10-11 10:03:12 +00:00
from ..util import tagre
2023-06-07 06:40:25 +00:00
from ..scraper import ParserScraper, _BasicScraper, _ParserScraper
from ..helpers import indirectStarter, joinPathPartsNamer
from .common import ComicControlScraper, WordPressNaviIn, WordPressScraper
2012-06-20 19:58:13 +00:00
class FalconTwin(_BasicScraper):
url = 'http://www.falcontwin.com/'
stripUrl = url + 'index.html?strip=%s'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % '0'
2012-06-20 19:58:13 +00:00
imageSearch = compile(r'"(strips/.+?)"')
prevSearch = compile(r'"prev"><a href="(index.+?)"')
help = 'Index format: nnn'
class Faneurysm(WordPressNaviIn):
url = 'http://hijinksensue.com/comic/think-only-tree/'
firstStripUrl = 'http://hijinksensue.com/comic/captains-prerogative/'
endOfLife = True
class FantasyRealms(_ParserScraper):
stripUrl = ('https://web.archive.org/web/20161204192651/'
'http://fantasyrealmsonline.com/manga/%s.php')
url = stripUrl % '091'
firstStripUrl = stripUrl % '001'
imageSearch = '//img[contains(@src, "/manga/0")]'
prevSearch = '//a[img[contains(@src, "nav-back")]]'
endOfLife = True
2013-03-06 19:21:10 +00:00
help = 'Index format: nnn'
class FarToTheNorth(ComicControlScraper):
2019-10-26 08:39:03 +00:00
url = 'http://www.farnorthcomic.com/'
stripUrl = url + 'comic/%s'
firstStripUrl = stripUrl % 'don39t-tell'
2016-09-29 22:15:45 +00:00
class FauxPas(_ParserScraper):
url = 'http://www.ozfoxes.net/cgi/pl-fp1.cgi'
stripUrl = url + '?%s'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % '1'
2016-09-29 22:15:45 +00:00
imageSearch = '//img[@name]'
prevSearch = '//a[img[@alt="Previous"]]'
2012-06-20 19:58:13 +00:00
help = 'Index format: nnn'
class FireflyCross(WordPressScraper):
2016-05-02 20:32:14 +00:00
url = 'http://www.fireflycross.pensandtales.com/'
firstStripUrl = url + '?comic=05062002'
class FirstWorldProblems(_ParserScraper):
url = ('https://web.archive.org/web/20150710053456/'
'http://bradcolbow.com/archive/C5/')
stripUrl = url + '%s/'
firstStripUrl = stripUrl % 'P10'
imageSearch = '//div[d:class("entry")]//img'
prevSearch = '//a[d:class("prev")]'
2013-02-06 21:27:40 +00:00
multipleImagesPerStrip = True
endOfLife = True
2013-02-06 21:27:40 +00:00
2012-06-20 19:58:13 +00:00
class FlakyPastry(_BasicScraper):
2013-04-13 18:58:00 +00:00
baseUrl = 'http://flakypastry.runningwithpencils.com/'
url = baseUrl + 'index.php'
stripUrl = baseUrl + 'comic.php?strip_id=%s'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % '0'
2012-06-20 19:58:13 +00:00
imageSearch = compile(r'<img src="(comics/.+?)"')
prevSearch = compile(r'<a href="(.+?)".+?btn_back')
help = 'Index format: nnnn'
2012-12-04 06:02:40 +00:00
class Flemcomics(_ParserScraper):
url = ('https://web.archive.org/web/20180414110349/'
'http://www.flemcomics.com/')
stripUrl = url + 'd/%s.html'
firstStripUrl = stripUrl % '19980101'
imageSearch = '//img[d:class("ksc")]'
prevSearch = '//a[@rel="prev"]'
endOfLife = True
2012-12-08 20:30:51 +00:00
help = 'Index format: yyyymmdd'
2023-09-18 06:18:31 +00:00
class Flipside(ParserScraper):
url = 'https://www.flipsidecomics.com/comic.php'
stripUrl = url + '?i=%s'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % '1'
2019-07-05 03:04:27 +00:00
imageSearch = '//img[contains(@src, "comic/")]'
prevSearch = '//a[@rel="prev"]'
2020-04-19 08:50:00 +00:00
adult = True
2012-06-20 19:58:13 +00:00
help = 'Index format: nnnn'
2016-05-06 23:50:10 +00:00
class FonFlatter(_ParserScraper):
2016-05-16 21:16:29 +00:00
url = 'https://www.fonflatter.de/'
2013-03-12 19:49:46 +00:00
stripUrl = url + '%s/'
2016-05-16 21:16:29 +00:00
firstStripUrl = url + '2005/09/20/01-begegnung-mit-batman/'
2013-03-12 19:49:46 +00:00
lang = 'de'
2016-05-06 23:50:10 +00:00
imageSearch = r'//img[re:test(@src, "/fred_\d+")]'
prevSearch = '//a[@rel="prev"]'
2013-03-12 19:49:46 +00:00
help = 'Index format: yyyy/mm/dd/number-stripname'
def shouldSkipUrl(self, url, data):
2013-03-13 17:31:58 +00:00
return url in (
self.stripUrl % "2006/11/30/adventskalender",
self.stripUrl % "2006/09/21/danke",
self.stripUrl % "2006/08/23/zgf-zuweilen-gestellte-fragen",
self.stripUrl % "2005/10/19/naq-never-asked-questions",
)
2013-03-13 17:31:58 +00:00
2013-03-12 19:49:46 +00:00
class ForestHill(WordPressScraper):
url = 'https://www.foresthillcomic.org/'
class ForLackOfABetterComic(_ParserScraper):
url = 'https://web.archive.org/web/20200224010115/http://forlackofabettercomic.com/'
2013-04-10 16:20:39 +00:00
stripUrl = url + '?id=%s'
firstStripUrl = stripUrl % '1'
imageSearch = '//img[@id="comicimg"]'
prevSearch = '//a[text()="Prev"]'
2013-04-10 16:20:39 +00:00
help = 'Index format: number'
endOfLife = True
2013-04-10 16:20:39 +00:00
2023-06-07 06:40:25 +00:00
class FoxDad(ParserScraper):
2019-08-17 22:33:50 +00:00
url = 'https://foxdad.com/'
stripUrl = url + 'post/%s'
firstStripUrl = stripUrl % '149683014997/some-people-are-just-different-support-the-comic'
2023-06-07 06:40:25 +00:00
imageSearch = '//figure[@class="photo-hires-item"]//img'
2019-08-17 22:33:50 +00:00
prevSearch = '//a[@class="previous-button"]'
def namer(self, imageUrl, pageUrl):
page = self.getPage(pageUrl)
2024-03-17 20:44:46 +00:00
post = self.match(page, '//li[d:class("timestamp")]/a/@href')[0]
2023-06-07 06:40:25 +00:00
post = post.replace('https://foxdad.com/post/', '')
if '-consider-support' in post:
post = post.split('-consider-support')[0]
2019-08-17 22:33:50 +00:00
return post.replace('/', '-')
2019-07-03 07:14:22 +00:00
class FoxTails(_ParserScraper):
stripUrl = 'https://web.archive.org/web/20200920134555/http:/foxtails.magickitsune.com/strips/%s.html'
2019-07-03 07:14:22 +00:00
url = stripUrl % 'current'
firstStripUrl = stripUrl % '20041024'
imageSearch = '//img[contains(@src, "img/2")]'
prevSearch = '//a[./img[contains(@src, "prev")]]'
endOfLife = True
def getPrevUrl(self, url, data):
# Include pre-reboot archive
if url == self.stripUrl % '20090906':
return self.stripUrl % '20090704'
return super().getPrevUrl(url, data)
2019-07-03 07:14:22 +00:00
2015-08-07 11:37:10 +00:00
class Fragile(_ParserScraper):
url = ('https://web.archive.org/web/20190308203109/'
'http://www.fragilestory.com/')
2016-01-03 01:08:49 +00:00
imageSearch = '//div[@id="comic_strip"]/a[@class="nobg"]/img'
prevSearch = '//div[@id="nav_comic_a"]/a[2]'
firstStripUrl = url + 'strips/chapter_01'
endOfLife = True
2015-08-07 11:37:10 +00:00
class FredoAndPidjin(ParserScraper):
url = 'https://www.pidjin.net/'
2013-04-10 21:57:09 +00:00
stripUrl = url + '%s/'
firstStripUrl = stripUrl % '2006/02/19/goofy-monday'
imageSearch = '//div[d:class("episode")]//img'
2012-12-04 06:02:40 +00:00
multipleImagesPerStrip = True
prevSearch = '//span[d:class("prev")]/a'
latestSearch = '//section[d:class("latest")]//a'
starter = indirectStarter
namer = joinPathPartsNamer(pageparts=(0, 1, 2), imageparts=(-1,))
2013-03-11 21:45:30 +00:00
2019-11-03 23:16:25 +00:00
2019-07-17 06:11:27 +00:00
class Freefall(_ParserScraper):
url = 'http://freefall.purrsia.com/'
stripUrl = url + 'ff%d/%s%05d.htm'
firstStripUrl = stripUrl % (100, 'fv', 1)
imageSearch = '//img[contains(@src, "/ff")]'
prevSearch = '//a[text()="Previous"]'
multipleImagesPerStrip = True
def getIndexStripUrl(self, index):
# Get comic strip URL from index
index = int(index)
chapter = index + 100 - (index % 100)
color = 'fc' if index > 1252 else 'fv'
return self.stripUrl % (chapter, color, index)
2019-07-06 06:21:18 +00:00
class FreighterTails(_ParserScraper):
url = 'http://www.mzzkiti.com/'
stripUrl = url + 'log%s.htm'
firstStripUrl = stripUrl % '001'
imageSearch = ('//img[contains(@src, "Strip")]',
'//img[contains(@src, "Caption")]')
prevSearch = '//a[./img[contains(@src, "prev")]]'
endOfLife = True
class FriendsYouAreStuckWith(WordPressScraper):
2020-03-07 02:06:30 +00:00
url = 'http://friendsyasw.com/'
stripUrl = url + 'comic/%s/'
firstStripUrl = stripUrl % 'wanted'
def namer(self, imageUrl, pageUrl):
page = self.getPage(pageUrl)
2024-03-17 20:44:46 +00:00
strip = self.match(page, '//div[@id="comic-wrap"]/@class')[0].replace('comic-id-', '')
2020-03-07 02:06:30 +00:00
return strip + '_' + imageUrl.rstrip('/').rsplit('/', 1)[-1]
2013-03-11 21:45:30 +00:00
class FullFrontalNerdity(_BasicScraper):
url = 'http://ffn.nodwick.com/'
rurl = escape(url)
2013-03-11 21:45:30 +00:00
stripUrl = url + '?p=%s'
firstStripUrl = stripUrl % '6'
imageSearch = compile(tagre("img", "src", r'(%sffnstrips/\d+-\d+-\d+\.[^"]+)' % rurl))
prevSearch = compile(tagre("a", "href", r'(%s\?p=\d+)' % rurl, after="prev"))
2013-03-11 21:45:30 +00:00
help = 'Index format: number'
class FunInJammies(WordPressScraper):
url = ('https://web.archive.org/web/20170205105241/'
'http://funinjammies.com/')
2013-03-11 21:45:30 +00:00
stripUrl = url + 'comic.php?issue=%s'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % '1'
prevSearch = '//a[text()="< Prev"]'
endOfLife = True
2013-03-11 21:45:30 +00:00
help = 'Index format: n (unpadded)'
2019-07-12 08:40:57 +00:00
class FurPiled(ParserScraper):
stripUrl = ('https://web.archive.org/web/20160404074145/'
'http://www.liondogworks.com/images/fp-%03d.jpg')
2019-08-25 03:56:41 +00:00
url = stripUrl % 427
firstStripUrl = stripUrl % 1
endOfLife = True
2019-08-25 03:56:41 +00:00
def getPrevUrl(self, url, data):
# Skip missing pages
nextStrip = int(url.rsplit('/', 1)[-1].split('.', 1)[0].replace('fp-', '')) - 1
if nextStrip in [407, 258, 131, 110, 97, 31]:
nextStrip = nextStrip - 1
return self.stripUrl % nextStrip
def extract_image_urls(self, url, data):
2019-08-25 03:56:41 +00:00
# URLs are direct links to images
return [url]
2019-07-12 08:40:57 +00:00
class FurthiaHigh(_ParserScraper):
url = 'http://furthiahigh.concessioncomic.com/'
stripUrl = url + 'index.php?pid=%s'
firstStripUrl = stripUrl % '20080128'
imageSearch = '//img[contains(@alt, "Comic")]'
prevSearch = '//a[./img[@alt="Previous"]]'
multipleImagesPerStrip = True