From e41c317039a2585cca4e06ce0be47416698c5d1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Thu, 12 Jun 2025 20:41:47 +0200 Subject: [PATCH] [fantia] prevent '.html' file downloads --- gallery_dl/extractor/fantia.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gallery_dl/extractor/fantia.py b/gallery_dl/extractor/fantia.py index 6218f198..db29589d 100644 --- a/gallery_dl/extractor/fantia.py +++ b/gallery_dl/extractor/fantia.py @@ -56,6 +56,7 @@ class FantiaExtractor(Extractor): "%s#post-content-id-%s", content["visible_status"], post["post_url"], content["id"]) + post["_http_validate"] = self._validate_response for file in files: post.update(file) post["num"] += 1 @@ -90,6 +91,10 @@ class FantiaExtractor(Extractor): self.headers["X-CSRF-Token"] = text.extr( page, 'name="csrf-token" content="', '"') + def _validate_response(self, response): + return not response.history or not response.headers.get( + "content-type", "").startswith("text/html") + def _get_post_data(self, post_id): """Fetch and process post data""" url = self.root+"/api/v1/posts/"+post_id