# -*- coding: utf-8 -*- # Copyright (C) 2004-2005 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam # Copyright (C) 2015-2016 Tobias Gruetzmacher from __future__ import absolute_import, division, print_function from re import compile, escape from ..scraper import _BasicScraper, _ParserScraper from ..util import tagre from .common import _WordPressScraper, xpath_class class OctopusPie(_ParserScraper): url = 'http://www.octopuspie.com/' rurl = escape(url) stripUrl = url + '%s/' firstStripUrl = stripUrl % '2007-05-14/001-pea-wiggle' imageSearch = '//img[@title]' prevSearch = '//a[@rel="prev"]' help = 'Index format: yyyy-mm-dd/nnn-strip-name' class Oglaf(_BasicScraper): url = 'http://oglaf.com/' stripUrl = url + '%s/' imageSearch = compile(tagre("img", "src", r'(http://media\.oglaf\.com/comic/[^"]+)', before="strip")) 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' adult = True class OhJoySexToy(_WordPressScraper): url = 'http://www.ohjoysextoy.com/' firstStripUrl = url + 'introduction/' prevSearch = '//a[%s]' % xpath_class('navi-prev') textSearch = '//div[@id="comic"]//img/@alt' adult = True class OkCancel(_BasicScraper): url = 'http://okcancel.com/' rurl = escape(url) stripUrl = url + 'comic/%s.html' 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)) help = 'Index format: yyyymmdd' class OmakeTheater(_ParserScraper): url = 'http://omaketheater.com/comics/' stripUrl = url + '%s/' firstStripUrl = stripUrl % '1' css = True imageSearch = ".comicImage img" prevSearch = ".previous a" help = 'Index format: number (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">