From e393ccdce100e48c0ffe6934a91914345c72009c Mon Sep 17 00:00:00 2001 From: Tobias Gruetzmacher Date: Thu, 9 Jan 2020 23:36:05 +0100 Subject: [PATCH] Fix Qwantz --- dosagelib/plugins/q.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/dosagelib/plugins/q.py b/dosagelib/plugins/q.py index 2d80d88a6..1959a203e 100644 --- a/dosagelib/plugins/q.py +++ b/dosagelib/plugins/q.py @@ -1,13 +1,12 @@ # -*- coding: utf-8 -*- # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam -# Copyright (C) 2015-2017 Tobias Gruetzmacher +# Copyright (C) 2015-2020 Tobias Gruetzmacher from __future__ import absolute_import, division, print_function -from re import compile, escape -from ..scraper import _BasicScraper, _ParserScraper -from ..util import tagre +from ..scraper import _ParserScraper +from ..helpers import xpath_class class QuantumVibe(_ParserScraper): @@ -35,12 +34,10 @@ class QuestionableContent(_ParserScraper): help = 'Index format: n (unpadded)' -class Qwantz(_BasicScraper): - baseUrl = 'http://www.qwantz.com/' - url = baseUrl + 'index.php' - rurl = escape(baseUrl) +class Qwantz(_ParserScraper): + url = 'http://www.qwantz.com/index.php' stripUrl = url + '?comic=%s' firstStripUrl = stripUrl % '1' - imageSearch = compile(tagre("img", "src", r'(%scomics/[^"]+)' % rurl)) - prevSearch = compile(tagre("a", "href", r'(%sindex\.php\?comic=\d+)' % rurl, before="prev")) + imageSearch = '//img[{}]'.format(xpath_class('comic')) + prevSearch = '//a[@rel="prev"]' help = 'Index format: n'