From cbaeee95330600e15c44c0ebda915dc5e17b9d18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sat, 7 Jan 2023 13:04:42 +0100 Subject: [PATCH] [imagefap] warn about redirects to '/human-verification' (#1140) --- gallery_dl/extractor/imagefap.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/gallery_dl/extractor/imagefap.py b/gallery_dl/extractor/imagefap.py index d5994f1f..f9dc0c1f 100644 --- a/gallery_dl/extractor/imagefap.py +++ b/gallery_dl/extractor/imagefap.py @@ -9,7 +9,7 @@ """Extractors for https://www.imagefap.com/""" from .common import Extractor, Message -from .. import text +from .. import text, exception import json BASE_PATTERN = r"(?:https?://)?(?:www\.|beta\.)?imagefap\.com" @@ -28,6 +28,18 @@ class ImagefapExtractor(Extractor): Extractor.__init__(self, match) self.session.headers["Referer"] = self.root + def request(self, url, **kwargs): + response = Extractor.request(self, url, **kwargs) + + if response.history and response.url.endswith("/human-verification"): + msg = text.extr(response.text, '
")[2].split()) + raise exception.StopExtraction("'%s'", msg) + self.log.warning("HTTP redirect to %s", response.url) + + return response + class ImagefapGalleryExtractor(ImagefapExtractor): """Extractor for image galleries from imagefap.com"""