Fix image url extractor

このコミットが含まれているのは:
Omar Roth 2019-07-31 19:16:09 -05:00
コミット dce5816b18
この署名に対応する既知のキーがデータベースに存在しません
GPGキーID: B8254FB7EC3D37F2
4個のファイルの変更7行の追加6行の削除

ファイルの表示

@ -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