Can fetch related channels using just the channel ucid]

This commit is contained in:
matthewmcgarvey
2022-01-10 17:07:52 -06:00
parent 4962c00ba8
commit dc62b6ffdb
2 changed files with 16 additions and 33 deletions

View File

@@ -96,23 +96,21 @@ module Invidious::Routes::API::V1::Channels
json.field "relatedChannels" do
json.array do
if related_channels = channel.related_channels
fetch_related_channels(related_channels).each do |related_channel|
json.object do
json.field "author", related_channel.author
json.field "authorId", related_channel.ucid
json.field "authorUrl", related_channel.author_url
fetch_related_channels(channel).each do |related_channel|
json.object do
json.field "author", related_channel.author
json.field "authorId", related_channel.ucid
json.field "authorUrl", related_channel.author_url
json.field "authorThumbnails" do
json.array do
qualities = {32, 48, 76, 100, 176, 512}
json.field "authorThumbnails" do
json.array do
qualities = {32, 48, 76, 100, 176, 512}
qualities.each do |quality|
json.object do
json.field "url", related_channel.author_thumbnail.gsub(/=\d+/, "=s#{quality}")
json.field "width", quality
json.field "height", quality
end
qualities.each do |quality|
json.object do
json.field "url", related_channel.author_thumbnail.gsub(/=\d+/, "=s#{quality}")
json.field "width", quality
json.field "height", quality
end
end
end