From 6ed242a7b0c0593d9f39cb4744438aeb175cff2e Mon Sep 17 00:00:00 2001 From: Techwolf Date: Wed, 3 Jul 2019 00:32:45 -0700 Subject: [PATCH] Add OffWhite --- dosagelib/plugins/o.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/dosagelib/plugins/o.py b/dosagelib/plugins/o.py index 964a0d2f7..ea594039f 100644 --- a/dosagelib/plugins/o.py +++ b/dosagelib/plugins/o.py @@ -7,7 +7,7 @@ from __future__ import absolute_import, division, print_function from re import compile, escape -from ..helpers import bounceStarter +from ..helpers import bounceStarter, indirectStarter from ..scraper import _BasicScraper, _ParserScraper from ..util import tagre from .common import _WordPressScraper, _WPNavi, WP_LATEST_SEARCH @@ -23,6 +23,29 @@ class OctopusPie(_ParserScraper): help = 'Index format: yyyy-mm-dd/nnn-strip-name' +class OffWhite(_ParserScraper): + stripUrl = 'http://off-white.eu/comic/%s/' + firstStripUrl = stripUrl % 'prologue-page-1-2' + url = firstStripUrl + imageSearch = '//img[@class="comic-page"]' + prevSearch = '//a[@rel="prev"]' + latestSearch = '//a[text()="A"]' + starter = indirectStarter + endOfLife = True + + def fetchUrls(self, url, data, urlSearch): + # Fix missing page + if url == self.stripUrl % 'page-37': + return ['http://off-white.eu/ow_v2/wp-content/uploads/2011/01/new-037.jpg'] + return super(OffWhite, self).fetchUrls(url, data, urlSearch) + + def getPrevUrl(self, url, data): + # Fix missing page + if url == self.stripUrl % 'page-37': + return self.stripUrl % 'page-36' + return super(OffWhite, self).getPrevUrl(url, data) + + class Oglaf(_ParserScraper): url = 'http://oglaf.com/' stripUrl = url + '%s/'