From 98dd5f9a908e8d496cd8e2402a7572841e943b6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Thu, 20 Nov 2014 21:27:57 +0100 Subject: [PATCH] added extractor 'imagebam' --- gallery_dl/extractor/imagebam.py | 45 ++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 gallery_dl/extractor/imagebam.py diff --git a/gallery_dl/extractor/imagebam.py b/gallery_dl/extractor/imagebam.py new file mode 100644 index 00000000..6e8379d6 --- /dev/null +++ b/gallery_dl/extractor/imagebam.py @@ -0,0 +1,45 @@ +from .common import AsyncExtractor + +class Extractor(AsyncExtractor): + + def __init__(self, match, config): + AsyncExtractor.__init__(self, config) + self.category = "imagebam" + self.directory = self.get_title(match) + " - " + match.group(2) + + def images(self): + next_url = self.url + num = 1 + done = False + while not done: + # get current page + text = self.request("http://www.imagebam.com" + next_url).text + + # get url for next page + next_url, pos = self.extract(text, "next image" we are done + if not text.startswith(">next image", pos): + done = True + + # get image url + img_url , pos = self.extract(text, 'onclick="scale(this);" src="', '"', pos) + + # extract filename from image url + name = img_url[img_url.rindex("/")+1:] + + yield img_url, "{:>03}-{}".format(num, name) + num += 1 + + def get_title(self, match): + if match.group(1) == "image": + text = self.request(match.group(0)).text + gallery_url, _ = self.extract(text, "class='gallery_title'> ", " <", pos) + self.url, pos = self.extract(text, "