From 6e8231e78a6106676292a68e8ab01bbff8e1097f Mon Sep 17 00:00:00 2001 From: Kevin Anthony Date: Wed, 2 Sep 2015 11:01:48 -0400 Subject: [PATCH] Added Namer to BloomingFaeries since the web comic author doesn't seem intrested in sticking to any kind of file naming convention --- dosagelib/plugins/b.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/dosagelib/plugins/b.py b/dosagelib/plugins/b.py index 35c0c7596..02eb2d3f9 100644 --- a/dosagelib/plugins/b.py +++ b/dosagelib/plugins/b.py @@ -4,7 +4,7 @@ from re import compile, escape -from ..util import tagre +from ..util import tagre, getPageContent from ..scraper import _BasicScraper, _ParserScraper from ..helpers import indirectStarter @@ -160,13 +160,23 @@ class BloomingFaeries(_BasicScraper): imageSearch = compile(tagre("img", "src", r'http://www.bloomingfaeries.com/wp-content/uploads([^"]+)', after='title')) prevSearch = compile(tagre("a", "href", r'([^"]+)', after='comic-nav-base comic-nav-previous')) help = 'Index format: stripname' - + @classmethod def imageUrlModifier(cls, imageUrl, data): print imageUrl if imageUrl: return imageUrl.replace("http://www.bloomingfaeries.com/","http://www.bloomingfaeries.com/wp-content/uploads/") + @classmethod + def namer(cls, imageUrl, pageUrl): + bf = imageUrl.split('/') + name = bf[-1] + re = compile(tagre("div","class",r'comic-id-([^"]+)')) + content = getPageContent(pageUrl, cls.session) + match = re.search(content) + if not match: + return None + return "BF%s_%s" % (match.group(1),name) class BMovieComic(_BasicScraper): url = 'http://www.bmoviecomic.com/'