dosage/dosagelib/plugins/o.py

119 lines
4.4 KiB
Python
Raw Normal View History

# -*- coding: iso-8859-1 -*-
# Copyright (C) 2004-2005 Tristan Seligmann and Jonathan Jacobs
2013-02-05 18:51:46 +00:00
# Copyright (C) 2012-2013 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
from ..helpers import indirectStarter
2013-04-04 16:30:02 +00:00
from ..util import tagre, urlopen
2012-06-20 19:58:13 +00:00
class OctopusPie(_BasicScraper):
url = 'http://www.octopuspie.com/'
rurl = escape(url)
starter = indirectStarter(url,
compile(tagre("a", "href", r'(%s[^"]+)' % rurl) +
tagre("img", "src", r'%sjunk/latest\.png' % rurl)))
2013-04-10 21:57:09 +00:00
stripUrl = url + '%s/'
firstStripUrl = stripUrl % '2007-05-14/001-pea-wiggle'
imageSearch = compile(tagre("img", "src", r'(%sstrippy/[^"]+)' % rurl))
prevSearch = compile(tagre("a", "href", r'(%s[^"]+)' % rurl, after="prev"))
2012-06-20 19:58:13 +00:00
help = 'Index format: yyyy-mm-dd/nnn-strip-name'
class OddFish(_BasicScraper):
url = 'http://www.odd-fish.net/'
rurl = escape(url)
stripUrl = url + '%s/'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % 'tv-tentacles'
imageSearch = compile(tagre("img", "src", r'(%scomics/[^"]+)' % rurl))
prevSearch = compile(tagre("a", "href", r'(%s[^"]+)' % rurl, after="navi-prev"))
2012-11-21 20:57:26 +00:00
help = 'Index format: stripname'
2012-06-20 19:58:13 +00:00
2013-03-06 19:21:10 +00:00
class Oglaf(_BasicScraper):
url = 'http://oglaf.com/'
stripUrl = url + '%s/'
2013-04-04 16:30:02 +00:00
imageSearch = compile(tagre("img", "src", r'(http://media\.oglaf\.com/comic/[^"]+)', before="strip"))
prevSearch = compile(tagre("a", "href", r'(/[^"]+)') + tagre("div", "id", "pvs?"))
2013-03-06 19:21:10 +00:00
help = 'Index format: stripname/nn'
2013-04-04 16:30:02 +00:00
adult = True
@classmethod
def starter(cls):
# click the "I am 18" button
data = {"over18": " "}
2013-04-11 16:27:43 +00:00
urlopen(cls.url, cls.session, data=data, referrer=cls.url)
2013-04-04 16:30:02 +00:00
return cls.url
2013-03-06 19:21:10 +00:00
class OkCancel(_BasicScraper):
url = 'http://okcancel.com/'
rurl = escape(url)
2013-03-06 19:21:10 +00:00
stripUrl = url + 'comic/%s.html'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % '1'
imageSearch = compile(tagre("img", "src", r'(%sstrips/okcancel\d{8}\.gif)' % rurl))
prevSearch = compile(tagre("div", "class", "previous") + tagre("a", "href", r'(%scomic/\d{1,4}\.html)' % rurl))
2013-03-06 19:21:10 +00:00
starter = indirectStarter(url, prevSearch)
help = 'Index format: yyyymmdd'
2013-02-06 21:27:40 +00:00
class OmakeTheater(_BasicScraper):
url = 'http://omaketheater.com/'
rurl = escape(url)
2013-04-10 21:57:09 +00:00
stripUrl = url + 'comic/%s/'
firstStripUrl = stripUrl % '1'
2013-02-06 21:27:40 +00:00
imageSearch = compile(tagre("img", "src", r'(http://media\.omaketheater\.com/4koma/[^"]+)'))
prevSearch = compile(tagre("a", "href", r'(%scomic/\d+/)' % rurl, after="prev"))
2013-02-06 21:27:40 +00:00
starter = indirectStarter(url,
compile(tagre("a", "href", r'(%scomic/\d+/)' % rurl)))
2013-02-06 21:27:40 +00:00
help = 'Index format: number (unpadded)'
2012-06-20 19:58:13 +00:00
class OnTheEdge(_BasicScraper):
url = 'http://ontheedgecomics.com/'
rurl = escape(url)
2013-04-10 21:57:09 +00:00
stripUrl = url + 'comic/%s/'
firstStripUrl = stripUrl % 'ote0001'
imageSearch = compile(r'<img src="(%scomics/.+?)"' % rurl)
2012-06-20 19:58:13 +00:00
prevSearch = compile(r'<a href="([^"]+)" rel="prev">')
help = 'Index format: nnn (unpadded)'
class OneQuestion(_BasicScraper):
2013-03-07 17:22:24 +00:00
url = 'http://onequestioncomic.com/'
stripUrl = url + 'comic.php?strip_id=%s'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % '1'
2013-04-11 16:27:43 +00:00
imageSearch = compile(tagre("img", "src", r'((?:\.\./)?istrip_files/strips/\d+\.\w{3,4})'))
2012-11-21 20:57:26 +00:00
prevSearch = compile(tagre("a", "href", r'(comic\.php\?strip_id=\d+)') + tagre("img", "src", r'img/arrow_prev\.jpg'))
2012-06-20 19:58:13 +00:00
help = 'Index format: n (unpadded)'
2013-03-12 20:23:26 +00:00
class OrnerBoy(_BasicScraper):
url = 'http://www.orneryboy.com/'
rurl = escape(url)
2013-03-12 20:23:26 +00:00
stripUrl = url + 'index.php?comicID=%s'
firstStripUrl = stripUrl % '1'
imageSearch = compile(tagre("img", "src", r'(comics/\d+\.[^"]+)'))
prevSearch = compile(tagre("a", "href", r'(%sindex\.php\?comicID=\d+)' % rurl) +
2013-03-12 20:23:26 +00:00
tagre("img", "src", r'images/prev_a\.gif'))
help = 'Index format: number'
2012-06-20 19:58:13 +00:00
class OurHomePlanet(_BasicScraper):
url = 'http://gdk.gd-kun.net/'
stripUrl = url + '%s.html'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % '01'
2012-06-20 19:58:13 +00:00
imageSearch = compile(r'<img src="(pages/comic.+?)"')
prevSearch = compile(r'coords="50,18,95,65".+?href="(.+?\.html)".+?alt=')
help = 'Index format: n (unpadded)'
class OverCompensating(_BasicScraper):
url = 'http://www.overcompensating.com/'
stripUrl = url + 'posts/%s.html'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % '20040929'
2012-06-20 19:58:13 +00:00
imageSearch = compile(r'<img src="(/comics/.+?)"')
prevSearch = compile(r'"><a href="(.+?)"[^>]+?>&nbsp;\<\- &nbsp;</a>')
help = 'Index format: yyyymmdd'