diff --git a/src/invidious/channels/about.cr b/src/invidious/channels/about.cr index 27f77466..d5b1bac4 100644 --- a/src/invidious/channels/about.cr +++ b/src/invidious/channels/about.cr @@ -16,7 +16,7 @@ struct AboutChannel property is_family_friendly : Bool property allowed_regions : Array(String) property related_channels : Array(AboutRelatedChannel) - property tabs : Hash(String, Tuple(Int32, String)) # TabName => {TabiZZndex, browseEndpoint params} + property tabs : Array(String) property links : Array(Tuple(String, String, String)) end @@ -124,7 +124,7 @@ def get_about_info(ucid, locale) country = "" total_views = 0_i64 joined = Time.unix(0) - tabs = {} of String => Tuple(Int32, String) # TabName => {TabiZZndex, browseEndpoint params} + tabs = [] of String links = [] of {String, String, String} tabs_json = initdata["contents"]["twoColumnBrowseResultsRenderer"]["tabs"]?.try &.as_a? @@ -175,14 +175,9 @@ def get_about_info(ucid, locale) auto_generated = true end end - if node["tabRenderer"]? - tab_names << node["tabRenderer"]["title"].as_s.downcase - tab_data << {i, node["tabRenderer"]["endpoint"]["browseEndpoint"]["params"].as_s} - end - end - tabs = Hash.zip(tab_names, tab_data) + tabs = tabs_json.reject { |node| node["tabRenderer"]?.nil? }.map { |node| node["tabRenderer"]["title"].as_s.downcase } end sub_count = initdata["header"]["c4TabbedHeaderRenderer"]?.try &.["subscriberCountText"]?.try &.["simpleText"]?.try &.as_s? diff --git a/src/invidious/routes/channels.cr b/src/invidious/routes/channels.cr index 89e762cd..cacb7087 100644 --- a/src/invidious/routes/channels.cr +++ b/src/invidious/routes/channels.cr @@ -87,7 +87,7 @@ module Invidious::Routes::Channels continuation = env.params.query["continuation"]? # sort_by = env.params.query["sort_by"]?.try &.downcase - if !channel.tabs.has_key?("community") + if !channel.tabs.includes?("community") return env.redirect "/channel/#{channel.ucid}" end @@ -110,7 +110,7 @@ module Invidious::Routes::Channels end locale, user, subscriptions, continuation, ucid, channel = data - if !channel.tabs.has_key?("channels") + if !channel.tabs.includes?("channels") return env.redirect "/channel/#{channel.ucid}" end @@ -126,7 +126,7 @@ module Invidious::Routes::Channels # Previous continuation previous_continuation = env.params.query["previous"]? - featured_channel_categories, continuation_token = fetch_channel_featured_channels(ucid, channel.tabs["channels"], nil, nil, continuation, current_category_title).not_nil! + featured_channel_categories, continuation_token = fetch_channel_featured_channels(ucid, "EghjaGFubmVscw%3D%3D", nil, nil, continuation, current_category_title).not_nil! elsif view && shelf_id offset = env.params.query["offset"]? if offset @@ -135,12 +135,12 @@ module Invidious::Routes::Channels offset = 0 end - featured_channel_categories, continuation_token = fetch_channel_featured_channels(ucid, channel.tabs["channels"], view, shelf_id, continuation, current_category_title).not_nil! + featured_channel_categories, continuation_token = fetch_channel_featured_channels(ucid, "EghjaGFubmVscw%3D%3D", view, shelf_id, continuation, current_category_title).not_nil! else previous_continuation = nil offset = 0 - featured_channel_categories, continuation_token = fetch_channel_featured_channels(ucid, channel.tabs["channels"], nil, nil, current_category_title).not_nil! + featured_channel_categories, continuation_token = fetch_channel_featured_channels(ucid, "EghjaGFubmVscw%3D%3D", nil, nil, current_category_title).not_nil! end templated "channel/featured_channels", buffer_footer: true diff --git a/src/invidious/views/components/channel-information.ecr b/src/invidious/views/components/channel-information.ecr index f2f551dd..aef807d1 100644 --- a/src/invidious/views/components/channel-information.ecr +++ b/src/invidious/views/components/channel-information.ecr @@ -104,7 +104,7 @@ <% end %> - <% if channel.tabs.has_key?("community") %> + <% if channel.tabs.includes?("community") %> <% if content_type == 3 %>