Make 'videoThumbnails' an array instead of an object

This commit is contained in:
Omar Roth 2018-08-05 16:54:25 -05:00
parent 7d6bc671c2
commit 0f778cbd9d
1 changed files with 30 additions and 33 deletions

View File

@ -2081,18 +2081,17 @@ get "/api/v1/top" do |env|
json.field "title", video.title
json.field "videoId", video.id
json.field "videoThumbnails" do
json.object do
qualities = [{name: "default", url: "default", width: 120, height: 90},
{name: "high", url: "hqdefault", width: 480, height: 360},
{name: "medium", url: "mqdefault", width: 320, height: 180},
]
qualities = [{name: "default", url: "default", width: 120, height: 90},
{name: "high", url: "hqdefault", width: 480, height: 360},
{name: "medium", url: "mqdefault", width: 320, height: 180},
]
json.array do
qualities.each do |quality|
json.field quality[:name] do
json.object do
json.field "url", "https://i.ytimg.com/vi/#{video.id}/#{quality["url"]}.jpg"
json.field "width", quality[:width]
json.field "height", quality[:height]
end
json.object do
json.field "quality", quality[:name]
json.field "url", "https://i.ytimg.com/vi/#{video.id}/#{quality["url"]}.jpg"
json.field "width", quality[:width]
json.field "height", quality[:height]
end
end
end
@ -2220,18 +2219,17 @@ get "/api/v1/channels/:ucid" do |env|
json.field "published", video.published.epoch
json.field "videoThumbnails" do
json.object do
qualities = [{name: "default", url: "default", width: 120, height: 90},
{name: "high", url: "hqdefault", width: 480, height: 360},
{name: "medium", url: "mqdefault", width: 320, height: 180},
]
qualities = [{name: "default", url: "default", width: 120, height: 90},
{name: "high", url: "hqdefault", width: 480, height: 360},
{name: "medium", url: "mqdefault", width: 320, height: 180},
]
json.array do
qualities.each do |quality|
json.field quality[:name] do
json.object do
json.field "url", "https://i.ytimg.com/vi/#{video.id}/#{quality["url"]}.jpg"
json.field "width", quality[:width]
json.field "height", quality[:height]
end
json.object do
json.field "quality", quality[:name]
json.field "url", "https://i.ytimg.com/vi/#{video.id}/#{quality["url"]}.jpg"
json.field "width", quality[:width]
json.field "height", quality[:height]
end
end
end
@ -2324,18 +2322,17 @@ get "/api/v1/channels/:ucid/videos" do |env|
json.field "videoId", video_id
json.field "videoThumbnails" do
json.object do
qualities = [{name: "default", url: "default", width: 120, height: 90},
{name: "high", url: "hqdefault", width: 480, height: 360},
{name: "medium", url: "mqdefault", width: 320, height: 180},
]
qualities = [{name: "default", url: "default", width: 120, height: 90},
{name: "high", url: "hqdefault", width: 480, height: 360},
{name: "medium", url: "mqdefault", width: 320, height: 180},
]
json.array do
qualities.each do |quality|
json.field quality[:name] do
json.object do
json.field "url", "https://i.ytimg.com/vi/#{video_id}/#{quality["url"]}.jpg"
json.field "width", quality[:width]
json.field "height", quality[:height]
end
json.object do
json.field "quality", quality[:name]
json.field "url", "https://i.ytimg.com/vi/#{video_id}/#{quality["url"]}.jpg"
json.field "width", quality[:width]
json.field "height", quality[:height]
end
end
end