move chronos & co. to imagehosts file
This commit is contained in:
parent
8b7f719f36
commit
5e82e8dfbd
@ -16,8 +16,6 @@ modules = [
|
||||
"4chan",
|
||||
"8chan",
|
||||
"batoto",
|
||||
"chronos",
|
||||
"coreimg",
|
||||
"danbooru",
|
||||
"deviantart",
|
||||
"dokireader",
|
||||
@ -54,7 +52,6 @@ modules = [
|
||||
"mangastream",
|
||||
"nhentai",
|
||||
"nijie",
|
||||
"picmaniac",
|
||||
"pinterest",
|
||||
"powermanga",
|
||||
"rule34",
|
||||
|
@ -1,46 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2015,2016 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://chronos.to/"""
|
||||
|
||||
from .common import Extractor, Message
|
||||
from .. import text
|
||||
|
||||
class ChronosImageExtractor(Extractor):
|
||||
"""Extractor for single images from chronos.to"""
|
||||
category = "chronos"
|
||||
subcategory = "image"
|
||||
directory_fmt = ["{category}"]
|
||||
filename_fmt = "{filename}"
|
||||
pattern = [r"(?:https?://)?(?:www\.)?chronos\.to/([a-z0-9]{12})"]
|
||||
url_base = "http://chronos.to/"
|
||||
test = [("http://chronos.to/bdrmq7rw7v4y", {
|
||||
"url": "7fcb3fe315c94283644d25ef47a644c2dc8da944",
|
||||
"keyword": "04dbc71a1154728d01c931308184050d61c5da55",
|
||||
"content": "0c8768055e4e20e7c7259608b67799171b691140",
|
||||
})]
|
||||
|
||||
def __init__(self, match):
|
||||
Extractor.__init__(self)
|
||||
self.token = match.group(1)
|
||||
|
||||
def items(self):
|
||||
params = {
|
||||
"op": "view",
|
||||
"id": self.token,
|
||||
"pre": 1,
|
||||
"next": "Continue+to+image.",
|
||||
}
|
||||
page = self.request(self.url_base + self.token, method="post",
|
||||
data=params).text
|
||||
url , pos = text.extract(page, '<br><img src="', '"')
|
||||
filename, pos = text.extract(page, ' alt="', '"', pos)
|
||||
data = text.nameext_from_url(filename, {"token": self.token})
|
||||
yield Message.Version, 1
|
||||
yield Message.Directory, data
|
||||
yield Message.Url, url, data
|
@ -1,22 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2016 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://coreimg.net/"""
|
||||
|
||||
from . import chronos
|
||||
|
||||
class CoreimgImageExtractor(chronos.ChronosImageExtractor):
|
||||
"""Extractor for single images from coreimg.net"""
|
||||
category = "coreimg"
|
||||
pattern = [r"(?:https?://)?(?:www\.)?coreimg\.net/([a-z0-9]{12})"]
|
||||
url_base = "https://coreimg.net/"
|
||||
test = [("http://coreimg.net/ykcl5al8uzvg", {
|
||||
"url": "2b32596a2ea66b7cc784e20f3749f75f20998d78",
|
||||
"keyword": "8d71e5b820bc7177baee33ca529c91ae4521299f",
|
||||
"content": "0c8768055e4e20e7c7259608b67799171b691140",
|
||||
})]
|
@ -6,14 +6,14 @@
|
||||
# it under the terms of the GNU General Public License version 2 as
|
||||
# published by the Free Software Foundation.
|
||||
|
||||
"""Extract images from https://img.yt/"""
|
||||
"""Collection of extractors for various imagehosts"""
|
||||
|
||||
from .common import Extractor, Message
|
||||
from .. import text
|
||||
from os.path import splitext
|
||||
|
||||
class ImagehostImageExtractor(Extractor):
|
||||
"""Base class for single-image extractors from various imagehosts"""
|
||||
"""Base class for single-image extractors for various imagehosts"""
|
||||
subcategory = "image"
|
||||
directory_fmt = ["{category}"]
|
||||
filename_fmt = "{filename}"
|
||||
@ -50,6 +50,10 @@ class ImagehostImageExtractor(Extractor):
|
||||
yield Message.Directory, data
|
||||
yield Message.Url, url, data
|
||||
|
||||
def get_info(self, page):
|
||||
"""Find image-url and string to get filename from"""
|
||||
return "url", "filename"
|
||||
|
||||
#
|
||||
|
||||
class ImgytImageExtractor(ImagehostImageExtractor):
|
||||
@ -77,6 +81,41 @@ class RapidimgImageExtractor(ImgytImageExtractor):
|
||||
|
||||
#
|
||||
|
||||
class ChronosImageExtractor(ImagehostImageExtractor):
|
||||
"""Extractor for single images from chronos.to"""
|
||||
category = "chronos"
|
||||
pattern = [r"(?:https?://)?((?:www\.)?chronos\.to/([a-z0-9]{12}))"]
|
||||
test = [("http://chronos.to/bdrmq7rw7v4y", {
|
||||
"url": "7fcb3fe315c94283644d25ef47a644c2dc8da944",
|
||||
"keyword": "04dbc71a1154728d01c931308184050d61c5da55",
|
||||
"content": "0c8768055e4e20e7c7259608b67799171b691140",
|
||||
})]
|
||||
https = False
|
||||
params = "complex"
|
||||
|
||||
def get_info(self, page):
|
||||
url , pos = text.extract(page, '<br><img src="', '"')
|
||||
filename, pos = text.extract(page, ' alt="', '"', pos)
|
||||
return url, filename
|
||||
|
||||
class CoreimgImageExtractor(ChronosImageExtractor):
|
||||
"""Extractor for single images from coreimg.net"""
|
||||
category = "coreimg"
|
||||
pattern = [r"(?:https?://)?((?:www\.)?coreimg\.net/([a-z0-9]{12}))"]
|
||||
test = [("http://coreimg.net/ykcl5al8uzvg", {
|
||||
"url": "2b32596a2ea66b7cc784e20f3749f75f20998d78",
|
||||
"keyword": "8d71e5b820bc7177baee33ca529c91ae4521299f",
|
||||
"content": "0c8768055e4e20e7c7259608b67799171b691140",
|
||||
})]
|
||||
|
||||
class PicmaniacImageExtractor(ChronosImageExtractor):
|
||||
"""Extractor for single images from pic-maniac.com"""
|
||||
category = "picmaniac"
|
||||
pattern = [r"(?:https?://)?((?:www\.)?pic-maniac\.com/([a-z0-9]{12}))"]
|
||||
test = []
|
||||
|
||||
#
|
||||
|
||||
class HosturimageImageExtractor(ImagehostImageExtractor):
|
||||
"""Extractor for single images from hosturimage.com"""
|
||||
category = "hosturimage"
|
||||
|
@ -1,18 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2016 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://pic-maniac.com/"""
|
||||
|
||||
from . import chronos
|
||||
|
||||
class PicmaniacImageExtractor(chronos.ChronosImageExtractor):
|
||||
"""Extractor for single images from pic-maniac.com"""
|
||||
category = "picmaniac"
|
||||
pattern = [r"(?:https?://)?(?:www\.)?pic-maniac\.com/([a-z0-9]{12})"]
|
||||
url_base = "http://pic-maniac.com/"
|
||||
test = []
|
Loading…
x
Reference in New Issue
Block a user