Unify more WordPress-based modules.

This commit is contained in:
Tobias Gruetzmacher 2017-05-22 01:17:05 +02:00
parent 42f66c07b0
commit 7e0adf1d96
16 changed files with 66 additions and 84 deletions

View file

@ -9,8 +9,8 @@ from re import compile, escape, MULTILINE
from ..util import tagre
from ..scraper import _BasicScraper, _ParserScraper
from ..helpers import regexNamer, bounceStarter, indirectStarter, xpath_class
from .common import _WordPressScraper, WP_LATEST_SEARCH
from ..helpers import regexNamer, bounceStarter, indirectStarter
from .common import _WordPressScraper, _WPNavi, WP_LATEST_SEARCH
class AbstruseGoose(_BasicScraper):
@ -67,12 +67,11 @@ class Achewood(_BasicScraper):
namer = regexNamer(compile(r'date=(\d+)'))
class AfterStrife(_WordPressScraper):
class AfterStrife(_WPNavi):
baseUrl = 'http://afterstrife.com/'
stripUrl = baseUrl + '?p=%s'
url = stripUrl % '262'
firstStripUrl = stripUrl % '1'
prevSearch = '//a[%s]' % xpath_class('navi-prev')
help = 'Index format: nnn'
endOfLife = True
@ -97,9 +96,8 @@ class AhoiPolloi(_ParserScraper):
help = 'Index format: yyyymmdd'
class AhoyEarth(_WordPressScraper):
class AhoyEarth(_WPNavi):
url = 'http://www.ahoyearth.com/'
prevSearch = '//a[%s]' % xpath_class('navi-prev')
class AirForceBlues(_WordPressScraper):

View file

@ -10,8 +10,7 @@ from re import compile, escape
from ..util import tagre
from ..scraper import _BasicScraper, _ParserScraper
from ..helpers import indirectStarter, xpath_class
from .common import (_ComicControlScraper, _WordPressScraper, _WPNaviIn,
WP_PREV_SEARCH)
from .common import _ComicControlScraper, _WordPressScraper, _WPNaviIn
class BadassMuthas(_BasicScraper):
@ -136,12 +135,10 @@ class BloodBound(_WordPressScraper):
firstStripUrl = 'http://bloodboundcomic.com/comic/06112006/'
class BloomingFaeries(_ParserScraper):
class BloomingFaeries(_WordPressScraper):
adult = True
url = 'http://www.bloomingfaeries.com/'
firstStripUrl = url + 'comic/public/pit-stop/'
imageSearch = '//div[@id="comic"]//img'
prevSearch = WP_PREV_SEARCH
def namer(self, image_url, page_url):
return "_".join(image_url.rsplit('/', 3)[1:])

View file

@ -8,9 +8,9 @@ from __future__ import absolute_import, division, print_function
from re import compile, escape
from ..scraper import _BasicScraper, _ParserScraper
from ..helpers import bounceStarter, indirectStarter, xpath_class
from ..helpers import bounceStarter, indirectStarter
from ..util import tagre
from .common import _TumblrScraper, _WordPressScraper
from .common import _TumblrScraper, _WordPressScraper, _WPNavi
class CampComic(_BasicScraper):
@ -113,9 +113,8 @@ class Champ2010(_BasicScraper):
help = 'Index format: yy-dd-mm'
class ChannelAte(_WordPressScraper):
class ChannelAte(_WPNavi):
url = 'http://www.channelate.com/'
prevSearch = '//a[%s]' % xpath_class('navi-prev')
class ChasingTheSunset(_BasicScraper):

View file

@ -15,12 +15,15 @@ from ..helpers import indirectStarter, xpath_class
WP_LATEST_SEARCH = '//a[%s]' % xpath_class('comic-nav-last')
WP_PREV_SEARCH = '//a[%s]' % xpath_class('comic-nav-previous')
class _WordPressScraper(_ParserScraper):
imageSearch = '//div[@id="comic"]//img'
prevSearch = WP_PREV_SEARCH
prevSearch = '//a[%s]' % xpath_class('comic-nav-previous')
class _WPNavi(_WordPressScraper):
prevSearch = '//a[%s]' % xpath_class('navi-prev')
class _WPNaviIn(_WordPressScraper):

View file

