From 2b383989401c745af4edc6c3b51e78eb5c07eb7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Thu, 2 Feb 2017 15:52:48 +0100 Subject: [PATCH] [imgyt] raise NotFoundError instead of crashing --- gallery_dl/extractor/imagehosts.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/gallery_dl/extractor/imagehosts.py b/gallery_dl/extractor/imagehosts.py index 30ea3e46..3e799c45 100644 --- a/gallery_dl/extractor/imagehosts.py +++ b/gallery_dl/extractor/imagehosts.py @@ -9,7 +9,7 @@ """Collection of extractors for various imagehosts""" from .common import Extractor, Message -from .. import text +from .. import text, exception from os.path import splitext from urllib.parse import urljoin @@ -64,15 +64,22 @@ class ImgytImageExtractor(ImagehostImageExtractor): """Extractor for single images from img.yt""" category = "imgyt" pattern = [r"(?:https?://)?((?:www\.)?img\.yt/img-([a-z0-9]+)\.html)"] - test = [("https://img.yt/img-57a2050547b97.html", { - "url": "6801fac1ff8335bd27a1665ad27ad64cace2cd84", - "keyword": "7548cc9915f90f5d7ffbafa079085457ae34562c", - "content": "54592f2635674c25677c6872db3709d343cdf92f", - })] + test = [ + ("https://img.yt/img-57a2050547b97.html", { + "url": "6801fac1ff8335bd27a1665ad27ad64cace2cd84", + "keyword": "7548cc9915f90f5d7ffbafa079085457ae34562c", + "content": "54592f2635674c25677c6872db3709d343cdf92f", + }), + ("https://img.yt/img-57a2050547b98.html", { + "exception": exception.NotFoundError, + }), + ] https = True def get_info(self, page): - url , pos = text.extract(page, "