dosage/dosagelib/plugins/s.py

537 lines
19 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-11-21 20:57:26 +00:00
from __future__ import absolute_import, division, print_function
2013-11-07 20:22:49 +00:00
from re import compile, escape, IGNORECASE, sub
from os.path import splitext
import datetime
from ..scraper import _BasicScraper, _ParserScraper
from ..helpers import indirectStarter, bounceStarter
2016-04-05 22:40:13 +00:00
from ..util import tagre
from .common import (_ComicControlScraper, _WordPressScraper, WP_LATEST_SEARCH,
xpath_class)
2013-04-25 19:14:32 +00:00
class SabrinaOnline(_BasicScraper):
2013-04-26 04:53:05 +00:00
url = 'http://sabrina-online.com/'
2016-04-05 22:40:13 +00:00
stripUrl = url + '%s.html'
firstStripUrl = stripUrl % '1996-01'
2013-04-25 19:14:32 +00:00
imageSearch = compile(tagre("a", "href", r'(strips/[^"]*)'))
prevSearch = compile(tagre("a", "href", r"(\d\d\d\d-\d\d.html)") +
tagre("img", "src", "b_back.gif"))
2016-04-05 22:40:13 +00:00
help = 'Index format: yyyy-qq'
2013-04-25 19:14:32 +00:00
adult = True
multipleImagesPerStrip = True
def starter(self):
2013-04-25 19:14:32 +00:00
"""Pick last one in a list of archive pages."""
archive = self.url + 'archive.html'
data = self.getPage(archive)
2013-04-25 19:14:32 +00:00
search = compile(tagre("a", "href", r"(\d\d\d\d-\d\d.html)"))
archivepages = self.fetchUrls(archive, data, search)
2016-04-05 22:40:13 +00:00
return archivepages[-1]
2012-06-20 19:58:13 +00:00
2015-05-25 09:57:06 +00:00
class SafelyEndangered(_WordPressScraper):
2014-06-17 05:05:11 +00:00
url = 'http://www.safelyendangered.com/'
firstStripUrl = url + 'comic/ignored/'
prevSearch = '//a[%s]' % xpath_class('navi-prev')
2012-06-20 19:58:13 +00:00
class SailorsunOrg(_WordPressScraper):
url = 'http://sailorsun.org/'
2016-05-05 18:55:14 +00:00
class SamAndFuzzy(_ParserScraper):
url = 'http://www.samandfuzzy.com/'
2016-05-05 18:55:14 +00:00
stripUrl = url + '%s'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % '1'
2016-05-05 18:55:14 +00:00
imageSearch = '//img[@class="comic-image"]'
prevSearch = '//li[@class="prev-page"]/a'
help = 'Index format: n (unpadded)'
2012-06-20 19:58:13 +00:00
2015-05-25 09:57:06 +00:00
2013-04-20 16:51:06 +00:00
class SandraOnTheRocks(_BasicScraper):
url = 'http://www.sandraontherocks.com/'
stripUrl = url + 'strips-sotr/%s'
2013-04-20 16:51:06 +00:00
firstStripUrl = stripUrl % 'start_by_running'
imageSearch = compile(tagre("img", "src", r'([^"]*/comics/[^"]+)'))
prevSearch = compile(tagre("a", "href", r'([^"]*/strips-sotr/[^"]+)', before="cn[id]prev"))
2013-04-20 16:51:06 +00:00
help = 'Index format: name'
2013-03-19 19:54:16 +00:00
2015-05-25 09:57:06 +00:00
2015-06-04 06:58:59 +00:00
class ScandinaviaAndTheWorld(_ParserScraper):
url = 'http://satwcomic.com/'
2014-07-02 17:51:53 +00:00
stripUrl = url + '%s'
firstStripUrl = stripUrl % 'sweden-denmark-and-norway'
starter = indirectStarter
2015-06-04 06:58:59 +00:00
imageSearch = '//img[@itemprop="image"]'
prevSearch = '//a[@accesskey="p"]'
latestSearch = '//a[text()="View latest comic"]'
2015-07-07 07:48:25 +00:00
textSearch = '//span[@itemprop="articleBody"]'
help = 'Index format: stripname'
2015-05-25 09:57:06 +00:00
2016-04-26 22:31:27 +00:00
class ScaryGoRound(_ParserScraper):
url = 'http://www.scarygoround.com/sgr/ar.php'
2016-05-05 18:55:14 +00:00
stripUrl = url + '?date=%s'
2016-04-26 22:31:27 +00:00
firstStripUrl = stripUrl % '20020604'
imageSearch = '//img[contains(@src, "/strips/")]'
prevSearch = '//a[contains(text(), "Previous")]'
endOfLife = True
help = 'Index format: yyyymmdd'
2012-06-20 19:58:13 +00:00
2013-02-06 21:08:36 +00:00
class ScenesFromAMultiverse(_BasicScraper):
url = 'http://amultiverse.com/'
rurl = escape(url)
2013-02-06 21:08:36 +00:00
stripUrl = url + '%s/'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % '2010/06/14/parenthood'
2013-11-12 17:33:14 +00:00
imageSearch = (
compile(tagre("div", "id", "comic") + r"\s*" +
tagre("img", "src",
r'(.*amultiverse.com/wp-content/uploads/\d+/\d+/[^"]+)')),
compile(tagre("div", "id", "comic") + r"\s*" +
tagre("a", "href", r'[^"]*') +
tagre("img", "src",
r'(.*amultiverse.com/wp-content/uploads/\d+/\d+/[^"]+)')),
2013-11-12 17:33:14 +00:00
)
prevSearch = compile(tagre("a", "href", r'(%scomic/\d+\d+/\d+/\d+/[^"]+)' % rurl, after="prev"))
2013-02-06 21:08:36 +00:00
help = 'Index format: yyyy/mm/dd/stripname'
2016-05-05 18:55:14 +00:00
class SchlockMercenary(_ParserScraper):
url = 'http://www.schlockmercenary.com/'
stripUrl = url + '%s'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % '2000-06-12'
2016-05-05 18:55:14 +00:00
imageSearch = '//div[@class="strip-image-wrapper"]/img'
2012-12-04 06:02:40 +00:00
multipleImagesPerStrip = True
2016-05-05 18:55:14 +00:00
prevSearch = '//a[@class="previous-strip"]'
2012-11-21 20:57:26 +00:00
help = 'Index format: yyyy-mm-dd'
2012-06-20 19:58:13 +00:00
class SchoolBites(_BasicScraper):
url = 'http://schoolbites.net/'
stripUrl = url + 'd/%s.html'
2012-11-21 20:57:26 +00:00
imageSearch = compile(tagre("img", "src", r'(http://cdn\.schoolbites\.net/comics/[^"]+)'))
prevSearch = compile(tagre("a", "href", r'(http://schoolbites\.net/d/\d+\.html)', after="prev"))
2012-06-20 19:58:13 +00:00
help = 'Index format: yyyymmdd'
2013-03-25 18:48:32 +00:00
class Schuelert(_BasicScraper):
url = 'http://www.schuelert.de/'
rurl = escape(url)
2013-04-10 21:57:09 +00:00
stripUrl = url + 'index.php?paged=%s'
firstStripUrl = stripUrl % '5'
imageSearch = compile(tagre("img", "src", r"(%swp-content/[^']+)" % rurl, quote="'"))
prevSearch = compile(tagre("a", "href", r'(%sindex\.php\?paged=\d+)' % rurl) + "«")
2013-03-25 18:48:32 +00:00
multipleImagesPerStrip = True
help = 'Index format: none'
lang = 'de'
2013-04-09 17:38:16 +00:00
class Science(_BasicScraper):
url = 'http://sci-ence.org/'
rurl = escape(url)
2013-04-09 17:38:16 +00:00
stripUrl = url + '%s/'
firstStripUrl = stripUrl % 'periodic-table-element-ass'
prevSearch = compile(tagre("a", "href", r'(%s[^"]+/)' % rurl, after="prev"))
imageSearch = compile(tagre("img", "src", r'(%scomics/\d+-\d+-\d+[^"]+)' % rurl))
2013-04-09 17:38:16 +00:00
help = 'Index format: stripname'
class ScurryAndCover(_ParserScraper):
url = 'http://scurry.ink'
prevSearch = '//div[@id="prevpage"]/..'
nextSearch = '//div[@id="nextpage"]/..'
imageSearch = 'MARKER'
def fetchUrls(self, url, data, urlsearch):
if urlsearch != self.imageSearch:
return super(ScurryAndCover, self).fetchUrls(url, data, urlsearch)
# get javascript element and parse a variable value
scripts = data.xpath('//body/script[@type="text/javascript"]')
regex = compile("var fileRoot = '([^']+)")
for script in scripts:
images = regex.findall(script.text)
if len(images) > 0:
image = images[0]
return [self.url + '/images/pages/' + image + '-xsmall.png']
def starter(self):
"""Go forward as far as possibe, then start."""
url = self.url
while True:
data = self.getPage(url)
try:
url = self.fetchUrl(url, data, self.nextSearch)
except ValueError:
break
return url
2013-01-29 20:23:32 +00:00
class SequentialArt(_BasicScraper):
url = 'http://www.collectedcurios.com/sequentialart.php'
stripUrl = url + '?s=%s'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % '1'
2013-01-29 20:23:32 +00:00
imageSearch = compile(tagre("img", "src", r'([^"]+)', before="strip"))
prevSearch = compile(tagre("a", "href", r'(/sequentialart\.php\?s=\d+)') +
tagre("img", "src", "Nav_BackOne\.gif"))
2013-01-29 20:23:32 +00:00
help = 'Index format: name'
2016-04-26 22:31:27 +00:00
class SexyLosers(_ParserScraper):
2013-03-06 19:21:10 +00:00
adult = True
url = 'http://www.sexylosers.com/'
2016-04-26 22:31:27 +00:00
stripUrl = url + 'comic/%s/'
firstStripUrl = stripUrl % '003'
imageSearch = '//div[@class="entry-content"]//img'
prevSearch = '//a[@rel="prev"]'
latestSearch = '//a[@rel="bookmark"]'
2013-03-06 19:21:10 +00:00
help = 'Index format: nnn'
starter = indirectStarter
2013-03-06 19:21:10 +00:00
def namer(self, image_url, page_url):
2016-04-26 22:31:27 +00:00
index = page_url.rsplit('/', 2)[1]
title = image_url.rsplit('/', 1)[1]
2013-03-06 19:21:10 +00:00
return index + '-' + title
class Sharksplode(_WordPressScraper):
url = 'http://sharksplode.com/'
textSearch = '//div[@id="comic"]//img/@alt'
class Sheldon(_BasicScraper):
url = 'http://www.sheldoncomics.com/'
2013-07-09 20:21:17 +00:00
rurl = escape(url)
stripUrl = url + 'archive/%s.html'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % '011130'
2013-07-09 20:21:17 +00:00
imageSearch = compile(tagre("img", "src", r'(http://cdn\.sheldoncomics\.com/strips/[^"]+)'))
prevSearch = compile(tagre("a", "href", r'(%sarchive/\d+\.html)' % rurl,
after="sidenav-prev"))
2012-11-21 20:57:26 +00:00
help = 'Index format: yymmdd'
2013-07-04 18:20:26 +00:00
class ShermansLagoon(_BasicScraper):
url = 'http://shermanslagoon.com/'
stripUrl = url + 'comics/%s'
firstStripUrl = stripUrl % '/december-29-2003/'
2016-04-02 17:12:26 +00:00
imageSearch = compile(tagre("img", "src", r'(https://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-day-year'
2013-07-04 18:20:26 +00:00
def namer(self, image_url, page_url):
name = page_url.rsplit('/', 3)[2]
if name == "shermanslagoon.com":
name = datetime.date.today().strftime("%B-%d-%Y").lower()
2013-07-04 18:20:26 +00:00
# name is monthname-day-year
month, day, year = name.split('-')
return "%s-%s-%s" % (year, month, day)
class Shivae(_WordPressScraper):
url = 'http://shivae.com/'
firstStripUrl = url + 'gnip/ck-chapter-01/caidenkoel-title-01/'
2012-12-08 20:30:51 +00:00
class Shortpacked(_ParserScraper):
url = 'http://www.shortpacked.com/index.php'
stripUrl = url + '?id=%s'
css = True
imageSearch = 'img#comic'
prevSearch = 'a.prev'
help = 'Index format: nnn'
class ShotgunShuffle(_WordPressScraper):
2014-09-28 13:29:02 +00:00
url = 'http://shotgunshuffle.com/'
firstStripUrl = url + 'comic/pilot/'
2014-09-28 13:29:02 +00:00
2012-06-20 19:58:13 +00:00
class SinFest(_BasicScraper):
name = 'KeenSpot/SinFest'
url = 'http://www.sinfest.net/'
stripUrl = url + 'view.php?date=%s'
imageSearch = compile(tagre("img", "src", r'(btphp/comics/.+)',
after="alt"))
prevSearch = compile(tagre("a", "href", r'(view\.php\?date=.+)') + '\\s*' +
tagre("img", "src", r'\.\./images/prev\.gif'))
help = 'Index format: yyyy-mm-dd'
2012-06-20 19:58:13 +00:00
2016-05-05 18:55:14 +00:00
class Sithrah(_ParserScraper):
url = 'http://sithrah.com/'
2016-05-05 18:55:14 +00:00
imageSearch = '//div[@class="webcomic-image"]/img'
prevSearch = '//a[%s]' % xpath_class('previous-webcomic-link')
class SkinDeep(_BasicScraper):
url = 'http://www.skindeepcomic.com/'
stripUrl = url + 'archive/%s/'
imageSearch = compile(r'<span class="webcomic-object[^>]*><img src="([^"]*)"')
prevSearch = compile(tagre("a", "href", r'([^"]+)',
after="previous-webcomic-link"))
help = 'Index format: custom'
class SleeplessDomain(_ComicControlScraper):
2015-07-12 16:31:21 +00:00
url = 'http://www.sleeplessdomain.com/'
2016-05-05 18:55:14 +00:00
class SlightlyDamned(_ComicControlScraper):
url = 'http://www.sdamned.com/'
2016-05-05 18:55:14 +00:00
firstStripUrl = url + 'comic/part-one-to-hell-and-back'
2012-06-20 19:58:13 +00:00
class SluggyFreelance(_BasicScraper):
url = 'http://www.sluggy.com/'
stripUrl = url + 'comics/archives/daily/%s'
2012-06-20 19:58:13 +00:00
imageSearch = compile(r'<img src="(/images/comics/.+?)"')
prevSearch = compile(r'<a href="(.+?)"[^>]+?><span class="ui-icon ui-icon-seek-prev">')
multipleImagesPerStrip = True
2012-06-20 19:58:13 +00:00
help = 'Index format: yymmdd'
class SMBC(_ParserScraper):
2013-03-06 19:21:10 +00:00
url = 'http://www.smbc-comics.com/'
2016-05-05 18:55:14 +00:00
stripUrl = url + 'index.php?id=%s'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % '1'
multipleImagesPerStrip = True
imageSearch = ['//img[@id="comic"]', '//div[@id="aftercomic"]/img']
prevSearch = '//a[@class="prev"]'
2013-03-06 19:21:10 +00:00
help = 'Index format: nnnn'
textSearch = '//img[@id="comic"]/@title'
2013-03-06 19:21:10 +00:00
def namer(self, image_url, page_url):
"""Remove random noise from name."""
return image_url.rsplit('-', 1)[-1]
def shouldSkipUrl(self, url, data):
2013-04-25 18:32:21 +00:00
"""Skip promo or missing update pages."""
return url in (
self.stripUrl % '2865',
self.stripUrl % '2653',
self.stripUrl % '2424',
self.stripUrl % '2226',
self.stripUrl % '2069',
self.stripUrl % '1895',
self.stripUrl % '1896',
self.stripUrl % '1589',
)
2013-03-06 19:21:10 +00:00
2016-04-05 22:40:13 +00:00
class SnowFlame(_WordPressScraper):
url = 'http://www.snowflamecomic.com/'
stripUrl = url + '?comic=snowflame-%s-%s'
firstStripUrl = stripUrl % ('01', '01')
starter = bounceStarter
nextSearch = WP_LATEST_SEARCH
help = 'Index format: chapter-page'
def getIndexStripUrl(self, index):
return self.stripUrl % tuple(index.split('-'))
def namer(self, image_url, page_url):
prefix, filename = image_url.rsplit('/', 1)
ro = compile(r'snowflame-([^-]+)-([^-]+)')
mo = ro.search(page_url)
chapter = mo.group(1)
page = mo.group(2)
return "%s-%s-%s" % (chapter, page, filename)
2016-04-05 22:40:13 +00:00
class SodiumEyes(_WordPressScraper):
url = 'http://sodiumeyes.com/'
2012-06-20 19:58:13 +00:00
class SomethingPositive(_BasicScraper):
url = 'http://www.somethingpositive.net/'
stripUrl = url + 'sp%s.shtml'
imageSearch = (
compile(tagre("img", "src", r'(sp\d+\.png)')),
compile(tagre("img", "src", r'(twither\.gif)')),
)
prevSearch = compile(tagre("a", "href", r'(sp\d+\.shtml)') + "(?:" +
tagre("img", "src", r'images/previous\.gif') +
"|Previous)")
help = 'Index format: mmddyyyy'
2016-05-05 18:55:14 +00:00
class Sorcery101(_ParserScraper):
baseUrl = 'http://www.sorcery101.net/sorcery-101/'
stripUrl = baseUrl + '%s/'
url = stripUrl % 'sorcery101-ch-01'
firstStripUrl = url
imageSearch = '//div[@class="webcomic-image"]/img'
prevSearch = '//a[@rel="prev"]'
latestSearch = '//a[%s]' % xpath_class('last-webcomic-link')
starter = indirectStarter
2012-12-08 20:30:51 +00:00
help = 'Index format: stripname'
2016-04-05 22:40:13 +00:00
class SpaceTrawler(_WordPressScraper):
base_url = 'http://spacetrawler.com/'
url = base_url + '2013/12/24/spacetrawler-379/'
firstStripUrl = base_url + '2010/01/01/spacetrawler-4/'
prevSearch = '//a[%s]' % xpath_class('navi-prev')
2016-04-05 22:40:13 +00:00
endOfLife = True
2013-02-06 21:08:36 +00:00
2013-04-10 16:36:33 +00:00
class Spamusement(_BasicScraper):
url = 'http://spamusement.com/'
rurl = escape(url)
stripUrl = url + 'index.php/comics/view/%s'
imageSearch = compile(r'<img src="(%sgfx/\d+\..+?)"' % rurl, IGNORECASE)
prevSearch = compile(r'<a href="(%sindex.php/comics/view/.+?)">' % rurl,
IGNORECASE)
latestSearch = prevSearch
2013-04-10 16:36:33 +00:00
help = 'Index format: n (unpadded)'
starter = indirectStarter
2013-04-10 16:36:33 +00:00
2012-06-20 19:58:13 +00:00
class SpareParts(_BasicScraper):
2012-11-21 20:57:26 +00:00
baseUrl = 'http://www.sparepartscomics.com/'
url = baseUrl + 'comics/?date=20080328'
2012-12-04 06:02:40 +00:00
stripUrl = baseUrl + 'comics/index.php?date=%s'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % '20031022'
2012-12-04 06:02:40 +00:00
imageSearch = compile(tagre("img", "src", r'(http://www\.sparepartscomics\.com/comics/[^"]+)'))
prevSearch = compile(tagre("a", "href", r'(index\.php\?date=\d+)',
quote="'") + "Previous Comic")
help = 'Index format: yyyymmdd'
2012-06-20 19:58:13 +00:00
class Spinnerette(_ComicControlScraper):
url = 'http://www.spinnyverse.com'
class SPQRBlues(_WordPressScraper):
url = 'http://spqrblues.com/IV/'
class StandStillStaySilent(_ParserScraper):
url = 'http://www.sssscomic.com/comic.php'
stripUrl = url + '?page=%s'
firstStripUrl = stripUrl % '1'
imageSearch = '//img[@class="comicnormal"]'
2016-04-05 22:40:13 +00:00
prevSearch = '//a[div[@id="navprev"]]'
help = 'Index Format: number'
2016-04-05 22:40:13 +00:00
class StarCrossdDestiny(_ParserScraper):
2016-05-05 18:55:14 +00:00
baseUrl = 'http://starcrossd.net/'
url = baseUrl + 'comic.html'
stripUrl = baseUrl + 'archives/%s.html'
firstStripUrl = stripUrl % '00000001'
2016-04-05 22:40:13 +00:00
imageSearch = '//div[@id="comic"]//img'
prevSearch = '//a[text()="prev"]'
help = 'Index format: nnnnnnnn'
def namer(self, image_url, page_url):
if image_url.find('ch1') == -1:
# At first all images were stored in a strips/ directory but
# that was changed with the introduction of book2
image_url = sub('(?:strips)|(?:images)', 'book1', image_url)
elif not image_url.find('strips') == -1:
image_url = image_url.replace('strips/', '')
directory, filename = image_url.split('/')[-2:]
filename, extension = splitext(filename)
return directory + '-' + filename
class StationV3(_ParserScraper):
url = 'http://www.stationv3.com/'
2016-05-05 18:55:14 +00:00
stripUrl = url + 'd2/%s.html'
firstStripUrl = stripUrl % '20150628'
imageSearch = '//img[contains(@src,"/comics2/")]'
prevSearch = '//a[img[contains(@src,"/previous2")]]'
2012-12-08 20:30:51 +00:00
help = 'Index format: yyyymmdd'
class StickyDillyBuns(_BasicScraper):
url = 'http://www.stickydillybuns.com/'
stripUrl = url + 'strips-sdb/%s'
2013-04-10 21:57:09 +00:00
firstStripUrl = stripUrl % 'awesome_leading_man'
imageSearch = compile(tagre("img", "src", r'([^"]*/comics/[^"]+)'))
prevSearch = compile(tagre("a", "href", r'([^"]*/strips-sdb/[^"]+)',
before="cn[id]prev"))
help = 'Index format: name'
class StreetFighter(_ComicControlScraper):
url = 'http://www.streetfightercomics.com'
2016-06-01 11:19:17 +00:00
class StringTheory(_WordPressScraper):
url = 'http://www.stringtheorycomic.com/'
firstStripUrl = url + 'comics/chapterone/chapterone/'
prevSearch = '//a[%s]' % xpath_class('navi-prev')
class StrongFemaleProtagonist(_ParserScraper):
url = 'http://strongfemaleprotagonist.com/'
stripUrl = url + '%s/'
css = True
2016-04-05 22:40:13 +00:00
imageSearch = 'article p img'
prevSearch = 'div.nav-previous > a'
help = 'Index format: issue-?/page-??'
def shouldSkipUrl(self, url, data):
"""Skip hiatus & non-comic pages."""
return url in (
self.stripUrl % 'guest-art/tuesday',
self.stripUrl % 'guest-art/friday',
self.stripUrl % 'guest-art/wednesday',
self.stripUrl % 'issue-5/newspaper',
self.stripUrl % 'issue-5/hiatus-1',
self.stripUrl % 'issue-5/hiatus-2',
2016-04-05 22:40:13 +00:00
self.stripUrl % 'ssue-1/no-page',
)
2013-04-03 18:30:29 +00:00
class StuffNoOneToldMe(_BasicScraper):
url = 'http://www.snotm.com/'
stripUrl = url + '%s.html'
firstStripUrl = stripUrl % '2010/05/01'
olderHref = r"(http://www\.snotm\.com/\d+/\d+/[^']+\.html)"
starter = indirectStarter
2013-04-03 18:30:29 +00:00
imageSearch = (
compile(tagre("img", "src", r'(http://i\.imgur\.com/[^"]+)') +
r"(?:</a>|<br />)"),
compile(tagre("img", "src", r'(http://\d+\.bp\.blogspot\.com/[^"]+)') +
r"(?:(?:&nbsp;)?</a>|<span |<br />)"),
2013-04-03 18:30:29 +00:00
compile(tagre("img", "src", r'(https://lh\d+\.googleusercontent\.com/[^"]+)') + r"</a>"),
)
prevSearch = compile(tagre("a", "href", olderHref, quote="'",
before="older-link"))
latestSearch = compile(tagre("a", "href", olderHref, quote="'"))
2013-04-03 18:30:29 +00:00
multipleImagesPerStrip = True
help = 'Index format: yyyy/mm/stripname'
def namer(self, image_url, page_url):
2013-04-03 18:30:29 +00:00
"""Use page URL to construct meaningful image name."""
parts, year, month, stripname = page_url.rsplit('/', 3)
2013-04-03 18:30:29 +00:00
stripname = stripname.rsplit('.', 1)[0]
parts, imagename = image_url.rsplit('/', 1)
2013-04-03 18:30:29 +00:00
return '%s-%s-%s-%s' % (year, month, stripname, imagename)
def shouldSkipUrl(self, url, data):
2013-04-03 18:30:29 +00:00
"""Skip pages without images."""
return url in (
self.stripUrl % '2012/08/self-rant', # no comic
self.stripUrl % '2012/06/if-you-wonder-where-ive-been', # video
self.stripUrl % '2011/10/i-didnt-make-this-nor-have-anything-to', # video
self.stripUrl % '2010/12/first-snotm-fans-in-sao-paulo', # no comic
self.stripUrl % '2010/11/ear-infection', # no comic
2013-04-03 18:30:29 +00:00
)
2016-04-05 22:40:13 +00:00
class SupernormalStep(_ComicControlScraper):
2013-02-13 16:53:11 +00:00
url = 'http://supernormalstep.com/'