Skip to content

Commit

Permalink
Unify more WordPress-based modules.
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiX committed May 21, 2017
1 parent 42f66c0 commit 7e0adf1
Show file tree
Hide file tree
Showing 16 changed files with 66 additions and 84 deletions.
10 changes: 4 additions & 6 deletions dosagelib/plugins/a.py
Expand Up @@ -9,8 +9,8 @@

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):
Expand Down Expand Up @@ -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

Expand All @@ -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):
Expand Down
7 changes: 2 additions & 5 deletions dosagelib/plugins/b.py
Expand Up @@ -10,8 +10,7 @@
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):
Expand Down Expand Up @@ -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:])
Expand Down
7 changes: 3 additions & 4 deletions dosagelib/plugins/c.py
Expand Up @@ -8,9 +8,9 @@
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):
Expand Down Expand Up @@ -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):
Expand Down
7 changes: 5 additions & 2 deletions dosagelib/plugins/common.py
Expand Up @@ -15,12 +15,15 @@


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):
Expand Down
14 changes: 5 additions & 9 deletions dosagelib/plugins/e.py
Expand Up @@ -11,7 +11,7 @@
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):
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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


Expand Down Expand Up @@ -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


Expand Down
7 changes: 3 additions & 4 deletions dosagelib/plugins/g.py
Expand Up @@ -8,9 +8,9 @@
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):
Expand Down Expand Up @@ -154,10 +154,9 @@ def namer(self, image_url, page_url):
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):
Expand Down
6 changes: 2 additions & 4 deletions dosagelib/plugins/i.py
Expand Up @@ -7,10 +7,9 @@

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):
Expand All @@ -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'


Expand Down
9 changes: 3 additions & 6 deletions dosagelib/plugins/k.py
Expand Up @@ -7,10 +7,9 @@

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):
Expand All @@ -28,16 +27,14 @@ def getIndexStripUrl(self, index):
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

Expand Down
7 changes: 3 additions & 4 deletions dosagelib/plugins/n.py
Expand Up @@ -8,9 +8,9 @@
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):
Expand Down Expand Up @@ -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):
Expand Down
9 changes: 3 additions & 6 deletions dosagelib/plugins/o.py
Expand Up @@ -7,10 +7,9 @@

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):
Expand Down Expand Up @@ -50,10 +49,9 @@ def fetchUrls(self, url, data, search):
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

Expand Down Expand Up @@ -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

Expand Down
22 changes: 12 additions & 10 deletions dosagelib/plugins/p.py
Expand Up @@ -10,7 +10,7 @@
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):
Expand Down Expand Up @@ -92,14 +92,18 @@ def namer(self, image_url, page_url):
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

Expand Down Expand Up @@ -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'

Expand Down
12 changes: 3 additions & 9 deletions dosagelib/plugins/petitesymphony.py
@@ -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 .common import _WordPressScraper, _WPNavi

from ..scraper import _BasicScraper
from ..util import tagre
from .common import _WordPressScraper


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'

Expand Down

0 comments on commit 7e0adf1

Please sign in to comment.