dosage/dosagelib/plugins/p.py

159 lines
6.9 KiB
Python
Raw Normal View History

# -*- coding: iso-8859-1 -*-
# Copyright (C) 2004-2005 Tristan Seligmann and Jonathan Jacobs
2012-11-21 20:57:26 +00:00
# Copyright (C) 2012 Bastian Kleineidam
2012-06-20 19:58:13 +00:00
2012-12-08 20:30:51 +00:00
from re import compile
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):
latestUrl = 'http://pandyland.net/'
stripUrl = latestUrl + '%s/'
imageSearch = compile(tagre("img", "src", r'(http://pandyland\.net/comics/[^"]+)'))
prevSearch = compile(tagre("a", "href", r'(http://pandyland\.net/\d+/)', after="prev"))
help = 'Index format: number'
2012-06-20 19:58:13 +00:00
class PartiallyClips(_BasicScraper):
2012-11-21 20:57:26 +00:00
latestUrl = 'http://partiallyclips.com/'
stripUrl = latestUrl + '%s/'
imageSearch = compile(tagre("img", "src", r'(http://partiallyclips\.com/comics/[^"]+)'))
2012-12-04 06:02:40 +00:00
prevSearch = compile(tagre("a", "href", r'(http://partiallyclips\.com/[^"]+)', 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):
latestUrl = 'http://www.pasteldefender.com/coverbackcover.html'
2012-11-13 18:10:19 +00:00
stripUrl = 'http://www.pasteldefender.com/%s.html'
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):
latestUrl = 'http://www.pebbleversion.com/'
stripUrl = latestUrl + '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):
2012-11-21 20:57:26 +00:00
baseUrl = 'http://www.pennyandaggie.com/'
stripUrl = baseUrl + 'index.php?p=%s'
2012-12-04 06:02:40 +00:00
imageSearch = compile(tagre("img", "src", r'(http://www\.pennyandaggie\.com/comics/[^"]+)'))
2012-11-21 20:57:26 +00:00
prevSearch = compile(tagre("a", "href", r"(index\.php\?p=\d+)", quote="'") +
tagre("img", "src", r'http://pennyandaggie\.com/images/previous_day\.gif', quote=""))
starter = indirectStarter(baseUrl, prevSearch)
2012-06-20 19:58:13 +00:00
help = 'Index format: n (unpadded)'
class PennyArcade(_BasicScraper):
2012-11-21 20:57:26 +00:00
baseUrl = 'http://penny-arcade.com/comic/'
starter = bounceStarter(baseUrl,
2012-12-04 06:02:40 +00:00
compile(tagre("a", "href", r'(http://penny-arcade\.com/comic/[^"]+)', before="btnNext"))
2012-11-21 20:57:26 +00:00
)
2012-12-04 06:02:40 +00:00
stripUrl = baseUrl + '%s'
2012-11-21 20:57:26 +00:00
imageSearch = compile(tagre("img", "src", r'(http://art\.penny-arcade\.com/photos/[^"]+)'))
2012-12-04 06:02:40 +00:00
prevSearch = compile(tagre("a", "href", r'(http://penny-arcade\.com/comic/[^"]+)', 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):
latestUrl = 'http://www.pepsaga.com/'
2012-11-21 20:57:26 +00:00
stripUrl = latestUrl + '?p=%s'
imageSearch = compile(tagre("img", "src", r'(http://www\.pepsaga\.com/comics/[^"]+)'))
prevSearch = compile(tagre("a", "href", r'(http://www\.pepsaga\.com/\?p=\d+)', after="prev"))
help = 'Index format: number'
2012-06-20 19:58:13 +00:00
2012-12-08 20:30:51 +00:00
class PicPakDog(_BasicScraper):
latestUrl = 'http://www.picpak.net/'
stripUrl = latestUrl + 'comics/%s/'
imageSearch = compile(tagre("img", "src", r'(http://www\.picpak\.net/comics/[^"]+)'))
prevSearch = compile(tagre("a", "href", r'(http://www\.picpak\.net/comics/[^"]+)', after="navi-prev"))
help = 'Index format: yyyy/mm/dd/stripname'
2012-06-20 19:58:13 +00:00
class Pixel(_BasicScraper):
2012-11-21 20:57:26 +00:00
latestUrl = 'http://pixelcomic.net/'
stripUrl = latestUrl + '%s.php'
imageSearch = compile(tagre("img", "src", r'(\d+\.png)'))
prevSearch = compile(tagre("a", "href", r'(http://pixelcomic\.net/\d+\.php)', before="prev"))
2012-06-20 19:58:13 +00:00
help = 'Index format: nnn'
class PiledHigherAndDeeper(_BasicScraper):
starter = bounceStarter('http://www.phdcomics.com/comics/archive.php', compile(r'<a href=(archive\.php\?comicid=\d+)><img height=52 width=49 src=images/next_button\.gif border=0 align=middle>'))
2012-11-13 18:10:19 +00:00
stripUrl = 'http://www.phdcomics.com/comics/archive.php?comicid=%s'
2012-06-20 19:58:13 +00:00
imageSearch = compile(r'<img src=(http://www\.phdcomics\.com/comics/archive/phd\d+s?\.gif)')
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):
latestUrl = 'http://pimpette.ca/'
stripUrl = latestUrl + 'index.php?date=%s'
imageSearch = compile(tagre("img", "src", r'(strips/[^"]+)'))
prevSearch = compile(tagre("a", "href", r'(index\.php\?date=\d+)') + "Previous")
help = 'Index format: yyyymmdd'
2012-06-20 19:58:13 +00:00
class Precocious(_BasicScraper):
2012-11-21 20:57:26 +00:00
baseUrl = 'http://www.precociouscomic.com/'
starter = indirectStarter(baseUrl,
compile(tagre("a", "href", r'(/archive/comic/[^"]+)') + tagre("img", "src", r"/templates/precocious_main/images/next_arrow\.png"))
)
stripUrl = baseUrl + 'archive/comic/%s'
imageSearch = compile(tagre("img", "src", r'(/comics/\d+\.jpg)'))
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 PvPonline(_BasicScraper):
2012-11-21 20:57:26 +00:00
latestUrl = 'http://pvponline.com/comic'
stripUrl = latestUrl + '%s'
2012-12-04 06:02:40 +00:00
imageSearch = compile(tagre("img", "src", r'(http://newcdn\.pvponline\.com/img/comic/pvp[^"]+\.jpg)'))
2012-11-21 20:57:26 +00:00
prevSearch = compile(tagre("a", "href", r'(http://pvponline\.com/comic/[^"]+)', after="Previous"))
help = 'Index format: yyyy/mm/dd/stripname'
2012-06-20 19:58:13 +00:00
class ProperBarn(_BasicScraper):
latestUrl = 'http://www.nitrocosm.com/go/gag/'
stripUrl = latestUrl + '%s/'
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):
latestUrl = 'http://www.punksandnerds.com/'
2012-11-21 20:57:26 +00:00
stripUrl = latestUrl + '?p=%s'
imageSearch = compile(tagre("img", "src", r'(http://www\.punksandnerds\.com/comics/[^"]+)'))
prevSearch = compile(tagre("a", "href", r'(http://www\.punksandnerds\.com/\?p=\d+)', after="navi-prev"))
2012-06-20 19:58:13 +00:00
help = 'Index format: nnn'
class PunksAndNerdsOld(_BasicScraper):
latestUrl = 'http://original.punksandnerds.com/'
stripUrl = latestUrl + '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'
class PlanescapeSurvival(_BasicScraper):
latestUrl = 'http://planescapecomic.com/'
stripUrl = latestUrl + '%s.html'
2012-06-20 19:58:13 +00:00
imageSearch = compile(r'src="(comics/.+?)"')
prevSearch = compile(r'<a href="(.+?)"><img alt="Previous" ')
help = 'Index format: nnn'