From 6c7fb176b1b65b6cb08a65dfb74271158cb3d13b Mon Sep 17 00:00:00 2001 From: Tobias Gruetzmacher Date: Wed, 23 Jul 2014 20:54:00 +0200 Subject: [PATCH] Add Blade Kitten as an example for the new parser. --- dosagelib/plugins/b.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/dosagelib/plugins/b.py b/dosagelib/plugins/b.py index c1f6d1bce..ff9cac4a8 100644 --- a/dosagelib/plugins/b.py +++ b/dosagelib/plugins/b.py @@ -5,7 +5,7 @@ from re import compile, escape from ..util import tagre -from ..scraper import _BasicScraper +from ..scraper import _BasicScraper, _ParserScraper from ..helpers import indirectStarter @@ -127,6 +127,28 @@ class BizarreUprising(_BasicScraper): help = 'Index format: n/name' +class BladeKitten(_ParserScraper): + description = u"Blade Kitten aka Kit Ballard, is the hottest and best bounty hunter in the Korunda System and isn't afraid to let people know it!" + url = 'http://www.bladekitten.com/' + stripUrl = url + 'comics/blade-kitten/%s/page:%s' + firstStripUrl = stripUrl % ('1','1') + imageSearch = '//img[@class="comic_page_image"]' + prevSearch = '//span[@class="comic_nav_prev"]//a' + textSearch = '//div[@class="comic_comment_inner"]//p' + textOptional = True + help = 'Index format: chapter-page' + starter = indirectStarter(url, '//h4//a[contains(@href, "/comics/")]') + + def getIndexStripUrl(self, index): + return self.stripUrl % tuple(index.split('-')) + + @classmethod + def namer(cls, imageUrl, pageUrl): + filename = imageUrl.rsplit('/', 1)[1] + _, chapter, page = pageUrl.rsplit('/', 2) + page = page.split(':')[1] + return "bladekitten-%02i-%02i-%s" % (int(chapter), int(page), filename) + class BlankIt(_BasicScraper): description = u'An absurd, insane, and delightful webcomic from Aric McKeown and Lem Pew.' url = 'http://blankitcomics.com/'