From c5f57288ec22e25324ed4d65fb4844fbc2a1000c Mon Sep 17 00:00:00 2001 From: Techwolf Date: Thu, 18 Jul 2019 01:30:21 -0700 Subject: [PATCH] Refactor WP_LATEST_SEARCH into class variable of WordPressScraper --- dosagelib/plugins/a.py | 3 +-- dosagelib/plugins/common.py | 4 +--- dosagelib/plugins/e.py | 4 +--- dosagelib/plugins/l.py | 4 +--- dosagelib/plugins/n.py | 3 +-- dosagelib/plugins/o.py | 3 +-- dosagelib/plugins/s.py | 3 +-- dosagelib/plugins/webcomicfactory.py | 3 +-- 8 files changed, 8 insertions(+), 19 deletions(-) diff --git a/dosagelib/plugins/a.py b/dosagelib/plugins/a.py index 247031bad..d46e58cff 100644 --- a/dosagelib/plugins/a.py +++ b/dosagelib/plugins/a.py @@ -10,7 +10,7 @@ from re import compile, escape, MULTILINE from ..util import tagre from ..scraper import _BasicScraper, _ParserScraper from ..helpers import regexNamer, bounceStarter, indirectStarter -from .common import _WordPressScraper, _WPNavi, _WPNaviIn, WP_LATEST_SEARCH +from .common import _WordPressScraper, _WPNavi, _WPNaviIn class AbbysAgency(_WordPressScraper): @@ -380,7 +380,6 @@ class ARedTailsDream(_BasicScraper): class Ashes(_WordPressScraper): url = 'http://www.flowerlarkstudios.com/comicpage/prologue/10232009/' firstStripUrl = url - latestSearch = WP_LATEST_SEARCH starter = indirectStarter diff --git a/dosagelib/plugins/common.py b/dosagelib/plugins/common.py index 0f152441c..6167ce478 100644 --- a/dosagelib/plugins/common.py +++ b/dosagelib/plugins/common.py @@ -14,13 +14,11 @@ from ..helpers import indirectStarter, xpath_class # expression is for which comics. -WP_LATEST_SEARCH = '//a[%s]' % xpath_class('comic-nav-last') - - class _WordPressScraper(_ParserScraper): imageSearch = '//div[@id="comic"]//img' prevSearch = '//a[%s]' % xpath_class('comic-nav-previous') nextSearch = '//a[%s]' % xpath_class('comic-nav-next') + latestSearch = '//a[%s]' % xpath_class('comic-nav-last') class _WPNavi(_WordPressScraper): diff --git a/dosagelib/plugins/e.py b/dosagelib/plugins/e.py index 8197260f7..0c9277786 100644 --- a/dosagelib/plugins/e.py +++ b/dosagelib/plugins/e.py @@ -11,7 +11,7 @@ from re import compile, escape, IGNORECASE from ..helpers import bounceStarter, indirectStarter, xpath_class from ..scraper import _BasicScraper, _ParserScraper from ..util import tagre -from .common import _ComicControlScraper, _WordPressScraper, _WPNavi, WP_LATEST_SEARCH +from .common import _ComicControlScraper, _WordPressScraper, _WPNavi class EarthsongSaga(_ParserScraper): @@ -30,7 +30,6 @@ class EarthsongSaga(_ParserScraper): class EasilyAmused(_WordPressScraper): url = 'http://www.flowerlarkstudios.com/comicpage/college-daze/ea01/' firstStripUrl = url - latestSearch = WP_LATEST_SEARCH starter = indirectStarter @@ -123,7 +122,6 @@ class Erstwhile(_WPNavi): class Eryl(_WordPressScraper): url = 'http://www.flowerlarkstudios.com/comicpage/prologue-migration/page-i/' firstStripUrl = url - latestSearch = WP_LATEST_SEARCH starter = indirectStarter diff --git a/dosagelib/plugins/l.py b/dosagelib/plugins/l.py index df724e54b..b4cb7c66d 100644 --- a/dosagelib/plugins/l.py +++ b/dosagelib/plugins/l.py @@ -10,8 +10,7 @@ from re import compile, escape from ..scraper import _BasicScraper, _ParserScraper from ..helpers import bounceStarter, indirectStarter from ..util import tagre -from .common import (_ComicControlScraper, _WordPressScraper, _WPNaviIn, - WP_LATEST_SEARCH) +from .common import _ComicControlScraper, _WordPressScraper, _WPNaviIn class Lackadaisy(_ParserScraper): @@ -34,7 +33,6 @@ class Lackadaisy(_ParserScraper): class Laiyu(_WordPressScraper): url = 'http://www.flowerlarkstudios.com/comicpage/preliminary-concepts/welcome/' firstStripUrl = url - latestSearch = WP_LATEST_SEARCH starter = indirectStarter diff --git a/dosagelib/plugins/n.py b/dosagelib/plugins/n.py index 5a0ffeca4..b7344c7ca 100644 --- a/dosagelib/plugins/n.py +++ b/dosagelib/plugins/n.py @@ -10,7 +10,7 @@ from re import compile, escape from ..scraper import _BasicScraper, _ParserScraper from ..helpers import indirectStarter from ..util import tagre -from .common import _ComicControlScraper, _WordPressScraper, _WPNavi, WP_LATEST_SEARCH +from .common import _ComicControlScraper, _WordPressScraper, _WPNavi class Namesake(_ComicControlScraper): @@ -156,7 +156,6 @@ class NobodyScores(_BasicScraper): class NoMoreSavePoints(_WordPressScraper): url = 'http://www.flowerlarkstudios.com/comicpage/no-more-save-points/mushroom-hopping/' firstStripUrl = url - latestSearch = WP_LATEST_SEARCH starter = indirectStarter diff --git a/dosagelib/plugins/o.py b/dosagelib/plugins/o.py index 47848662d..2595306cf 100644 --- a/dosagelib/plugins/o.py +++ b/dosagelib/plugins/o.py @@ -10,7 +10,7 @@ from re import compile, escape from ..helpers import bounceStarter, indirectStarter from ..scraper import _BasicScraper, _ParserScraper from ..util import tagre -from .common import _WordPressScraper, _WPNavi, WP_LATEST_SEARCH +from .common import _WordPressScraper, _WPNavi class OctopusPie(_ParserScraper): @@ -139,7 +139,6 @@ class OrderOfTheBlackDog(_WordPressScraper): url = 'http://orderoftheblackdog.com/' stripUrl = url + 'comic/%s/' firstStripUrl = stripUrl % 'issue-1-cover' - nextSearch = WP_LATEST_SEARCH starter = bounceStarter def namer(self, imageUrl, pageUrl): diff --git a/dosagelib/plugins/s.py b/dosagelib/plugins/s.py index 448eb9234..4ea42640d 100644 --- a/dosagelib/plugins/s.py +++ b/dosagelib/plugins/s.py @@ -12,7 +12,7 @@ import datetime from ..scraper import _BasicScraper, _ParserScraper from ..helpers import indirectStarter, bounceStarter, joinPathPartsNamer, xpath_class from ..util import tagre -from .common import _ComicControlScraper, _WordPressScraper, _WPNavi, WP_LATEST_SEARCH +from .common import _ComicControlScraper, _WordPressScraper, _WPNavi class SabrinaOnline(_BasicScraper): @@ -312,7 +312,6 @@ class SnowFlame(_WordPressScraper): stripUrl = url + '?comic=snowflame-%s-%s' firstStripUrl = stripUrl % ('01', '01') starter = bounceStarter - nextSearch = WP_LATEST_SEARCH help = 'Index format: chapter-page' def getIndexStripUrl(self, index): diff --git a/dosagelib/plugins/webcomicfactory.py b/dosagelib/plugins/webcomicfactory.py index fa3f0d9dc..71ca66f4c 100644 --- a/dosagelib/plugins/webcomicfactory.py +++ b/dosagelib/plugins/webcomicfactory.py @@ -5,13 +5,12 @@ from __future__ import absolute_import, division, print_function -from .common import _WordPressScraper, WP_LATEST_SEARCH +from .common import _WordPressScraper from ..helpers import indirectStarter class WebcomicFactory(_WordPressScraper): starter = indirectStarter - latestSearch = WP_LATEST_SEARCH def __init__(self, name, url): super(WebcomicFactory, self).__init__(name)