@ -11,7 +11,7 @@ from re import compile, escape, IGNORECASE
from ..helpers import indirectStarter, xpath_class
from ..scraper import _BasicScraper, _ParserScraper
from ..util import tagre
from .common import _WordPressScraper, WP_LATEST_SEARCH
from .common import _WordPressScraper, _WPNavi, WP_LATEST_SEARCH
class EarthsongSaga(_ParserScraper):
@ -59,10 +59,9 @@ class EdibleDirt(_BasicScraper):
help = 'Index format: number'
class EdmundFinney(_WordPressScraper):
class EdmundFinney(_WPNavi):
url = 'http://eqcomics.com/'
firstStripUrl = url + '2009/03/08/sunday-aliens/'
prevSearch = '//a[%s]' % xpath_class('navi-prev')
class ElfOnlyInn(_BasicScraper):
@ -112,9 +111,8 @@ class ErrantStory(_BasicScraper):
help = 'Index format: yyyy-mm-dd/num'
class Erstwhile(_WordPressScraper):
class Erstwhile(_WPNavi):
url = 'http://www.erstwhiletales.com/'
prevSearch = '//a[%s]' % xpath_class('navi-prev')
endOfLife = True
@ -153,18 +151,16 @@ class Evilish(_ParserScraper):
help = 'Index format: yyyymmdd'
class Exiern(_WordPressScraper):
class Exiern(_WPNavi):
url = 'http://www.exiern.com/'
firstStripUrl = url + '2005/09/06/so-far/'
imageSearch = ('//div[@id="comic"]//img',
'//div[%s]//img' % xpath_class('entry'))
prevSearch = '//a[%s]' % xpath_class('navi-prev')
class ExploitationNow(_WordPressScraper):
class ExploitationNow(_WPNavi):
url = 'http://www.exploitationnow.com/'
firstStripUrl = url + '2000-07-07/9'
prevSearch = '//a[%s]' % xpath_class('navi-prev')
endOfLife = True

View file

@ -8,9 +8,9 @@ from __future__ import absolute_import, division, print_function
from re import compile, escape
from ..scraper import _BasicScraper, _ParserScraper
from ..helpers import indirectStarter, xpath_class
from ..helpers import indirectStarter
from ..util import tagre
from .common import _ComicControlScraper, _WordPressScraper
from .common import _ComicControlScraper, _WordPressScraper, _WPNavi
class Galaxion(_BasicScraper):
@ -154,10 +154,9 @@ class GoneWithTheBlastwave(_BasicScraper):
return '%02d' % int(compile(r'nro=(\d+)').search(page_url).group(1))
class GrrlPower(_WordPressScraper):
class GrrlPower(_WPNavi):
url = 'http://grrlpowercomic.com/'
firstStripUrl = url + 'archives/48'
prevSearch = '//a[%s]' % xpath_class('navi-prev')
class GUComics(_BasicScraper):

View file

@ -7,10 +7,9 @@ from __future__ import absolute_import, division, print_function
from re import compile, escape
from ..helpers import xpath_class
from ..scraper import _BasicScraper
from ..util import tagre
from .common import _WordPressScraper
from .common import _WordPressScraper, _WPNavi
class IAmArg(_BasicScraper):
@ -37,11 +36,10 @@ class IDreamOfAJeanieBottle(_WordPressScraper):
url = 'http://jeaniebottle.com/'
class InternetWebcomic(_WordPressScraper):
class InternetWebcomic(_WPNavi):
url = 'http://www.internet-webcomic.com/'
stripUrl = url + '?p=%s'
firstStripUrl = stripUrl % '30'
prevSearch = '//a[%s]' % xpath_class('navi-prev')
help = 'Index format: n'

View file

@ -7,10 +7,9 @@ from __future__ import absolute_import, division, print_function
from re import compile, escape, IGNORECASE
from ..helpers import xpath_class
from ..scraper import _BasicScraper
from ..util import tagre
from .common import _ComicControlScraper, _WordPressScraper
from .common import _ComicControlScraper, _WPNavi
class KevinAndKell(_BasicScraper):
@ -28,16 +27,14 @@ class KevinAndKell(_BasicScraper):
return self.stripUrl % tuple(map(int, index.split('-')))
class KickInTheHead(_WordPressScraper):
class KickInTheHead(_WPNavi):
url = 'http://www.kickinthehead.org/'
firstStripUrl = url + '2003/03/20/ipod-envy/'
prevSearch = '//a[%s]' % xpath_class('navi-prev')
class KillSixBillionDemons(_WordPressScraper):
class KillSixBillionDemons(_WPNavi):
url = 'http://killsixbilliondemons.com/'
firstStripUrl = url + 'comic/kill-six-billion-demons-chapter-1/'
prevSearch = '//a[%s]' % xpath_class('navi-prev')
multipleImagesPerStrip = True
adult = True

View file

