mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-04-11.git
synced 2024-08-15 00:43:26 +00:00
Fix handling for maxres thumbnail
This commit is contained in:
parent
48191aca6e
commit
6ec4dcfafd
1 changed files with 22 additions and 6 deletions
|
@ -237,10 +237,27 @@ module Invidious::Routes::Images
|
|||
|
||||
if name == "maxres.jpg"
|
||||
build_thumbnails(id).each do |thumb|
|
||||
if YT_POOL.client &.head("/vi/#{id}/#{thumb[:url]}.jpg", headers).status_code == 200
|
||||
thumbnail_resource_path = "/vi/#{id}/#{thumb[:url]}.jpg"
|
||||
# Logic here is short enough that manually typing them out should be fine.
|
||||
{% unless flag?(:disable_quic) %}
|
||||
if CONFIG.use_quic
|
||||
if YT_POOL.client &.head(thumbnail_resource_path, headers).status_code == 200
|
||||
name = thumb[:url] + ".jpg"
|
||||
break
|
||||
end
|
||||
else
|
||||
if HTTP::Client.head("https://i.ytimg.com#{thumbnail_resource_path}").status_code == 200
|
||||
name = thumb[:url] + ".jpg"
|
||||
break
|
||||
end
|
||||
end
|
||||
{% else %}
|
||||
# This can likely be optimized into a (small) pool sometime in the future.
|
||||
if HTTP::Client.head("https://i.ytimg.com#{thumbnail_resource_path}").status_code == 200
|
||||
name = thumb[:url] + ".jpg"
|
||||
break
|
||||
end
|
||||
{% end %}
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -288,6 +305,5 @@ module Invidious::Routes::Images
|
|||
{% end %}
|
||||
rescue ex
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue