From 56876b76f1e10be98e4107601cc66d0020ea4282 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Thu, 3 Dec 2015 00:16:36 +0100 Subject: [PATCH] [imagetwist] add extractor --- gallery_dl/extractor/__init__.py | 1 + gallery_dl/extractor/imagetwist.py | 38 ++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 gallery_dl/extractor/imagetwist.py diff --git a/gallery_dl/extractor/__init__.py b/gallery_dl/extractor/__init__.py index f78ef8e7..712122df 100644 --- a/gallery_dl/extractor/__init__.py +++ b/gallery_dl/extractor/__init__.py @@ -25,6 +25,7 @@ modules = [ "hentaifoundry", "hitomi", "imagebam", + "imagetwist", "imgbox", "imgchili", "imgth", diff --git a/gallery_dl/extractor/imagetwist.py b/gallery_dl/extractor/imagetwist.py new file mode 100644 index 00000000..c64ed059 --- /dev/null +++ b/gallery_dl/extractor/imagetwist.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- + +# Copyright 2015 Mike Fährmann +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. + +"""Extract images from http://imagetwist.com/""" + +from .common import Extractor, Message +from .. import text + +class ImagetwistExtractor(Extractor): + + category = "imagetwist" + directory_fmt = ["{category}"] + filename_fmt = "{category}_{index}_{filename}" + pattern = [r"(?:https?://)?(?:www\.)?imagetwist\.com/([^/]+)"] + + def __init__(self, match): + Extractor.__init__(self) + self.token = match.group(1) + + def items(self): + yield Message.Version, 1 + page = self.request("http://imagetwist.com/" + self.token).text + url , pos = text.extract(page, '