[tumblr] Fallback to `gifv` when possible (#3095) (#3159)

pull/3177/head
ClosedPort22 2 years ago committed by GitHub
parent 9d3f86dbcd
commit 4e80d3210e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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]

Loading…
Cancel
Save