fixing PandyLand

This commit is contained in:
Damjan Košir 2015-05-20 23:56:49 +12:00
parent fd60065591
commit a05ae9c75d
2 changed files with 14 additions and 22 deletions

View file

@ -1,20 +1,22 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from ..scraper import make_scraper, _ParserScraper from ..scraper import make_scraper, _ParserScraper
def add(name, url, firstUrl=None, lang=None):
attrs = dict( def add(name, url, firstUrl=None, lang=None):
name = name, attrs = dict(
url = url, name=name,
imageSearch = '//div[@id="comic"]//img', url=url,
prevSearch = u'//a[contains(text(), " Prev")]', imageSearch='//div[@id="comic"]//img',
) prevSearch=['//a[contains(text(), " Prev")]', "//a[contains(concat(' ', @class, ' '), ' navi-prev ')]"]
if lang: )
attrs['lang'] = lang if lang:
if firstUrl: attrs['lang'] = lang
attrs['firstUrl'] = url + firstUrl if firstUrl:
globals()[name] = make_scraper(name, _ParserScraper, **attrs) attrs['firstUrl'] = url + firstUrl
globals()[name] = make_scraper(name, _ParserScraper, **attrs)
add('CourtingDisaster', 'http://www.courting-disaster.com/', 'comic/courting-disaster-17/') add('CourtingDisaster', 'http://www.courting-disaster.com/', 'comic/courting-disaster-17/')
add('OnTheEdge', 'http://ontheedgecomics.com/', 'comic/ote0001/') add('OnTheEdge', 'http://ontheedgecomics.com/', 'comic/ote0001/')
add('PandyLand', 'http://pandyland.net/', '1/')
add('Hipsters', 'http://www.hipsters-comic.com/', 'comic/hip01/') add('Hipsters', 'http://www.hipsters-comic.com/', 'comic/hip01/')

View file

@ -8,16 +8,6 @@ from ..helpers import bounceStarter, queryNamer, indirectStarter
from ..util import tagre from ..util import tagre
class PandyLand(_BasicScraper):
url = 'http://pandyland.net/'
rurl = escape(url)
stripUrl = url + '%s/'
firstStripUrl = stripUrl % '1'
imageSearch = compile(tagre("img", "src", r'(%scomics/[^"]+)' % rurl))
prevSearch = compile(tagre("a", "href", r'(%s\d+/)' % rurl, after="prev"))
help = 'Index format: number'
class ParadigmShift(_BasicScraper): class ParadigmShift(_BasicScraper):
url = 'http://www.paradigmshiftmanga.com/' url = 'http://www.paradigmshiftmanga.com/'
starter = indirectStarter(url, compile(tagre("a", "href", r'([^"]+)', after="next-comic-link"))) starter = indirectStarter(url, compile(tagre("a", "href", r'([^"]+)', after="next-comic-link")))