From e7512f626de67296d1277ccdc31dc7e2645e01dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Thu, 3 Dec 2015 00:25:15 +0100 Subject: [PATCH] [turboimagehost] add extractor --- gallery_dl/extractor/__init__.py | 1 + gallery_dl/extractor/turboimagehost.py | 39 ++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 gallery_dl/extractor/turboimagehost.py diff --git a/gallery_dl/extractor/__init__.py b/gallery_dl/extractor/__init__.py index 712122df..928681b2 100644 --- a/gallery_dl/extractor/__init__.py +++ b/gallery_dl/extractor/__init__.py @@ -44,6 +44,7 @@ modules = [ "safebooru", "sankaku", "spectrumnexus", + "turboimagehost", "yandere", ] diff --git a/gallery_dl/extractor/turboimagehost.py b/gallery_dl/extractor/turboimagehost.py new file mode 100644 index 00000000..32f130e7 --- /dev/null +++ b/gallery_dl/extractor/turboimagehost.py @@ -0,0 +1,39 @@ +# -*- 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://www.turboimagehost.com""" + +from .common import Extractor, Message +from .. import text + +class TurboimagehostExtractor(Extractor): + + category = "turboimagehost" + directory_fmt = ["{category}"] + filename_fmt = "{category}_{index}_{filename}" + pattern = [r"(?:https?://)?(?:www\.)?turboimagehost\.com/p/((\d+)/[^/]+\.html)"] + + def __init__(self, match): + Extractor.__init__(self) + self.part, self.index = match.groups() + + def items(self): + page = self.request("http://www.turboimagehost.com/p/" + self.part).text + data = { + "category": self.category, + "index": self.index, + } + text.extract_all(page, ( + ('width' , 'var imWidth = ', ';'), + ('height', 'var imHeight = ', ';'), + ('url' , '