dosage/dosagelib/plugins/wlpcomics.py

39 lines
1.1 KiB
Python
Raw Normal View History

2012-11-26 06:13:32 +00:00
# -*- coding: iso-8859-1 -*-
# Copyright (C) 2004-2005 Tristan Seligmann and Jonathan Jacobs
# Copyright (C) 2012 Bastian Kleineidam
2012-12-04 06:02:40 +00:00
from re import compile
from ..util import tagre
2012-11-26 06:13:32 +00:00
from ..scraper import make_scraper
from ..helpers import bounceStarter
2012-12-04 06:02:40 +00:00
_imageSearch = compile(tagre("img", "src", r'(http://www\.wlpcomics\.com/(?:adult|general)/[^"]+)'))
_prevSearch = compile(tagre("a", "href", r'(\w+.html)') + 'Previous')
_nextSearch = compile(tagre("a", "href", r'(\w+.html)') + 'Next')
2012-11-26 06:13:32 +00:00
def add(name, path):
baseUrl = 'http://www.wlpcomics.com/' + path
2012-11-26 18:41:25 +00:00
classname = 'WLP_' + name
2012-11-26 06:13:32 +00:00
@classmethod
def namer(cls, imageUrl, pageUrl):
return pageUrl.split('/')[-1].split('.')[0]
globals()[classname] = make_scraper(classname,
2012-11-26 18:41:25 +00:00
name = 'WLP/' + name,
starter = bounceStarter(baseUrl, _nextSearch),
2012-11-26 06:13:32 +00:00
stripUrl = baseUrl + '%s.html',
imageSearch = _imageSearch,
prevSearch = _prevSearch,
2012-11-26 06:13:32 +00:00
namer = namer,
help = 'Index format: nnn',
)
add('ChichiChan', 'adult/chichi/')
add('ChocolateMilkMaid', 'adult/cm/')
add('MaidAttack', 'general/maidattack/')
add('ShadowChasers', 'general/shadowchasers/')