diff --git a/dosagelib/plugins/gocomics.py b/dosagelib/plugins/gocomics.py index 0d7659dbe..86a7de793 100644 --- a/dosagelib/plugins/gocomics.py +++ b/dosagelib/plugins/gocomics.py @@ -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.""" diff --git a/tests/responses/gocomics-page.html.gz b/tests/responses/gocomics-page.html.gz new file mode 100644 index 000000000..4d8f1b3a1 Binary files /dev/null and b/tests/responses/gocomics-page.html.gz differ diff --git a/tests/responses/gocomics-root.html.gz b/tests/responses/gocomics-root.html.gz new file mode 100644 index 000000000..88b979393 Binary files /dev/null and b/tests/responses/gocomics-root.html.gz differ diff --git a/tests/test_modules.py b/tests/test_modules.py index 9dc2a0b58..9faa15674 100644 --- a/tests/test_modules.py +++ b/tests/test_modules.py @@ -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')