mirror of
https://github.com/iv-org/invidious.git
synced 2024-12-22 16:19:53 +05:30
Fix image url extractor
This commit is contained in:
parent
f99a7b2a8c
commit
dce5816b18
@ -3739,7 +3739,7 @@ get "/api/v1/channels/:ucid" do |env|
|
||||
|
||||
qualities.each do |quality|
|
||||
json.object do
|
||||
json.field "url", channel.author_thumbnail.gsub("=s100-", "=s#{quality}-")
|
||||
json.field "url", channel.author_thumbnail.gsub(/=\d+/, "=s#{quality}")
|
||||
json.field "width", quality
|
||||
json.field "height", quality
|
||||
end
|
||||
@ -3781,7 +3781,7 @@ get "/api/v1/channels/:ucid" do |env|
|
||||
|
||||
qualities.each do |quality|
|
||||
json.object do
|
||||
json.field "url", related_channel.author_thumbnail.gsub("=s48-", "=s#{quality}-")
|
||||
json.field "url", related_channel.author_thumbnail.gsub(/=\d+/, "=s#{quality}")
|
||||
json.field "width", quality
|
||||
json.field "height", quality
|
||||
end
|
||||
@ -4079,7 +4079,7 @@ get "/api/v1/playlists/:plid" do |env|
|
||||
|
||||
qualities.each do |quality|
|
||||
json.object do
|
||||
json.field "url", playlist.author_thumbnail.gsub("=s100-", "=s#{quality}-")
|
||||
json.field "url", playlist.author_thumbnail.gsub(/=\d+/, "=s#{quality}")
|
||||
json.field "width", quality
|
||||
json.field "height", quality
|
||||
end
|
||||
|
@ -804,12 +804,13 @@ def fetch_channel_community(ucid, continuation, locale, config, kemal_config, fo
|
||||
width = thumbnail["width"].as_i
|
||||
height = thumbnail["height"].as_i
|
||||
aspect_ratio = (width.to_f / height.to_f)
|
||||
url = thumbnail["url"].as_s.gsub(/=w\d+-h\d+(-p)?(-nd)?(-df)?(-rwa)?/, "=s640")
|
||||
|
||||
qualities = {320, 560, 640, 1280, 2000}
|
||||
|
||||
qualities.each do |quality|
|
||||
json.object do
|
||||
json.field "url", thumbnail["url"].as_s.gsub("=s640-", "=s#{quality}-")
|
||||
json.field "url", url.gsub(/=s\d+/, "=s#{quality}")
|
||||
json.field "width", quality
|
||||
json.field "height", (quality / aspect_ratio).ceil.to_i
|
||||
end
|
||||
|
@ -176,7 +176,7 @@ struct SearchChannel
|
||||
|
||||
qualities.each do |quality|
|
||||
json.object do
|
||||
json.field "url", self.author_thumbnail.gsub("=s176-", "=s#{quality}-")
|
||||
json.field "url", self.author_thumbnail.gsub(/=\d+/, "=s#{quality}")
|
||||
json.field "width", quality
|
||||
json.field "height", quality
|
||||
end
|
||||
|
@ -319,7 +319,7 @@ struct Video
|
||||
|
||||
qualities.each do |quality|
|
||||
json.object do
|
||||
json.field "url", self.author_thumbnail.gsub("=s48-", "=s#{quality}-")
|
||||
json.field "url", self.author_thumbnail.gsub(/=s\d+/, "=s#{quality}")
|
||||
json.field "width", quality
|
||||
json.field "height", quality
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user