mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 10:42:34 +01:00
[turboimagehost] add extractor
This commit is contained in:
parent
56876b76f1
commit
e7512f626d
@ -44,6 +44,7 @@ modules = [
|
||||
"safebooru",
|
||||
"sankaku",
|
||||
"spectrumnexus",
|
||||
"turboimagehost",
|
||||
"yandere",
|
||||
]
|
||||
|
||||
|
39
gallery_dl/extractor/turboimagehost.py
Normal file
39
gallery_dl/extractor/turboimagehost.py
Normal file
@ -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' , '<a href="http://www.turboimagehost.com"><img src="', '"'),
|
||||
), values=data)
|
||||
text.nameext_from_url(data["url"], data)
|
||||
yield Message.Version, 1
|
||||
yield Message.Directory, data
|
||||
yield Message.Url, data["url"], data
|
Loading…
Reference in New Issue
Block a user