diff --git a/dosagelib/plugins/wlpcomics.py b/dosagelib/plugins/wlpcomics.py index 7d30ee1fa..89953b01f 100644 --- a/dosagelib/plugins/wlpcomics.py +++ b/dosagelib/plugins/wlpcomics.py @@ -5,6 +5,8 @@ from __future__ import absolute_import, division, print_function +import re + from ..scraper import _ParserScraper from ..helpers import bounceStarter @@ -24,7 +26,7 @@ class _WLPComics(_ParserScraper): image_url.rsplit('/', 1)[-1]) def getIndexStripUrl(self, index): - return self.url + '%s.html' + return self.url + '%s.html' % index class ChichiChan(_WLPComics): @@ -34,9 +36,22 @@ class ChichiChan(_WLPComics): class ChocolateMilkMaid(_WLPComics): # Newer pages seem to be broken - url = 'http://www.wlpcomics.com/adult/cm/262.html' + baseurl = 'http://www.wlpcomics.com/adult/cm/' + url = baseurl + '264.html' adult = True + def getIndexStripUrl(self, index): + return self.baseurl + '%s.html' % index + + def link_modifier(self, fromurl, tourl): + """Bugfix for self-referencing pages...""" + if tourl == fromurl: + return re.sub(r'/(\d+)\.ht', + lambda m: '/%03i.ht' % (int(m.group(1)) - 1), tourl) + if '263.html' in fromurl and '265.html' in tourl: + return self.baseurl + '264.html' + return tourl + class MaidAttack(_WLPComics): url = 'http://www.wlpcomics.com/general/maidattack/'