dosage/dosagelib/plugins/p.py

242 lines
9.6 KiB
Python
Raw Normal View History

# -*- coding: iso-8859-1 -*-
# Copyright (C) 2004-2005 Tristan Seligmann and Jonathan Jacobs
2014-01-05 15:50:57 +00:00
# Copyright (C) 2012-2014 Bastian Kleineidam
2012-06-20 19:58:13 +00:00
from re import compile, escape
2012-10-11 10:03:12 +00:00
from ..scraper import _BasicScraper
2012-11-21 20:57:26 +00:00
from ..helpers import bounceStarter, queryNamer, indirectStarter
from ..util import tagre
2012-06-20 19:58:13 +00:00
2012-12-28 04:37:08 +00:00
class PandyLand(_BasicScraper):
url = 'http://pandyland.net/'
rurl = escape(url)
stripUrl = url + '%s/'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % '1'
imageSearch = compile(tagre("img", "src", r'(%scomics/[^"]+)' % rurl))
prevSearch = compile(tagre("a", "href", r'(%s\d+/)' % rurl, after="prev"))
2012-12-28 04:37:08 +00:00
help = 'Index format: number'
class ParadigmShift(_BasicScraper):
2013-04-14 07:02:14 +00:00
description = u'A Paranormal Graphic Novel by Dirk I. Tiede'
url = 'http://www.paradigmshiftmanga.com/'
starter = indirectStarter(url, compile(tagre("a", "href", r'([^"]+)', after="next-comic-link")))
2013-02-18 19:55:54 +00:00
stripUrl = url + 'ps/%s.html'
imageSearch = compile(tagre("img", "src", r'([^"]*comics/ps/[^"]*)'))
prevSearch = compile(tagre("a", "href", r'([^"]+)', after="previous-comic-link"))
help = 'Index format: custom'
class ParallelUniversum(_BasicScraper):
url = 'http://www.paralleluniversum.net/'
rurl = escape(url)
stripUrl = url + '%s/'
firstStripUrl = stripUrl % '001-der-comic-ist-tot'
imageSearch = compile(tagre("img", "src", r'(%scomics/\d+-\d+-\d+[^"]+)' % rurl))
prevSearch = compile(tagre("a", "href", r'(%s[^"]+/)' % rurl) +
tagre("span", "class", "prev"))
help = 'Index format: number-stripname'
lang = 'de'
2012-06-20 19:58:13 +00:00
class PartiallyClips(_BasicScraper):
2013-04-14 07:02:14 +00:00
description = u'PartiallyClips - The true stories behind your favorite clip art.'
url = 'http://partiallyclips.com/'
rurl = escape(url)
stripUrl = url + '%s/'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % '2001/10/28/screaming-woman'
imageSearch = compile(tagre("img", "src", r'(%scomics/[^"]+)' % rurl))
prevSearch = compile(tagre("a", "href", r'(%s[^"]+)' % rurl, after="prev"))
2012-11-21 20:57:26 +00:00
help = 'Index format: yyyy/mm/dd/stripname'
2012-06-20 19:58:13 +00:00
class PastelDefender(_BasicScraper):
2013-04-13 18:58:00 +00:00
baseUrl = 'http://www.pasteldefender.com/'
url = baseUrl + 'coverbackcover.html'
stripUrl = baseUrl + '%s.html'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % 'cover'
2012-06-20 19:58:13 +00:00
imageSearch = compile(r'<IMG SRC="(images/.+?)" WIDTH="742"')
prevSearch = compile(r'<A HREF="([^"]+)"><IMG SRC="images/back\.gif"')
help = 'Index format: nnn'
class PebbleVersion(_BasicScraper):
url = 'http://www.pebbleversion.com/'
stripUrl = url + 'Archives/Strip%s.html'
2012-06-20 19:58:13 +00:00
imageSearch = compile(r'<img src="(ComicStrips/.+?|../ComicStrips/.+?)"')
prevSearch = compile(r'<a href="((?!.+?">First Comic)Archives/Strip.+?|(?=.+?">Previous Comic)(?!.+?">First Comic)Strip.+?)"')
help = 'Index format: n (unpadded)'
class PennyAndAggie(_BasicScraper):
2013-04-11 16:27:43 +00:00
url = 'http://pennyandaggie.com/'
rurl = escape(url)
stripUrl = url + 'index.php?p=%s'
2013-04-11 16:27:43 +00:00
imageSearch = compile(tagre("img", "src", r'(http://www\.pennyandaggie\.com/comics/[^"]+)'))
prevSearch = compile(tagre("a", "href", r"(index\.php\?p\=\d+)", quote="'") +
tagre("img", "src", r'%simages/previous_day\.gif' % rurl, quote=""))
starter = indirectStarter(url, prevSearch)
2012-06-20 19:58:13 +00:00
help = 'Index format: n (unpadded)'
class PennyArcade(_BasicScraper):
url = 'http://penny-arcade.com/comic/'
rurl = escape(url)
starter = bounceStarter(url,
compile(tagre("a", "href", r'(%s[^"]+)' % rurl, before="btnNext"))
2012-11-21 20:57:26 +00:00
)
stripUrl = url + '%s'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % '1998/11/18'
2012-11-21 20:57:26 +00:00
imageSearch = compile(tagre("img", "src", r'(http://art\.penny-arcade\.com/photos/[^"]+)'))
prevSearch = compile(tagre("a", "href", r'(%s[^"]+)' % rurl, before="btnPrev"))
2012-06-20 19:58:13 +00:00
help = 'Index format: yyyy/mm/dd'
@classmethod
def namer(cls, imageUrl, pageUrl):
2012-12-04 06:02:40 +00:00
dummy, yyyy, mm, dd = pageUrl.rsplit('/', 3)
2012-06-20 19:58:13 +00:00
return '%04d%02d%02d' % (int(yyyy), int(mm), int(dd))
class PeppermintSaga(_BasicScraper):
2013-04-14 07:02:14 +00:00
description = u'Sexy Fucking Fantasy Adventure Webcomic - NSFW'
url = 'http://www.pepsaga.com/'
rurl = escape(url)
stripUrl = url + '?p=%s'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % '3'
imageSearch = compile(tagre("img", "src", r'(%scomics/[^"]+)' % rurl))
prevSearch = compile(tagre("a", "href", r'(%s\?p=\d+)' % rurl, after="prev"))
2012-11-21 20:57:26 +00:00
help = 'Index format: number'
2013-04-14 07:02:14 +00:00
adult = True
2012-06-20 19:58:13 +00:00
class PHDComics(_BasicScraper):
2013-04-13 18:58:00 +00:00
baseUrl = 'http://phdcomics.com/'
url = baseUrl + 'comics.php'
stripUrl = baseUrl + 'comics/archive.php?comicid=%s'
firstStripUrl = stripUrl % '1'
imageSearch = compile(tagre("img", "src", r'(http://www\.phdcomics\.com/comics/archive/phd[^ ]+)', quote=""))
prevSearch = compile(tagre("a", "href", r'((?:comics/)?archive\.php\?comicid=\d+)', quote="") +
tagre("img", "src", r'(?:comics/)?images/prev_button\.gif', quote=""))
help = 'Index format: number'
2014-01-06 07:20:58 +00:00
def shouldSkipUrl(self, url):
"""Skip pages without images."""
return url in (
self.stripUrl % '1669', # video
)
2012-12-08 20:30:51 +00:00
class PicPakDog(_BasicScraper):
2013-04-14 07:02:14 +00:00
description = u'A comic by Kim Belding'
url = 'http://www.picpak.net/'
rurl = escape(url)
2013-02-22 18:43:33 +00:00
stripUrl = url + 'comic/%s/'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % 'dogs-cant-spell'
imageSearch = compile(tagre("img", "src", r'(%swp-content/uploads/\d+/\d+/\d+-\d+-\d+-[^"]+\.png)' % rurl))
2013-05-25 21:24:33 +00:00
prevSearch = compile(tagre("a", "href", r'(%scomic/[^"]+)' % rurl, after="nav-prev"))
2013-02-21 18:47:37 +00:00
help = 'Index format: stripname'
2012-12-08 20:30:51 +00:00
2012-06-20 19:58:13 +00:00
class Pixel(_BasicScraper):
url = 'http://pixelcomic.net/'
rurl = escape(url)
2013-04-10 21:57:09 +00:00
stripUrl = url + '%s'
firstStripUrl = stripUrl % '000.shtml'
2012-11-21 20:57:26 +00:00
imageSearch = compile(tagre("img", "src", r'(\d+\.png)'))
2013-04-10 21:57:09 +00:00
prevSearch = compile(tagre("a", "href", r'(%s\d+\.(?:php|shtml))' % rurl, before="prev"))
2012-06-20 19:58:13 +00:00
help = 'Index format: nnn'
class PiledHigherAndDeeper(_BasicScraper):
url = 'http://www.phdcomics.com/comics/archive.php'
starter = bounceStarter(url, compile(r'<a href=(archive\.php\?comicid=\d+)><img height=52 width=49 src=images/next_button\.gif border=0 align=middle>'))
stripUrl = url + '?comicid=%s'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % '1'
2013-04-28 17:58:38 +00:00
imageSearch = compile(tagre("img", "src", r'(http://www\.phdcomics\.com/comics/archive/phd\d+s?\.\w{3,4})', quote=""))
2012-06-20 19:58:13 +00:00
prevSearch = compile(r'<a href=(archive\.php\?comicid=\d+)><img height=52 width=49 src=images/prev_button\.gif border=0 align=middle>')
help = 'Index format: n (unpadded)'
namer = queryNamer('comicid', usePageUrl=True)
2012-12-08 20:30:51 +00:00
class Pimpette(_BasicScraper):
url = 'http://pimpette.ca/'
stripUrl = url + 'index.php?date=%s'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % '20030905'
2012-12-08 20:30:51 +00:00
imageSearch = compile(tagre("img", "src", r'(strips/[^"]+)'))
prevSearch = compile(tagre("a", "href", r'(index\.php\?date=\d+)') + "Previous")
help = 'Index format: yyyymmdd'
2013-03-06 19:21:10 +00:00
# Broken navigation: prev link at http://planescapecomic.com/201.html points to same URL.
class _PlanescapeSurvival(_BasicScraper):
url = 'http://planescapecomic.com/'
stripUrl = url + '%s.html'
imageSearch = compile(r'src="(comics/.+?)"')
prevSearch = compile(r'<a href="(.+?)"><img alt="Previous" ')
help = 'Index format: nnn'
class PokeyThePenguin(_BasicScraper):
2013-04-13 18:58:00 +00:00
baseUrl = 'http://www.yellow5.com/pokey/archive/'
url = baseUrl + 'index558.html'
stripUrl = baseUrl + 'index%s.html'
firstStripUrl = stripUrl % '1'
imageSearch = compile(tagre("img", "src", r'(pokey\d+[^"]+)'))
2013-03-06 19:23:43 +00:00
prevSearch = True
multipleImagesPerStrip = True
help = 'Index format: number'
def getPrevUrl(self, url, data, baseUrl):
"""Decrease index.html number."""
mo = compile(r"index(\d+)\.html").search(url)
num = int(mo.group(1)) - 1
prefix = url.rsplit('/', 1)[0]
return "%s/index%d.html" % (prefix, num)
2012-06-20 19:58:13 +00:00
class Precocious(_BasicScraper):
url = 'http://www.precociouscomic.com/'
starter = indirectStarter(url,
2012-11-21 20:57:26 +00:00
compile(tagre("a", "href", r'(/archive/comic/[^"]+)') + tagre("img", "src", r"/templates/precocious_main/images/next_arrow\.png"))
)
stripUrl = url + 'archive/comic/%s'
2013-04-04 16:30:02 +00:00
imageSearch = compile(tagre("img", "src", r'(/comics/\d+[^"]*\.(?:jpg|gif))'))
2012-11-21 20:57:26 +00:00
prevSearch = compile(tagre("a", "href", r'(/archive/comic/[^"]+)') + tagre("img", "src", r"/templates/precocious_main/images/back_arrow\.png"))
help = 'Index format: yyyy/mm/dd'
2012-06-20 19:58:13 +00:00
class ProperBarn(_BasicScraper):
url = 'http://www.nitrocosm.com/go/gag/'
stripUrl = url + '%s/'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % '1'
2012-12-04 06:02:40 +00:00
imageSearch = compile(tagre("img", "src", r'(http://content\.nitrocosm\.com/gag/\d+\.[^"]+)'))
2012-11-21 20:57:26 +00:00
prevSearch = compile(tagre("a", "href", r'(http://www\.nitrocosm\.com/go/gag/\d+/)', after="nav_btn_previous"))
2012-06-20 19:58:13 +00:00
help = 'Index format: nnn'
class PunksAndNerds(_BasicScraper):
url = 'http://www.punksandnerds.com/'
rurl = escape(url)
stripUrl = url + '?p=%s'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % '15'
imageSearch = compile(tagre("img", "src", r'(%scomics/[^"]+)' % rurl))
prevSearch = compile(tagre("a", "href", r'(%s\?p=\d+)' % rurl, after="navi-prev"))
2012-06-20 19:58:13 +00:00
help = 'Index format: nnn'
class PunksAndNerdsOld(_BasicScraper):
url = 'http://original.punksandnerds.com/'
stripUrl = url + 'd/%s.html'
2012-06-20 19:58:13 +00:00
imageSearch = compile(r' src="(/comics/.+?)"')
prevSearch = compile(r'><strong><a href="(.+?)"[^>]+?><img[^>]+?src="/previouscomic.gif">')
help = 'Index format: yyyymmdd'
2013-04-10 16:36:33 +00:00
class PvPonline(_BasicScraper):
url = 'http://pvponline.com/comic'
stripUrl = url + '%s'
imageSearch = compile(tagre("img", "src", r'(http://s3[^"]+\.amazonaws\.com/pvponlinenew/img/comic/\d+/\d+/pvp[^"]+\.jpg)'))
prevSearch = compile(tagre("a", "href", r'(/comic/[^"]+)', after="Previous"))
help = 'Index format: yyyy/mm/dd/stripname'