From 5d5a08cc693098ec29d595f1f7309c7233626fb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sun, 10 Apr 2022 14:22:07 +0200 Subject: [PATCH] [sexcom] add fallback for empty files (#2485) --- gallery_dl/extractor/sexcom.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gallery_dl/extractor/sexcom.py b/gallery_dl/extractor/sexcom.py index edf35dae..830274a5 100644 --- a/gallery_dl/extractor/sexcom.py +++ b/gallery_dl/extractor/sexcom.py @@ -87,7 +87,10 @@ class SexcomExtractor(Extractor): data["extension"] = None data["url"] = "ytdl:" + src else: - data["url"] = text.unescape(extr(' src="', '"').partition("?")[0]) + data["_http_validate"] = _check_empty + url = text.unescape(extr(' src="', '"')) + data["url"] = url.partition("?")[0] + data["_fallback"] = (url,) text.nameext_from_url(data["url"], data) data["uploader"] = extr('itemprop="author">', '<') @@ -247,3 +250,7 @@ class SexcomSearchExtractor(SexcomExtractor): def pins(self): url = "{}/{}".format(self.root, self.path) return self._pagination(url) + + +def _check_empty(response): + return response.headers.get("content-length") != "0"