# 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 from ..util import tagre from ..scraper import ParserScraper, _BasicScraper, _ParserScraper from ..helpers import indirectStarter, joinPathPartsNamer from .common import ComicControlScraper, WordPressNaviIn, WordPressScraper class FalconTwin(_BasicScraper): url = 'http://www.falcontwin.com/' stripUrl = url + 'index.html?strip=%s' firstStripUrl = stripUrl % '0' imageSearch = compile(r'"(strips/.+?)"') prevSearch = compile(r'"prev"> 1252 else 'fv' return self.stripUrl % (chapter, color, index) 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): url = 'http://friendsyasw.com/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % 'wanted' def namer(self, imageUrl, pageUrl): page = self.getPage(pageUrl) strip = self.match(page, '//div[@id="comic-wrap"]/@class')[0].replace('comic-id-', '') return strip + '_' + imageUrl.rstrip('/').rsplit('/', 1)[-1] class FullFrontalNerdity(_BasicScraper): url = 'http://ffn.nodwick.com/' rurl = escape(url) 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")) help = 'Index format: number' class FunInJammies(WordPressScraper): url = ('https://web.archive.org/web/20170205105241/' 'http://funinjammies.com/') stripUrl = url + 'comic.php?issue=%s' firstStripUrl = stripUrl % '1' prevSearch = '//a[text()="< Prev"]' endOfLife = True help = 'Index format: n (unpadded)' class FurPiled(ParserScraper): stripUrl = ('https://web.archive.org/web/20160404074145/' 'http://www.liondogworks.com/images/fp-%03d.jpg') url = stripUrl % 427 firstStripUrl = stripUrl % 1 endOfLife = True 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): # URLs are direct links to images return [url] 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