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

pull/2806/head
blankie 2 years ago committed by GitHub
parent 59b16b3f70
commit 5b63df46c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -110,7 +110,12 @@ class TumblrExtractor(Extractor):
for photo in photos: for photo in photos:
post["photo"] = photo 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["original_size"]
del photo["alt_sizes"] del photo["alt_sizes"]
yield self._prepare_image(photo["url"], post) yield self._prepare_image(photo["url"], post)

Loading…
Cancel
Save