add a few more tests

This commit is contained in:
Mike Fährmann
2016-12-31 00:51:06 +01:00
parent 7952b8d18d
commit a849d8f2f7
5 changed files with 69 additions and 31 deletions

View File

@@ -90,10 +90,15 @@ class BatotoChapterExtractor(BatotoExtractor, AsynchronousExtractor):
directory_fmt = ["{category}", "{manga}", "c{chapter:>03} - {title}"]
filename_fmt = "{manga}_c{chapter:>03}_{page:>03}.{extension}"
pattern = [r"(?:https?://)?(?:www\.)?bato\.to/reader#([0-9a-f]+)"]
test = [("http://bato.to/reader#459878c8fda07502", {
"url": "432d7958506ad913b0a9e42664a89e46a63e9296",
"keyword": "75a3a86d32aecfc21c44865b4043490757f73d77",
})]
test = [
("http://bato.to/reader#459878c8fda07502", {
"url": "432d7958506ad913b0a9e42664a89e46a63e9296",
"keyword": "75a3a86d32aecfc21c44865b4043490757f73d77",
}),
("http://bato.to/reader#459878c8fda07503", {
"exception": exception.NotFoundError,
}),
]
reader_url = "https://bato.to/areader"
def __init__(self, match):

View File

@@ -22,10 +22,18 @@ class ExhentaiGalleryExtractor(Extractor):
directory_fmt = ["{category}", "{gallery-id}"]
filename_fmt = "{gallery-id}_{num:>04}_{image-token}_{name}.{extension}"
pattern = [r"(?:https?://)?(?:g\.e-|ex)hentai\.org/g/(\d+)/([\da-f]{10})"]
test = [("https://exhentai.org/g/960460/4f0e369d82/", {
"keyword": "623f8c86c9fe38e964682dd4309b96922655b900",
"content": "493d759de534355c9f55f8e365565b62411de146",
})]
test = [
("https://exhentai.org/g/960460/4f0e369d82/", {
"keyword": "623f8c86c9fe38e964682dd4309b96922655b900",
"content": "493d759de534355c9f55f8e365565b62411de146",
}),
("https://exhentai.org/g/960461/4f0e369d82/", {
"exception": exception.NotFoundError,
}),
("http://exhentai.org/g/962698/7f02358e00/", {
"exception": exception.AuthorizationError,
}),
]
api_url = "https://exhentai.org/api.php"
def __init__(self, match):

View File

@@ -21,10 +21,15 @@ class HentaifoundryUserExtractor(Extractor):
r"(?:https?://)?(?:www\.)?hentai-foundry\.com/pictures/user/([^/]+)/?$",
r"(?:https?://)?(?:www\.)?hentai-foundry\.com/user/([^/]+)/profile",
]
test = [("http://www.hentai-foundry.com/pictures/user/Tenpura", {
"url": "95d44a26498ae4a73963e6fd03ea5e0e624f14a0",
"keyword": "6937c20b3afe5a0af741cc1c419994dd041c8395",
})]
test = [
("http://www.hentai-foundry.com/pictures/user/Tenpura", {
"url": "95d44a26498ae4a73963e6fd03ea5e0e624f14a0",
"keyword": "6937c20b3afe5a0af741cc1c419994dd041c8395",
}),
("http://www.hentai-foundry.com/user/asdq/profile", {
"exception": exception.NotFoundError,
}),
]
url_base = "http://www.hentai-foundry.com/pictures/user/"
def __init__(self, match):
@@ -112,11 +117,16 @@ class HentaifoundryImageExtractor(Extractor):
pattern = [(r"(?:https?://)?(?:www\.|pictures\.)?hentai-foundry\.com/"
r"(?:pictures/user/([^/]+)/(\d+)"
r"|[^/]/([^/]+)/(\d+))")]
test = [("http://www.hentai-foundry.com/pictures/user/Tenpura/340854/notitle", {
"url": "f3c0739bf86543697deabbed4bf99eb95a04582b",
"keyword": "96217c5becc1369c36dafa201c3c208518de8f1f",
"content": "5c14cd10deaad79a5152f9de45c9203cf76165a0",
})]
test = [
("http://www.hentai-foundry.com/pictures/user/Tenpura/340854/notitle", {
"url": "f3c0739bf86543697deabbed4bf99eb95a04582b",
"keyword": "96217c5becc1369c36dafa201c3c208518de8f1f",
"content": "5c14cd10deaad79a5152f9de45c9203cf76165a0",
}),
("http://www.hentai-foundry.com/pictures/user/Tenpura/340853/", {
"exception": exception.NotFoundError,
}),
]
def __init__(self, match):
Extractor.__init__(self)

