From 4e80d3210e986690419d5ce92f56ad39934edc83 Mon Sep 17 00:00:00 2001 From: ClosedPort22 <44864697+ClosedPort22@users.noreply.github.com> Date: Sat, 5 Nov 2022 02:42:36 +0800 Subject: [PATCH] [tumblr] Fallback to `gifv` when possible (#3095) (#3159) --- gallery_dl/extractor/tumblr.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gallery_dl/extractor/tumblr.py b/gallery_dl/extractor/tumblr.py index 5451f6e0..11cb9c07 100644 --- a/gallery_dl/extractor/tumblr.py +++ b/gallery_dl/extractor/tumblr.py @@ -203,6 +203,15 @@ class TumblrExtractor(Extractor): def _prepare_image(url, post): text.nameext_from_url(url, post) + # try ".gifv" (#3095) + # it's unknown whether all gifs in this case are actually webps + # incorrect extensions will be corrected by 'adjust-extensions' + if post["extension"] == "gif": + post["_fallback"] = (url + "v",) + post["_http_headers"] = {"Accept": # copied from chrome 106 + "image/avif,image/webp,image/apng," + "image/svg+xml,image/*,*/*;q=0.8"} + parts = post["filename"].split("_") try: post["hash"] = parts[1] if parts[1] != "inline" else parts[2]