tumblr: pick biggest image based on resolution

photo[:alt_sizes] may contain a bigger image than
photo[:original_size]

fixes #4324
This commit is contained in:
lllusion3469
2020-04-08 16:32:55 +02:00
parent 6d615001e4
commit 65fb0cf510

View File

@@ -46,7 +46,11 @@ module Sources::Strategies
case post[:type]
when "photo"
list += post[:photos].map { |photo| photo[:original_size][:url] }
list += post[:photos].map do |photo|
sizes = [photo[:original_size]] + photo[:alt_sizes]
biggest = sizes.max_by { |x| x[:width] * x[:height] }
biggest[:url]
end
when "video"
list += [post[:video_url]]