[tumblr] attempt to get higher-quality images (#2761)

This commit is contained in:
blankie
2022-07-27 08:47:43 +00:00
committed by GitHub
parent 59b16b3f70
commit 5b63df46c0

View File

@@ -110,7 +110,12 @@ class TumblrExtractor(Extractor):
for photo in photos:
post["photo"] = photo
photo.update(photo["original_size"])
best_photo = photo["original_size"]
for alt_photo in photo["alt_sizes"]:
if (alt_photo["height"] > best_photo["height"] or
alt_photo["width"] > best_photo["width"]):
best_photo = alt_photo
photo.update(best_photo)
del photo["original_size"]
del photo["alt_sizes"]
yield self._prepare_image(photo["url"], post)