# -*- 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, IGNORECASE
from ..scraper import _BasicScraper
from ..util import tagre
from ..helpers import indirectStarter
from .common import _ComicControlScraper, _WordPressScraper
class WapsiSquare(_BasicScraper):
url = 'http://wapsisquare.com/'
rurl = escape(url)
stripUrl = url + 'comic/%s/'
firstStripUrl = stripUrl % '09092001'
imageSearch = compile(r']+?>Previous')
help = 'Index format: stripname'
class WastedTalent(_BasicScraper):
url = 'http://www.wastedtalent.ca/'
stripUrl = url + 'comic/%s'
firstStripUrl = stripUrl % 'anime-crack'
imageSearch = compile(tagre("img", "src", r'(http://www\.wastedtalent\.ca/sites/default/files/imagecache/comic_full/comics/\d+/[^"]+)'))
prevSearch = compile(tagre("a", "href", r'(/comic/[^"]+)',
after="comic_prev"))
help = 'Index format: stripname'
class WayfarersMoon(_BasicScraper):
url = 'http://www.wayfarersmoon.com/'
stripUrl = url + 'index.php?page=%s'
firstStripUrl = stripUrl % '0'
imageSearch = compile(r'')
help = 'Index format: nnn'
class WorldOfMrToast(_BasicScraper):
baseUrl = 'http://www.theimaginaryworld.com/'
url = baseUrl + 'mrTcomicA.html'
stripUrl = baseUrl + '%s.html'
imageSearch = compile(tagre("img", "src", r'(comic[^"]+)'))
# list the archive links since there is no prev/next navigation
prevurls = (
url,
baseUrl + 'mrTcomicW02.html',
baseUrl + 'mrTcomicW01.html',
baseUrl + 'mrGcomic03.html',
baseUrl + 'mrGcomic02.html',
baseUrl + 'mrGcomic01.html',
baseUrl + 'mrTcomicT05.html',
baseUrl + 'mrTcomicT04.html',
baseUrl + 'mrTcomicT03.html',
baseUrl + 'mrTcomicT02.html',
baseUrl + 'mrTcomicT01.html',
baseUrl + 'mrTcomicIW3.html',
baseUrl + 'mrTcomicIW2.html',
baseUrl + 'mrTcomicIW1.html',
)
firstStripUrl = prevurls[-1]
multipleImagesPerStrip = True
help = 'Index format: none'
def getPrevUrl(self, url, data, baseUrl):
idx = self.prevurls.index(url)
try:
return self.prevurls[idx + 1]
except IndexError:
return None
class WorldOfWarcraftEh(_WordPressScraper):
url = 'http://woweh.com/'
class WormWorldSaga(_BasicScraper):
url = 'http://www.wormworldsaga.com/'
stripUrl = url + 'chapters/%s/index.php'
firstStripUrl = stripUrl % 'chapter01/EN'
imageSearch = (
compile(tagre("img", "src", r'(images/CH\d+_\d+\.[^"]+)')),
compile(tagre("img", "src", r'(panels/CH\d+_[^"]+)')),
)
latestChapter = 5
multipleImagesPerStrip = True
def starter(self):
return '%schapters/chapter%02d/%s/index.php' % (
self.url, self.latestChapter, self.lang.upper())
def getPrevUrl(self, url, data):
"""Find previous URL."""
if 'chapter04' in url:
return url.replace('chapter04', 'chapter03')
if 'chapter03' in url:
return url.replace('chapter03', 'chapter02')
if 'chapter02' in url:
return url.replace('chapter02', 'chapter01')
return None
class WormWorldSagaFrench(WormWorldSaga):
lang = 'fr'
class WormWorldSagaGerman(WormWorldSaga):
lang = 'de'
class WormWorldSagaSpanish(WormWorldSaga):
lang = 'es'