Refactor WP_LATEST_SEARCH into class variable of WordPressScraper

This commit is contained in:
Techwolf 2019-07-18 01:30:21 -07:00 committed by Tobias Gruetzmacher
parent d732767e02
commit c5f57288ec
8 changed files with 8 additions and 19 deletions

View file

@ -10,7 +10,7 @@ from re import compile, escape, MULTILINE
from ..util import tagre from ..util import tagre
from ..scraper import _BasicScraper, _ParserScraper from ..scraper import _BasicScraper, _ParserScraper
from ..helpers import regexNamer, bounceStarter, indirectStarter from ..helpers import regexNamer, bounceStarter, indirectStarter
from .common import _WordPressScraper, _WPNavi, _WPNaviIn, WP_LATEST_SEARCH from .common import _WordPressScraper, _WPNavi, _WPNaviIn
class AbbysAgency(_WordPressScraper): class AbbysAgency(_WordPressScraper):
@ -380,7 +380,6 @@ class ARedTailsDream(_BasicScraper):
class Ashes(_WordPressScraper): class Ashes(_WordPressScraper):
url = 'http://www.flowerlarkstudios.com/comicpage/prologue/10232009/' url = 'http://www.flowerlarkstudios.com/comicpage/prologue/10232009/'
firstStripUrl = url firstStripUrl = url
latestSearch = WP_LATEST_SEARCH
starter = indirectStarter starter = indirectStarter

View file

@ -14,13 +14,11 @@ from ..helpers import indirectStarter, xpath_class
# expression is for which comics. # expression is for which comics.
WP_LATEST_SEARCH = '//a[%s]' % xpath_class('comic-nav-last')
class _WordPressScraper(_ParserScraper): class _WordPressScraper(_ParserScraper):
imageSearch = '//div[@id="comic"]//img' imageSearch = '//div[@id="comic"]//img'
prevSearch = '//a[%s]' % xpath_class('comic-nav-previous') prevSearch = '//a[%s]' % xpath_class('comic-nav-previous')
nextSearch = '//a[%s]' % xpath_class('comic-nav-next') nextSearch = '//a[%s]' % xpath_class('comic-nav-next')
latestSearch = '//a[%s]' % xpath_class('comic-nav-last')
class _WPNavi(_WordPressScraper): class _WPNavi(_WordPressScraper):

View file

@ -11,7 +11,7 @@ from re import compile, escape, IGNORECASE
from ..helpers import bounceStarter, indirectStarter, xpath_class from ..helpers import bounceStarter, indirectStarter, xpath_class
from ..scraper import _BasicScraper, _ParserScraper from ..scraper import _BasicScraper, _ParserScraper
from ..util import tagre from ..util import tagre
from .common import _ComicControlScraper, _WordPressScraper, _WPNavi, WP_LATEST_SEARCH from .common import _ComicControlScraper, _WordPressScraper, _WPNavi
class EarthsongSaga(_ParserScraper): class EarthsongSaga(_ParserScraper):
@ -30,7 +30,6 @@ class EarthsongSaga(_ParserScraper):
class EasilyAmused(_WordPressScraper): class EasilyAmused(_WordPressScraper):
url = 'http://www.flowerlarkstudios.com/comicpage/college-daze/ea01/' url = 'http://www.flowerlarkstudios.com/comicpage/college-daze/ea01/'
firstStripUrl = url firstStripUrl = url
latestSearch = WP_LATEST_SEARCH
starter = indirectStarter starter = indirectStarter
@ -123,7 +122,6 @@ class Erstwhile(_WPNavi):
class Eryl(_WordPressScraper): class Eryl(_WordPressScraper):
url = 'http://www.flowerlarkstudios.com/comicpage/prologue-migration/page-i/' url = 'http://www.flowerlarkstudios.com/comicpage/prologue-migration/page-i/'
firstStripUrl = url firstStripUrl = url
latestSearch = WP_LATEST_SEARCH
starter = indirectStarter starter = indirectStarter

View file

@ -10,8 +10,7 @@ from re import compile, escape
from ..scraper import _BasicScraper, _ParserScraper from ..scraper import _BasicScraper, _ParserScraper
from ..helpers import bounceStarter, indirectStarter from ..helpers import bounceStarter, indirectStarter
from ..util import tagre from ..util import tagre
from .common import (_ComicControlScraper, _WordPressScraper, _WPNaviIn, from .common import _ComicControlScraper, _WordPressScraper, _WPNaviIn
WP_LATEST_SEARCH)
class Lackadaisy(_ParserScraper): class Lackadaisy(_ParserScraper):
@ -34,7 +33,6 @@ class Lackadaisy(_ParserScraper):
class Laiyu(_WordPressScraper): class Laiyu(_WordPressScraper):
url = 'http://www.flowerlarkstudios.com/comicpage/preliminary-concepts/welcome/' url = 'http://www.flowerlarkstudios.com/comicpage/preliminary-concepts/welcome/'
firstStripUrl = url firstStripUrl = url
latestSearch = WP_LATEST_SEARCH
starter = indirectStarter starter = indirectStarter

