Fix Unsounded (fixes #107)

This commit is contained in:
Tobias Gruetzmacher 2020-01-09 22:21:20 +01:00
parent cfd7b80053
commit 42b5aa9321

View file

@ -8,7 +8,7 @@ from __future__ import absolute_import, division, print_function
from re import compile, escape from re import compile, escape
from ..scraper import _BasicScraper, _ParserScraper from ..scraper import _BasicScraper, _ParserScraper
from ..helpers import indirectStarter from ..helpers import indirectStarter, xpath_class
from ..util import tagre from ..util import tagre
from .common import _ComicControlScraper, _WordPressScraper, _WPNavi from .common import _ComicControlScraper, _WordPressScraper, _WPNavi
@ -54,18 +54,23 @@ class UnlikeMinerva(_ParserScraper):
help = 'Index format: number' help = 'Index format: number'
class Unsounded(_BasicScraper): class Unsounded(_ParserScraper):
url = 'http://www.casualvillain.com/Unsounded/' url = 'http://www.casualvillain.com/Unsounded/'
startUrl = url + 'comic+index/'
stripUrl = url + 'comic/ch%s/ch%s_%s.html' stripUrl = url + 'comic/ch%s/ch%s_%s.html'
firstStripUrl = stripUrl % ('01', '01', '01') firstStripUrl = stripUrl % ('01', '01', '01')
rurl = escape(url) imageSearch = '//img[contains(@src, "/pageart/ch")]'
imageSearch = compile(tagre("img", "src", r'(pageart/[^"]*)')) prevSearch = '//a[{}]'.format(xpath_class('back'))
prevSearch = compile(tagre("a", "href", r'([^"]*)', after='class="back')) latestSearch = '//div[@id="chapter_box"][1]//a[last()]'
latestSearch = compile(tagre("a", "href", r'(%scomic/[^"]*)' % rurl) + multipleImagesPerStrip = True
tagre("img", "src",
r"%simages/newpages\.png" % rurl))
starter = indirectStarter starter = indirectStarter
help = 'Index format: chapter-number' help = 'Index format: chapter-page'
def getPrevUrl(self, url, data):
# Fix missing navigation links between chapters
if 'ch13/you_let_me_fall' in url:
return self.stripUrl % ('13', '13', '85')
return super(Unsounded, self).getPrevUrl(url, data)
def getIndexStripUrl(self, index): def getIndexStripUrl(self, index):
"""Get comic strip URL from index.""" """Get comic strip URL from index."""