dosage/dosagelib/plugins/snafu.py

41 lines
1.1 KiB
Python
Raw Normal View History

2012-11-21 20:57:26 +00:00
# -*- coding: iso-8859-1 -*-
# Copyright (C) 2004-2005 Tristan Seligmann and Jonathan Jacobs
2014-01-05 15:50:57 +00:00
# Copyright (C) 2012-2014 Bastian Kleineidam
2012-11-21 20:57:26 +00:00
2012-11-26 06:13:32 +00:00
from re import compile
from ..scraper import make_scraper
2012-11-21 20:57:26 +00:00
_imageSearch = compile(r'<img src=http://\w+\.snafu-comics\.com/(comics/\d{6}_\w*\.\w{3,4})')
_prevSearch = compile(r'<a href="(\?comic_id=\d+)">Previous</a>')
2012-11-26 06:13:32 +00:00
def add(name, host):
baseUrl = 'http://%s.snafu-comics.com/' % host
classname = 'SnafuComics_%s' % name
2012-11-21 20:57:26 +00:00
2012-11-26 06:13:32 +00:00
globals()[classname] = make_scraper(classname,
2012-11-26 18:41:25 +00:00
name='SnafuComics/%s' % name,
url = baseUrl,
2012-12-02 17:35:06 +00:00
stripUrl = baseUrl + '?comic_id=%s',
imageSearch = _imageSearch,
prevSearch = _prevSearch,
2014-02-27 21:31:21 +00:00
waitSeconds = 1,
2012-11-26 06:13:32 +00:00
help = 'Index format: n (unpadded)',
)
2012-11-21 20:57:26 +00:00
2012-11-26 06:13:32 +00:00
add('KOF', 'kof')
add('PowerPuffGirls', 'ppg')
add('Tin', 'tin')
add('TW', 'tw')
add('Sugar', 'sugar')
add('SF', 'sf')
add('Titan', 'titan')
add('EA', 'ea')
add('Zim', 'zim')
add('Soul', 'soul')
add('FT', 'ft')
add('Bunnywith', 'bunnywith')
add('Braindead', 'braindead')
2014-02-27 21:31:21 +00:00
add('GrimTalesFromDownBelow', 'grim')