@ -8,9 +8,9 @@ from __future__ import absolute_import, division, print_function
from re import compile, escape
from ..scraper import _BasicScraper, _ParserScraper
from ..helpers import indirectStarter, xpath_class
from ..helpers import indirectStarter
from ..util import tagre
from .common import _ComicControlScraper, _WordPressScraper, WP_LATEST_SEARCH
from .common import _ComicControlScraper, _WordPressScraper, _WPNavi, WP_LATEST_SEARCH
class Namesake(_ComicControlScraper):
@ -82,9 +82,8 @@ class NichtLustig(_BasicScraper):
starter = indirectStarter
class Nicky510(_WordPressScraper):
class Nicky510(_WPNavi):
url = 'http://www.nickyitis.com/'
prevSearch = '//a[%s]' % xpath_class('navi-prev')
class Nimona(_BasicScraper):

View file

@ -7,10 +7,9 @@ from __future__ import absolute_import, division, print_function
from re import compile, escape
from ..helpers import xpath_class
from ..scraper import _BasicScraper, _ParserScraper
from ..util import tagre
from .common import _WordPressScraper
from .common import _WordPressScraper, _WPNavi
class OctopusPie(_ParserScraper):
@ -50,10 +49,9 @@ class Oglaf(_ParserScraper):
return urls
class OhJoySexToy(_WordPressScraper):
class OhJoySexToy(_WPNavi):
url = 'http://www.ohjoysextoy.com/'
firstStripUrl = url + 'introduction/'
prevSearch = '//a[%s]' % xpath_class('navi-prev')
textSearch = '//div[@id="comic"]//img/@alt'
adult = True
@ -106,10 +104,9 @@ class OopsComicAdventure(_WordPressScraper):
url = 'http://oopscomicadventure.com/'
class Optipess(_WordPressScraper):
class Optipess(_WPNavi):
url = 'http://www.optipess.com/'
firstStripUrl = url + '2008/12/01/jason-friend-of-the-butterflies/'
prevSearch = '//a[%s]' % xpath_class('navi-prev')
textSearch = '//div[@id="comic"]//img/@alt'
textOptional = True

View file

@ -10,7 +10,7 @@ from re import compile, escape
from ..scraper import _BasicScraper, _ParserScraper
from ..helpers import bounceStarter, queryNamer, indirectStarter, xpath_class
from ..util import tagre
from .common import _ComicControlScraper, _WordPressScraper
from .common import _ComicControlScraper, _WordPressScraper, _WPNavi
class PandyLand(_WordPressScraper):
@ -92,14 +92,18 @@ class PennyArcade(_ParserScraper):
return '%04d%02d%02d' % (int(p[4]), int(p[5]), int(p[6]))
class PeppermintSaga(_BasicScraper):
class PeppermintSaga(_WPNavi):
url = 'http://www.pepsaga.com/'
rurl = escape(url)
stripUrl = url + '?p=%s'
firstStripUrl = stripUrl % '3'
imageSearch = compile(tagre("img", "src", r'(%scomics/[^"]+)' % rurl))
prevSearch = compile(tagre("a", "href", r'(%s\?p=\d+)' % rurl,
after="prev"))
help = 'Index format: number'
adult = True
class PeppermintSagaBGR(_WPNavi):
url = 'http://bgr.pepsaga.com/'
stripUrl = url + '?p=%s'
firstStripUrl = stripUrl % '4'
help = 'Index format: number'
adult = True
@ -198,13 +202,11 @@ class Precocious(_ParserScraper):
help = 'Index format: yyyy/mm/dd'
class PrinceOfSartar(_WordPressScraper):
class PrinceOfSartar(_WPNavi):
url = 'http://www.princeofsartar.com/'
stripUrl = url + 'comic/%s/'
firstStripUrl = stripUrl % 'introduction-chapter-1'
imageSearch = '//div[@id="comic"]//img'
prevSearch = '//a[@class="navi comic-nav-previous navi-prev"]'
nextSearch = '//a[@class="navi comic-nav-next navi-next"]'
nextSearch = '//a[%s]' % xpath_class('navi-next')
starter = bounceStarter
help = 'Index format: name'

View file

@ -1,20 +1,14 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
# Copyright (C) 2012-2014 Bastian Kleineidam
# Copyright (C) 2015-2016 Tobias Gruetzmacher
# Copyright (C) 2015-2017 Tobias Gruetzmacher
from __future__ import absolute_import, division, print_function
from re import compile
from ..scraper import _BasicScraper
from ..util import tagre
from .common import _WordPressScraper
from .common import _WordPressScraper, _WPNavi
class PetiteSymphony(_BasicScraper):
imageSearch = compile(tagre("img", "src", r'(http://[a-z0-9]+\.petitesymphony\.com/files/comics/[^"]+)'))
prevSearch = compile(tagre("a", "href", r'(http://[a-z0-9]+\.petitesymphony\.com/comic/[^"]+)', after="navi-prev"))
class PetiteSymphony(_WPNavi):
multipleImagesPerStrip = True
help = 'Index format: named number'

