Merge branch 'comicpress'

This commit is contained in:
Damjan Košir 2015-05-20 23:12:03 +12:00
commit ff239ff58e
3 changed files with 20 additions and 11 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[contains(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,15 +58,6 @@ class HijinksEnsue(_BasicScraper):
help = 'Index format: yyyy/mm/dd/stripname' help = 'Index format: yyyy/mm/dd/stripname'
class Hipsters(_ParserScraper):
url = 'http://www.hipsters-comic.com/'
stripUrl = url + 'comic/%s/'
firstStripUrl = stripUrl % 'hip01'
imageSearch = '//div[@id="comic"]//img',
prevSearch = '//a[contains(text()," Prev")]',
help = 'Index format: 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)