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, "