View file

@ -12,7 +12,7 @@ import datetime
from ..scraper import _BasicScraper, _ParserScraper
from ..helpers import indirectStarter, bounceStarter, xpath_class
from ..util import tagre
from .common import _ComicControlScraper, _WordPressScraper, WP_LATEST_SEARCH
from .common import _ComicControlScraper, _WordPressScraper, _WPNavi, WP_LATEST_SEARCH
class SabrinaOnline(_BasicScraper):
@ -35,10 +35,9 @@ class SabrinaOnline(_BasicScraper):
return archivepages[-1]
class SafelyEndangered(_WordPressScraper):
class SafelyEndangered(_WPNavi):
url = 'http://www.safelyendangered.com/'
firstStripUrl = url + 'comic/ignored/'
prevSearch = '//a[%s]' % xpath_class('navi-prev')
class SailorsunOrg(_WordPressScraper):
@ -204,6 +203,14 @@ class ShermansLagoon(_BasicScraper):
return "%s-%s-%s" % (year, month, day)
class ShipInABottle(_WPNavi):
url = 'http://shipinbottle.pepsaga.com/'
stripUrl = url + '?p=%s'
firstStripUrl = stripUrl % '281'
adult = True
help = 'Index format: number'
class Shivae(_WordPressScraper):
url = 'http://shivae.com/'
firstStripUrl = url + 'gnip/ck-chapter-01/caidenkoel-title-01/'
@ -425,10 +432,9 @@ class StreetFighter(_ComicControlScraper):
url = 'http://www.streetfightercomics.com'
class StringTheory(_WordPressScraper):
class StringTheory(_WPNavi):
url = 'http://www.stringtheorycomic.com/'
firstStripUrl = url + 'comics/chapterone/chapterone/'
prevSearch = '//a[%s]' % xpath_class('navi-prev')
class StrongFemaleProtagonist(_ParserScraper):

View file

@ -10,7 +10,7 @@ from re import compile, escape
from ..scraper import _BasicScraper, _ParserScraper
from ..helpers import indirectStarter, xpath_class
from ..util import tagre
from .common import _ComicControlScraper, _TumblrScraper, _WordPressScraper
from .common import _ComicControlScraper, _TumblrScraper, _WordPressScraper, _WPNavi
class TheBrads(_ParserScraper):
@ -20,11 +20,10 @@ class TheBrads(_ParserScraper):
multipleImagesPerStrip = True
class TheDevilsPanties(_WordPressScraper):
class TheDevilsPanties(_WPNavi):
url = 'http://thedevilspanties.com/'
stripUrl = url + 'archives/%s'
firstStripUrl = stripUrl % '300'
prevSearch = '//a[%s]' % xpath_class('navi-prev')
help = 'Index format: number'

View file

@ -8,15 +8,14 @@ from __future__ import absolute_import, division, print_function
from re import compile, escape
from ..scraper import _BasicScraper
from ..helpers import indirectStarter, xpath_class
from ..helpers import indirectStarter
from ..util import tagre
from .common import _WordPressScraper
from .common import _WordPressScraper, _WPNavi
class Underling(_WordPressScraper):
class Underling(_WPNavi):
url = 'http://underlingcomic.com/'
firstStripUrl = url + 'page-one/'
prevSearch = '//a[%s]' % xpath_class('navi-prev')
class Undertow(_BasicScraper):

View file

@ -10,7 +10,7 @@ from re import compile, escape
from ..scraper import _BasicScraper, _ParserScraper
from ..util import tagre
from ..helpers import bounceStarter, xpath_class
from .common import _WordPressScraper
from .common import _WPNavi
class ZapComic(_ParserScraper):
@ -32,11 +32,10 @@ class Zapiro(_ParserScraper):
return parts[1]
class ZenPencils(_WordPressScraper):
class ZenPencils(_WPNavi):
url = 'http://zenpencils.com/'
multipleImagesPerStrip = True
firstStripUrl = url + 'comic/1-ralph-waldo-emerson-make-them-cry/'
prevSearch = '//a[%s]' % xpath_class('navi-prev')
class ZombieHunters(_BasicScraper):