View File

@@ -19,11 +19,16 @@ class ImgboxGalleryExtractor(AsynchronousExtractor):
directory_fmt = ["{category}", "{title} - {gallery-key}"]
filename_fmt = "{num:>03}-{filename}"
pattern = [r"(?:https?://)?(?:www\.)?imgbox\.com/g/([A-Za-z0-9]{10})"]
test = [("https://imgbox.com/g/JaX5V5HX7g", {
"url": "6eafdeebaf0774238dddc9227e2ba315e40e9b7c",
"keyword": "cebd7f6868cf84ff492341c936cb6dbe5cde4682",
"content": "d20307dc8511ac24d688859c55abf2e2cc2dd3cc",
})]
test = [
("https://imgbox.com/g/JaX5V5HX7g", {
"url": "6eafdeebaf0774238dddc9227e2ba315e40e9b7c",
"keyword": "cebd7f6868cf84ff492341c936cb6dbe5cde4682",
"content": "d20307dc8511ac24d688859c55abf2e2cc2dd3cc",
}),
("https://imgbox.com/g/JaX5V5HX7h", {
"exception": exception.NotFoundError,
}),
]
url_base = "https://imgbox.com"
def __init__(self, match):
@@ -79,11 +84,16 @@ class ImgboxImageExtractor(Extractor):
directory_fmt = ["{category}"]
filename_fmt = "{filename}"
pattern = [r"(?:https?://)?(?:www\.)?imgbox\.com/([A-Za-z0-9]{8})"]
test = [("https://imgbox.com/qHhw7lpG", {
"url": "b9556dc307edf88e016fbced6d354702bc236070",
"keyword": "ff0524dba869a4b3292d7d4f72f5da4024b4f002",
"content": "0c8768055e4e20e7c7259608b67799171b691140",
})]
test = [
("https://imgbox.com/qHhw7lpG", {
"url": "b9556dc307edf88e016fbced6d354702bc236070",
"keyword": "ff0524dba869a4b3292d7d4f72f5da4024b4f002",
"content": "0c8768055e4e20e7c7259608b67799171b691140",
}),
("https://imgbox.com/qHhw7lpH", {
"exception": exception.NotFoundError,
}),
]
def __init__(self, match):
Extractor.__init__(self)

View File

@@ -18,10 +18,15 @@ class ImgurAlbumExtractor(Extractor):
directory_fmt = ["{category}", "{album-key} - {title}"]
filename_fmt = "{category}_{album-key}_{num:>03}_{hash}{ext}"
pattern = [r"(?:https?://)?(?:m\.|www\.)?imgur\.com/(?:a|gallery)/([^/?&#]+)"]
test = [("https://imgur.com/a/TcBmP", {
"url": "ce3552f550a5b5316bd9c7ae02e21e39f30c0563",
"keyword": "21723f47bf4a42599d39fbf29c5f79323d420898",
})]
test = [
("https://imgur.com/a/TcBmP", {
"url": "ce3552f550a5b5316bd9c7ae02e21e39f30c0563",
"keyword": "21723f47bf4a42599d39fbf29c5f79323d420898",
}),
("https://imgur.com/a/TcBmQ", {
"exception": exception.NotFoundError,
}),
]
def __init__(self, match):
Extractor.__init__(self)