dosage/dosagelib/plugins/o.py

140 lines
4.9 KiB
Python
Raw Normal View History

# -*- coding: utf-8 -*-
# Copyright (C) 2004-2005 Tristan Seligmann and Jonathan Jacobs
2014-01-05 15:50:57 +00:00
# Copyright (C) 2012-2014 Bastian Kleineidam
# Copyright (C) 2015-2016 Tobias Gruetzmacher
2012-06-20 19:58:13 +00:00
from __future__ import absolute_import, division, print_function
from re import compile, escape
2015-04-26 11:32:22 +00:00
from ..scraper import _BasicScraper, _ParserScraper
2012-10-11 10:03:12 +00:00
from ..helpers import indirectStarter
2014-03-26 18:59:42 +00:00
from ..util import tagre
from .common import _WordPressScraper, xpath_class
2012-06-20 19:58:13 +00:00
2015-05-14 11:06:12 +00:00
class OctopusPie(_ParserScraper):
url = 'http://www.octopuspie.com/'
rurl = escape(url)
2013-04-10 21:57:09 +00:00
stripUrl = url + '%s/'
firstStripUrl = stripUrl % '2007-05-14/001-pea-wiggle'
2015-05-14 11:06:12 +00:00
imageSearch = '//img[@title]'
prevSearch = '//a[@rel="prev"]'
2012-06-20 19:58:13 +00:00
help = 'Index format: yyyy-mm-dd/nnn-strip-name'
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"))
2013-11-07 19:47:31 +00:00
prevSearch = (
# first search for "next page" URLs
compile(tagre("a", "href", r'(/[^"]+/\d+/)') + tagre("div", "id", "nx")),
# then for "prev story"
compile(tagre("a", "href", r'(/[^"]+)') + tagre("div", "id", "pvs?")),
)
help = 'Index format: stripname'
2013-04-04 16:30:02 +00:00
adult = True
2013-03-06 19:21:10 +00:00
class OhJoySexToy(_WordPressScraper):
2014-01-31 03:45:50 +00:00
url = 'http://www.ohjoysextoy.com/'
firstStripUrl = url + 'introduction/'
prevSearch = '//a[%s]' % xpath_class('navi-prev')
textSearch = '//div[@id="comic"]//img/@alt'
2014-01-31 03:45:50 +00:00
adult = True
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'
2015-04-26 11:32:22 +00:00
class OmakeTheater(_ParserScraper):
url = 'http://omaketheater.com/comics/'
stripUrl = url + '%s/'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % '1'
2015-04-26 11:32:22 +00:00
css = True
imageSearch = ".comicImage img"
prevSearch = ".previous a"
2013-02-06 21:27:40 +00:00
help = 'Index format: number (unpadded)'
class OneQuestion(_BasicScraper):
url = 'http://onequestioncomic.com/'
stripUrl = url + 'comic.php?strip_id=%s'
firstStripUrl = stripUrl % '1'
imageSearch = compile(tagre("img", "src", r'((?:\.\./)?istrip_files/strips/\d+\.\w{3,4})'))
prevSearch = compile(tagre("a", "href", r'(comic\.php\?strip_id=\d+)') +
tagre("img", "src", r'img/arrow_prev\.jpg'))
help = 'Index format: n (unpadded)'
class OnTheEdge(_WordPressScraper):
url = 'http://ontheedgecomics.com/'
firstStripUrl = 'http://ontheedgecomics.com/comic/ote0001/'
class OnTheFastrack(_BasicScraper):
url = 'http://onthefastrack.com/'
stripUrl = url + 'comics/%s'
firstStripUrl = stripUrl % 'november-13-2000'
imageSearch = compile(r'(http://safr\.kingfeatures\.com/idn/cnfeed/zone/js/content\.php\?file=.+)"')
prevSearch = compile(r'id="previouscomic" class="button white"><a href="(%scomics/[a-z0-9-]+/)"' % url)
help = 'Index format: monthname-dd-yyyy'
@classmethod
def namer(cls, imageUrl, pageUrl):
name = pageUrl.rsplit('/', 3)[2]
if name == "onthefastrack.com":
import datetime
name = datetime.date.today().strftime("%B-%d-%Y")
# name.title ensures that the comics are named the same
# as in the previous scraper
return "%s.gif" % name.title()
2013-06-24 18:19:33 +00:00
class Optipess(_WordPressScraper):
2014-09-29 02:41:29 +00:00
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'
2014-09-29 02:41:29 +00:00
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) +
tagre("img", "src", r'images/prev_a\.gif'))
2013-03-12 20:23:26 +00:00
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/'
2013-11-12 17:33:14 +00:00
stripUrl = url + 'oc/index.php?comic=%s'
2013-07-18 18:39:53 +00:00
firstStripUrl = stripUrl % '0'
2013-11-12 17:33:14 +00:00
imageSearch = compile(tagre("img", "src", r'(/oc/comics/[^"]+)'))
prevSearch = compile(tagre("a", "href", r'(/oc/index\.php\?comic=\d+)',
after="go back"))
2013-07-18 18:39:53 +00:00
help = 'Index format: number'