View file

@ -10,7 +10,7 @@ from re import compile, escape
from ..scraper import _BasicScraper, _ParserScraper from ..scraper import _BasicScraper, _ParserScraper
from ..helpers import indirectStarter from ..helpers import indirectStarter
from ..util import tagre from ..util import tagre
from .common import _ComicControlScraper, _WordPressScraper, _WPNavi, WP_LATEST_SEARCH from .common import _ComicControlScraper, _WordPressScraper, _WPNavi
class Namesake(_ComicControlScraper): class Namesake(_ComicControlScraper):
@ -156,7 +156,6 @@ class NobodyScores(_BasicScraper):
class NoMoreSavePoints(_WordPressScraper): class NoMoreSavePoints(_WordPressScraper):
url = 'http://www.flowerlarkstudios.com/comicpage/no-more-save-points/mushroom-hopping/' url = 'http://www.flowerlarkstudios.com/comicpage/no-more-save-points/mushroom-hopping/'
firstStripUrl = url firstStripUrl = url
latestSearch = WP_LATEST_SEARCH
starter = indirectStarter starter = indirectStarter

View file

@ -10,7 +10,7 @@ from re import compile, escape
from ..helpers import bounceStarter, indirectStarter from ..helpers import bounceStarter, indirectStarter
from ..scraper import _BasicScraper, _ParserScraper from ..scraper import _BasicScraper, _ParserScraper
from ..util import tagre from ..util import tagre
from .common import _WordPressScraper, _WPNavi, WP_LATEST_SEARCH from .common import _WordPressScraper, _WPNavi
class OctopusPie(_ParserScraper): class OctopusPie(_ParserScraper):
@ -139,7 +139,6 @@ class OrderOfTheBlackDog(_WordPressScraper):
url = 'http://orderoftheblackdog.com/' url = 'http://orderoftheblackdog.com/'
stripUrl = url + 'comic/%s/' stripUrl = url + 'comic/%s/'
firstStripUrl = stripUrl % 'issue-1-cover' firstStripUrl = stripUrl % 'issue-1-cover'
nextSearch = WP_LATEST_SEARCH
starter = bounceStarter starter = bounceStarter
def namer(self, imageUrl, pageUrl): def namer(self, imageUrl, pageUrl):

View file

@ -12,7 +12,7 @@ import datetime
from ..scraper import _BasicScraper, _ParserScraper from ..scraper import _BasicScraper, _ParserScraper
from ..helpers import indirectStarter, bounceStarter, joinPathPartsNamer, xpath_class from ..helpers import indirectStarter, bounceStarter, joinPathPartsNamer, xpath_class
from ..util import tagre from ..util import tagre
from .common import _ComicControlScraper, _WordPressScraper, _WPNavi, WP_LATEST_SEARCH from .common import _ComicControlScraper, _WordPressScraper, _WPNavi
class SabrinaOnline(_BasicScraper): class SabrinaOnline(_BasicScraper):
@ -312,7 +312,6 @@ class SnowFlame(_WordPressScraper):
stripUrl = url + '?comic=snowflame-%s-%s' stripUrl = url + '?comic=snowflame-%s-%s'
firstStripUrl = stripUrl % ('01', '01') firstStripUrl = stripUrl % ('01', '01')
starter = bounceStarter starter = bounceStarter
nextSearch = WP_LATEST_SEARCH
help = 'Index format: chapter-page' help = 'Index format: chapter-page'
def getIndexStripUrl(self, index): def getIndexStripUrl(self, index):

View file

@ -5,13 +5,12 @@
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
from .common import _WordPressScraper, WP_LATEST_SEARCH from .common import _WordPressScraper
from ..helpers import indirectStarter from ..helpers import indirectStarter
class WebcomicFactory(_WordPressScraper): class WebcomicFactory(_WordPressScraper):
starter = indirectStarter starter = indirectStarter
latestSearch = WP_LATEST_SEARCH
def __init__(self, name, url): def __init__(self, name, url):
super(WebcomicFactory, self).__init__(name) super(WebcomicFactory, self).__init__(name)