Fix xkcd pages where comic is linked

This commit is contained in:
Tobias Gruetzmacher 2019-12-05 07:10:49 +01:00
parent ad8a46f67a
commit 4511bab996

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-2017 Tobias Gruetzmacher # Copyright (C) 2015-2019 Tobias Gruetzmacher
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
@ -15,11 +15,11 @@ class Xkcd(_ParserScraper):
starter = bounceStarter starter = bounceStarter
stripUrl = url + '%s/' stripUrl = url + '%s/'
firstStripUrl = stripUrl % '1' firstStripUrl = stripUrl % '1'
imageSearch = '//div[@id="comic"]/img' imageSearch = '//div[@id="comic"]//img'
prevSearch = '//a[@rel="prev"]' prevSearch = '//a[@rel="prev"]'
nextSearch = '//a[@rel="next"]' nextSearch = '//a[@rel="next"]'
help = 'Index format: n (unpadded)' help = 'Index format: n (unpadded)'
textSearch = '//div[@id="comic"]/img/@title' textSearch = '//div[@id="comic"]//img/@title'
def namer(self, image_url, page_url): def namer(self, image_url, page_url):
index = int(page_url.rstrip('/').rsplit('/', 1)[-1]) index = int(page_url.rstrip('/').rsplit('/', 1)[-1])