From 9745b48830e72a4f9266036323a52656d5e929c5 Mon Sep 17 00:00:00 2001 From: blankie Date: Wed, 31 Aug 2022 08:53:50 +0000 Subject: [PATCH] [tumblr] attempt to fetch high-quality inline images (#2877) * [tumblr] attempt to fetch high-quality images (again) Fixes #1846, and fixes #1344 * slight refactor * update configuration.rst entry --- docs/configuration.rst | 5 +++-- gallery_dl/extractor/tumblr.py | 34 ++++++++++++++++++++++++---------- 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/docs/configuration.rst b/docs/configuration.rst index 761a9540..90de2983 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -2266,10 +2266,11 @@ Type Default ``true`` Description - Download full-resolution ``photo`` images. + Download full-resolution ``photo`` and ``inline`` images. For each photo with "maximum" resolution - (width equal to 2048 or height equal to 3072), + (width equal to 2048 or height equal to 3072) + or each inline image, use an extra HTTP request to find the URL to its full-resolution version. diff --git a/gallery_dl/extractor/tumblr.py b/gallery_dl/extractor/tumblr.py index b694fa0d..fa65862c 100644 --- a/gallery_dl/extractor/tumblr.py +++ b/gallery_dl/extractor/tumblr.py @@ -14,14 +14,6 @@ from datetime import datetime, timedelta import re -def _original_inline_image(url): - return re.sub( - (r"https?://(\d+\.media\.tumblr\.com(?:/[0-9a-f]+)?" - r"/tumblr(?:_inline)?_[^_]+)_\d+\.([0-9a-z]+)"), - r"https://\1_1280.\2", url - ) - - def _original_video(url): return re.sub( (r"https?://((?:vt|vtt|ve)(?:\.media)?\.tumblr\.com" @@ -141,7 +133,7 @@ class TumblrExtractor(Extractor): # API response, but they can't contain images/videos anyway body = post["reblog"]["comment"] + post["reblog"]["tree_html"] for url in re.findall('