Fix index feature for GoComics (fixes #155)
This commit is contained in:
parent
3d0ab60642
commit
c4b7d5b930
4 changed files with 15 additions and 3 deletions
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
|
||||
# Copyright (C) 2012-2014 Bastian Kleineidam
|
||||
# Copyright (C) 2015-2019 Tobias Gruetzmacher
|
||||
# Copyright (C) 2015-2020 Tobias Gruetzmacher
|
||||
from ..scraper import _ParserScraper
|
||||
from ..helpers import indirectStarter, xpath_class
|
||||
|
||||
|
@ -27,7 +27,7 @@ class GoComics(_ParserScraper):
|
|||
return "%s_%s%s%s.gif" % (self.shortname, year, month, day)
|
||||
|
||||
def getIndexStripUrl(self, index):
|
||||
return self.url + self.path + '/%s' % index
|
||||
return '{}/{}'.format(self.url, index)
|
||||
|
||||
def shouldSkipUrl(self, url, data):
|
||||
"""Skip pages without images."""
|
||||
|
|
BIN
tests/responses/gocomics-page.html.gz
Normal file
BIN
tests/responses/gocomics-page.html.gz
Normal file
Binary file not shown.
BIN
tests/responses/gocomics-root.html.gz
Normal file
BIN
tests/responses/gocomics-root.html.gz
Normal file
Binary file not shown.
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2019 Tobias Gruetzmacher
|
||||
# Copyright (C) 2019-2020 Tobias Gruetzmacher
|
||||
import re
|
||||
|
||||
import pytest
|
||||
|
@ -27,3 +27,15 @@ class TestModules(object):
|
|||
httpmocks.png(re.compile(r'https://turnoff\.us/image/en/.*\.png'))
|
||||
|
||||
cmd('--numstrips', '2', '--basepath', str(tmpdir), 'turnoff')
|
||||
|
||||
@responses.activate
|
||||
def test_gocomics_index(self, tmpdir):
|
||||
httpmocks.page('https://www.gocomics.com/calvinandhobbesespanol',
|
||||
'gocomics-root')
|
||||
httpmocks.page(re.compile('.*espanol/2020/03/25'), 'gocomics-page')
|
||||
httpmocks.page(re.compile('.*espanol/2012/07/22'), 'gocomics-page')
|
||||
|
||||
httpmocks.png(re.compile(r'https://assets\..*'))
|
||||
|
||||
cmd('--basepath', str(tmpdir), 'CalvinAndHobbesEnEspanol')
|
||||
cmd('--basepath', str(tmpdir), 'CalvinAndHobbesEnEspanol:2012/07/22')
|
||||
|
|
Loading…
Reference in a new issue