1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2025-01-31 19:51:34 +01:00

add tests

This commit is contained in:
Mike Fährmann 2016-11-05 13:51:52 +01:00
parent 653885abf2
commit 37ea66098a
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
2 changed files with 29 additions and 8 deletions

View File

@ -117,24 +117,34 @@ class PicmaniacImageExtractor(ChronosImageExtractor):
class HosturimageImageExtractor(ImagehostImageExtractor):
"""Extractor for single images from hosturimage.com"""
category = "hosturimage"
pattern = [r"(?:https?://)?((?:www\.)?hosturimage\.com/img-([a-z0-9]+)\.html)"]
pattern = [(r"(?:https?://)?((?:www\.)?hosturimage\.com/"
r"img-([a-z0-9]+)\.html)")]
test = [("https://hosturimage.com/img-581ca97112bf8.html", {
"url": "c672a3fd7fd48e5506d020aa19c4ac91ba078671",
"keyword": "c3c94340b8e395e07b5145cf17534b5871ec8593",
"content": "0c8768055e4e20e7c7259608b67799171b691140",
})]
https = True
def get_info(self, page):
_ , pos = text.extract(page, '<div id="image_details">', '')
url, pos = text.extract(page, "href='", "'", pos)
url, pos = text.extract(page, "src='", "'", pos)
return url, url
class ImageontimeImageExtractor(HosturimageImageExtractor):
"""Extractor for single images from imageontime.org"""
category = "imageontime"
pattern = [r"(?:https?://)?((?:www\.)?imageontime\.org/img-([a-z0-9]+)\.html)"]
pattern = [(r"(?:https?://)?((?:www\.)?imageontime\.org/"
r"img-([a-z0-9]+)\.html)")]
test = []
https = False
class ImguploadImageExtractor(HosturimageImageExtractor):
"""Extractor for single images from imgupload.yt"""
category = "imgupload"
pattern = [r"(?:https?://)?((?:www\.)?imgupload\.yt/img-([a-z0-9]+)\.html)"]
pattern = [(r"(?:https?://)?((?:www\.)?imgupload\.yt/"
r"img-([a-z0-9]+)\.html)")]
test = []
https = True
@ -176,6 +186,11 @@ class ImgclickImageExtractor(ImagehostImageExtractor):
"""Extractor for single images from imgclick.net"""
category = "imgclick"
pattern = [r"(?:https?://)?((?:www\.)?imgclick\.net/([^/]+))"]
test = [("http://imgclick.net/4tbrre1oxew9/test-_-_.png.html", {
"url": "140dcb250a325f2d26b2d918c18b8ac6a2a0f6ab",
"keyword": "c086439336eea3bdf773d761c32b0edb29af0ebd",
"content": "0c8768055e4e20e7c7259608b67799171b691140",
})]
params = "complex"
def get_info(self, page):
@ -188,13 +203,18 @@ class ImgspiceImageExtractor(ImagehostImageExtractor):
"""Extractor for single images from imgspice.com"""
category = "imgspice"
pattern = [r"(?:https?://)?((?:www\.)?imgspice\.com/([^/]+))"]
test = [("https://imgspice.com/zop38mvvq29u/", {
"url": "a45833733c02b64d105363ffd8fd19f06992a2f7",
"keyword": "5218f63195e6a487c0881fd1cda78c535c61b462",
"content": "0c8768055e4e20e7c7259608b67799171b691140",
})]
https = True
params = None
def get_info(self, page):
filename, pos = text.extract(page, '<td nowrap>', '</td>')
url , pos = text.extract(page, '<img src="', '"', pos)
return url, filename
return url, text.unescape(filename)
class ImgtrexImageExtractor(ImagehostImageExtractor):
@ -208,7 +228,6 @@ class ImgtrexImageExtractor(ImagehostImageExtractor):
})]
params = None
def get_info(self, page):
filename, pos = text.extract(page, '<title>ImgTrex: ', '</title>')
url , pos = text.extract(page, '<br>\n<img src="', '"', pos)
@ -218,7 +237,8 @@ class ImgtrexImageExtractor(ImagehostImageExtractor):
class TurboimagehostImageExtractor(ImagehostImageExtractor):
"""Extractor for single images from turboimagehost.com"""
category = "turboimagehost"
pattern = [r"(?:https?://)?((?:www\.)?turboimagehost\.com/p/(\d+)/[^/]+\.html)"]
pattern = [(r"(?:https?://)?((?:www\.)?turboimagehost\.com/p/(\d+)"
r"/[^/]+\.html)")]
test = [("http://www.turboimagehost.com/p/29690902/test--.png.html", {
"url": "c624dc7784de515342117a2678fee6ecf1032d79",
"keyword": "a4527f14675e4512ef317ee0401940c711fbe012",

View File

@ -21,8 +21,9 @@ class LusciousAlbumExtractor(Extractor):
pattern = [(r"(?:https?://)?(?:www\.)?luscious\.net/c/([^/]+)/"
r"(?:pictures/album|albums)/([^/\d]+(\d+))")]
test = [("https://luscious.net/c/incest_manga/albums/amazon-no-hiyaku-amazon-elixir-english-decensored_261127/view/", {
"url": "af4aef350612ece66a7b02f0f9b2cd4a4dd8fb53",
"url": "9493f84868445135d0024818016100b2c80abfe6",
"keyword": "e10c7c070ad730e305024fb37cc70af6b05378dd",
"content": "57825d189e17c43dc5a8ecdc3fa2d9d544fc62b1",
})]
def __init__(self, match):