mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2023-06-08.git
synced 2024-08-15 00:53:38 +00:00
Fix image url extractor
This commit is contained in:
parent
f99a7b2a8c
commit
dce5816b18
4 changed files with 7 additions and 6 deletions
|
@ -3739,7 +3739,7 @@ get "/api/v1/channels/:ucid" do |env|
|
||||||
|
|
||||||
qualities.each do |quality|
|
qualities.each do |quality|
|
||||||
json.object do
|
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 "width", quality
|
||||||
json.field "height", quality
|
json.field "height", quality
|
||||||
end
|
end
|
||||||
|
@ -3781,7 +3781,7 @@ get "/api/v1/channels/:ucid" do |env|
|
||||||
|
|
||||||
qualities.each do |quality|
|
qualities.each do |quality|
|
||||||
json.object do
|
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 "width", quality
|
||||||
json.field "height", quality
|
json.field "height", quality
|
||||||
end
|
end
|
||||||
|
@ -4079,7 +4079,7 @@ get "/api/v1/playlists/:plid" do |env|
|
||||||
|
|
||||||
qualities.each do |quality|
|
qualities.each do |quality|
|
||||||
json.object do
|
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 "width", quality
|
||||||
json.field "height", quality
|
json.field "height", quality
|
||||||
end
|
end
|
||||||
|
|
|
@ -804,12 +804,13 @@ def fetch_channel_community(ucid, continuation, locale, config, kemal_config, fo
|
||||||
width = thumbnail["width"].as_i
|
width = thumbnail["width"].as_i
|
||||||
height = thumbnail["height"].as_i
|
height = thumbnail["height"].as_i
|
||||||
aspect_ratio = (width.to_f / height.to_f)
|
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 = {320, 560, 640, 1280, 2000}
|
||||||
|
|
||||||
qualities.each do |quality|
|
qualities.each do |quality|
|
||||||
json.object do
|
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 "width", quality
|
||||||
json.field "height", (quality / aspect_ratio).ceil.to_i
|
json.field "height", (quality / aspect_ratio).ceil.to_i
|
||||||
end
|
end
|
||||||
|
|
|
@ -176,7 +176,7 @@ struct SearchChannel
|
||||||
|
|
||||||
qualities.each do |quality|
|
qualities.each do |quality|
|
||||||
json.object do
|
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 "width", quality
|
||||||
json.field "height", quality
|
json.field "height", quality
|
||||||
end
|
end
|
||||||
|
|
|
@ -319,7 +319,7 @@ struct Video
|
||||||
|
|
||||||
qualities.each do |quality|
|
qualities.each do |quality|
|
||||||
json.object do
|
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 "width", quality
|
||||||
json.field "height", quality
|
json.field "height", quality
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue