Fix index feature for GoComics (fixes #155)

This commit is contained in:
Tobias Gruetzmacher 2020-03-26 00:43:43 +01:00
parent 3d0ab60642
commit c4b7d5b930
4 changed files with 15 additions and 3 deletions

View file

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
# Copyright (C) 2012-2014 Bastian Kleineidam # Copyright (C) 2012-2014 Bastian Kleineidam
# Copyright (C) 2015-2019 Tobias Gruetzmacher # Copyright (C) 2015-2020 Tobias Gruetzmacher
from ..scraper import _ParserScraper from ..scraper import _ParserScraper
from ..helpers import indirectStarter, xpath_class from ..helpers import indirectStarter, xpath_class
@ -27,7 +27,7 @@ class GoComics(_ParserScraper):
return "%s_%s%s%s.gif" % (self.shortname, year, month, day) return "%s_%s%s%s.gif" % (self.shortname, year, month, day)
def getIndexStripUrl(self, index): def getIndexStripUrl(self, index):
return self.url + self.path + '/%s' % index return '{}/{}'.format(self.url, index)
def shouldSkipUrl(self, url, data): def shouldSkipUrl(self, url, data):
"""Skip pages without images.""" """Skip pages without images."""

Binary file not shown.

Binary file not shown.

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2019 Tobias Gruetzmacher # Copyright (C) 2019-2020 Tobias Gruetzmacher
import re import re
import pytest import pytest
@ -27,3 +27,15 @@ class TestModules(object):
httpmocks.png(re.compile(r'https://turnoff\.us/image/en/.*\.png')) httpmocks.png(re.compile(r'https://turnoff\.us/image/en/.*\.png'))
cmd('--numstrips', '2', '--basepath', str(tmpdir), 'turnoff') 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')