adding comicpress scraper

This commit is contained in:
Damjan Košir 2015-05-16 00:15:32 +12:00
parent 962286d391
commit 79d775a8d9
3 changed files with 20 additions and 12 deletions

View file

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
from ..scraper import make_scraper, _ParserScraper
def add(name, url, firstUrl=None, lang=None):
attrs = dict(
name = name,
url = url,
imageSearch = '//div[@id="comic"]//img',
prevSearch = u'//a[text()=" Prev"]',
)
if lang:
attrs['lang'] = lang
if firstUrl:
attrs['firstUrl'] = url + firstUrl
globals()[name] = make_scraper(name, _ParserScraper, **attrs)
add('Hipsters', 'http://www.hipsters-comic.com/', 'comic/hip01/')

View file

@ -58,16 +58,6 @@ class HijinksEnsue(_BasicScraper):
help = 'Index format: yyyy/mm/dd/stripname' help = 'Index format: yyyy/mm/dd/stripname'
class Hipsters(_BasicScraper):
url = 'http://www.hipsters-comic.com/'
rurl = escape(url)
stripUrl = url + '%s/'
firstStripUrl = stripUrl % '2010/08/hip01'
imageSearch = compile(tagre("img", "src", r'(%scomics/\d+-\d+-\d+[^"]+)' % rurl))
prevSearch = compile(tagre("a", "href", r'(%s\d+/\d+/[^"]+)' % rurl, after="prev"))
help = 'Index format: yyyy/dd/stripname'
class HorribleVille(_BasicScraper): class HorribleVille(_BasicScraper):
url = 'http://horribleville.com/' url = 'http://horribleville.com/'
stripUrl = url + 'd/%s.html' stripUrl = url + 'd/%s.html'

View file

@ -509,6 +509,6 @@ def check_scrapers():
d[name] = scraperclass d[name] = scraperclass
def make_scraper(classname, **attributes): def make_scraper(classname, scraperType = _BasicScraper, **attributes):
"""Make a new scraper class with given name and attributes.""" """Make a new scraper class with given name and attributes."""
return type(classname, (_BasicScraper,), attributes) return type(classname, (scraperType,), attributes)