From 828656f1f70ddc82bcb28bfcc1800bae3e5a8769 Mon Sep 17 00:00:00 2001 From: Fijxu Date: Fri, 20 Feb 2026 01:25:37 -0300 Subject: [PATCH 1/6] Parse channel handle and display it on channel page It also fixes some inconsistencies with the CSS and HTML that was introduced in https://github.com/iv-org/invidious/pull/5617 but I didn't really noticed about because it looked fine in the Invidious frontend. I also added a comment about the `break` statement in the metadata_rows row iteration because I didn't get why that `break` was there. Closes https://github.com/iv-org/invidious/issues/5638 --- assets/css/default.css | 7 +++---- src/invidious/channels/about.cr | 18 +++++++++++++++--- src/invidious/routes/api/v1/channels.cr | 1 + .../views/components/channel_info.ecr | 13 ++++++++++--- 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/assets/css/default.css b/assets/css/default.css index 726a4c377..c335072b5 100644 --- a/assets/css/default.css +++ b/assets/css/default.css @@ -75,12 +75,11 @@ body { height: auto; } -.channel-profile > .channel-name-pronouns { +.channel-profile > .channel-info { display: inline-block; } -.channel-profile > .channel-name-pronouns > .channel-pronouns { - font-style: italic; +.channel-profile > .channel-info > .channel-metadata > .channel-metadata-item { font-size: .8em; font-weight: lighter; } @@ -418,7 +417,7 @@ p.channel-name { margin: 0; overflow-wrap: anywhere;} p.video-data { margin: 0; font-weight: bold; font-size: 80%; } .channel-profile > .channel-name, -.channel-profile > .channel-name-pronouns > .channel-name +.channel-profile > .channel-info > .channel-metadata > .channel-metadata-item { overflow-wrap: anywhere; } diff --git a/src/invidious/channels/about.cr b/src/invidious/channels/about.cr index bb55147b5..c6c8bb839 100644 --- a/src/invidious/channels/about.cr +++ b/src/invidious/channels/about.cr @@ -2,6 +2,7 @@ record AboutChannel, ucid : String, author : String, + author_handle : String?, auto_generated : Bool, author_url : String, author_thumbnail : String, @@ -167,26 +168,37 @@ def get_about_info(ucid, locale) : AboutChannel sub_count = 0 pronouns = nil + author_handle = nil if (metadata_rows = initdata.dig?("header", "pageHeaderRenderer", "content", "pageHeaderViewModel", "metadata", "contentMetadataViewModel", "metadataRows").try &.as_a) metadata_rows.each do |row| - subscribe_metadata_part = row.dig?("metadataParts").try &.as_a.find { |i| i.dig?("text", "content").try &.as_s.includes?("subscribers") } + metadata_parts = row.dig?("metadataParts") + + subscribe_metadata_part = metadata_parts.try &.as_a.find { |i| i.dig?("text", "content").try &.as_s.includes?("subscribers") } if !subscribe_metadata_part.nil? sub_count = short_text_to_number(subscribe_metadata_part.dig("text", "content").as_s.split(" ")[0]).to_i32 end - pronoun_metadata_part = row.dig?("metadataParts").try &.as_a.find { |i| i.dig?("tooltip").try &.as_s.includes?("Pronouns") } + author_handle_part = metadata_parts.try &.as_a.find { |i| i.dig?("text", "content").try &.as_s.includes?("@") } + if !author_handle_part.nil? + author_handle = author_handle_part.dig("text", "content").as_s + end + + pronoun_metadata_part = metadata_parts.try &.as_a.find { |i| i.dig?("tooltip").try &.as_s.includes?("Pronouns") } if !pronoun_metadata_part.nil? pronouns = pronoun_metadata_part.dig("text", "content").as_s end - break if sub_count != 0 && !pronouns.nil? + # This is to prevent processing more metadata parts if we already have + # all the parts we care about, which are the ones bellow + break if sub_count != 0 && !pronouns.nil? && !author_handle.nil? end end AboutChannel.new( ucid: ucid, author: author, + author_handle: author_handle, auto_generated: auto_generated, author_url: author_url, author_thumbnail: author_thumbnail, diff --git a/src/invidious/routes/api/v1/channels.cr b/src/invidious/routes/api/v1/channels.cr index 0d597edee..a51cfebe3 100644 --- a/src/invidious/routes/api/v1/channels.cr +++ b/src/invidious/routes/api/v1/channels.cr @@ -48,6 +48,7 @@ module Invidious::Routes::API::V1::Channels # TODO: Refactor into `to_json` for InvidiousChannel json.object do json.field "author", channel.author + json.field "authorHandle", channel.author_handle json.field "authorId", channel.ucid json.field "authorUrl", channel.author_url diff --git a/src/invidious/views/components/channel_info.ecr b/src/invidious/views/components/channel_info.ecr index 9395000a4..291db366d 100644 --- a/src/invidious/views/components/channel_info.ecr +++ b/src/invidious/views/components/channel_info.ecr @@ -12,10 +12,17 @@
-
+ <%= author %><% if !channel.verified.nil? && channel.verified %> <% end %> - <% if !channel.pronouns.nil? %>
<%= channel.pronouns %><% end %> -
+ +
From fd01de785d5cb6d49fa1031da1c1f73a221bfe6f Mon Sep 17 00:00:00 2001 From: Fijxu Date: Fri, 20 Feb 2026 18:41:44 -0300 Subject: [PATCH 2/6] Update src/invidious/channels/about.cr Co-authored-by: ChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com> --- src/invidious/channels/about.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/invidious/channels/about.cr b/src/invidious/channels/about.cr index c6c8bb839..f49aa91d6 100644 --- a/src/invidious/channels/about.cr +++ b/src/invidious/channels/about.cr @@ -190,7 +190,7 @@ def get_about_info(ucid, locale) : AboutChannel end # This is to prevent processing more metadata parts if we already have - # all the parts we care about, which are the ones bellow + # all the parts we care about, which are the ones below break if sub_count != 0 && !pronouns.nil? && !author_handle.nil? end end From 27d23ae51387ac4f5032efbc9a0016038a872c34 Mon Sep 17 00:00:00 2001 From: Fijxu Date: Mon, 23 Feb 2026 18:32:20 -0300 Subject: [PATCH 3/6] rename author_handle to channel_handle --- src/invidious/channels/about.cr | 14 +++++++------- src/invidious/routes/api/v1/channels.cr | 2 +- src/invidious/views/components/channel_info.ecr | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/invidious/channels/about.cr b/src/invidious/channels/about.cr index f49aa91d6..bf7ccaaed 100644 --- a/src/invidious/channels/about.cr +++ b/src/invidious/channels/about.cr @@ -2,7 +2,7 @@ record AboutChannel, ucid : String, author : String, - author_handle : String?, + channel_handle : String?, auto_generated : Bool, author_url : String, author_thumbnail : String, @@ -168,7 +168,7 @@ def get_about_info(ucid, locale) : AboutChannel sub_count = 0 pronouns = nil - author_handle = nil + channel_handle = nil if (metadata_rows = initdata.dig?("header", "pageHeaderRenderer", "content", "pageHeaderViewModel", "metadata", "contentMetadataViewModel", "metadataRows").try &.as_a) metadata_rows.each do |row| @@ -179,9 +179,9 @@ def get_about_info(ucid, locale) : AboutChannel sub_count = short_text_to_number(subscribe_metadata_part.dig("text", "content").as_s.split(" ")[0]).to_i32 end - author_handle_part = metadata_parts.try &.as_a.find { |i| i.dig?("text", "content").try &.as_s.includes?("@") } - if !author_handle_part.nil? - author_handle = author_handle_part.dig("text", "content").as_s + channel_handle_part = metadata_parts.try &.as_a.find { |i| i.dig?("text", "content").try &.as_s.includes?("@") } + if !channel_handle_part.nil? + channel_handle = channel_handle_part.dig("text", "content").as_s end pronoun_metadata_part = metadata_parts.try &.as_a.find { |i| i.dig?("tooltip").try &.as_s.includes?("Pronouns") } @@ -191,14 +191,14 @@ def get_about_info(ucid, locale) : AboutChannel # This is to prevent processing more metadata parts if we already have # all the parts we care about, which are the ones below - break if sub_count != 0 && !pronouns.nil? && !author_handle.nil? + break if sub_count != 0 && !pronouns.nil? && !channel_handle.nil? end end AboutChannel.new( ucid: ucid, author: author, - author_handle: author_handle, + channel_handle: channel_handle, auto_generated: auto_generated, author_url: author_url, author_thumbnail: author_thumbnail, diff --git a/src/invidious/routes/api/v1/channels.cr b/src/invidious/routes/api/v1/channels.cr index a51cfebe3..a1400664b 100644 --- a/src/invidious/routes/api/v1/channels.cr +++ b/src/invidious/routes/api/v1/channels.cr @@ -48,7 +48,7 @@ module Invidious::Routes::API::V1::Channels # TODO: Refactor into `to_json` for InvidiousChannel json.object do json.field "author", channel.author - json.field "authorHandle", channel.author_handle + json.field "channelHandle", channel.channel_handle json.field "authorId", channel.ucid json.field "authorUrl", channel.author_url diff --git a/src/invidious/views/components/channel_info.ecr b/src/invidious/views/components/channel_info.ecr index 291db366d..3f08b8b7b 100644 --- a/src/invidious/views/components/channel_info.ecr +++ b/src/invidious/views/components/channel_info.ecr @@ -16,8 +16,8 @@ <%= author %><% if !channel.verified.nil? && channel.verified %> <% end %> From 89288424df6a4c349ec915554f0a7044ece30341 Mon Sep 17 00:00:00 2001 From: Fijxu Date: Mon, 23 Feb 2026 18:41:30 -0300 Subject: [PATCH 5/6] fix .channel-profile > .channel-name child --- assets/css/default.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/css/default.css b/assets/css/default.css index c335072b5..556a770e7 100644 --- a/assets/css/default.css +++ b/assets/css/default.css @@ -416,7 +416,7 @@ input[type="search"]::-webkit-search-cancel-button { p.channel-name { margin: 0; overflow-wrap: anywhere;} p.video-data { margin: 0; font-weight: bold; font-size: 80%; } -.channel-profile > .channel-name, +.channel-profile > .channel-info > .channel-name, .channel-profile > .channel-info > .channel-metadata > .channel-metadata-item { overflow-wrap: anywhere; @@ -908,4 +908,4 @@ h1, h2, h3, h4, h5, p, padding-left: 10px; display: inline-block; vertical-align: top; -} \ No newline at end of file +} From f5f4e49fc636206b09515cda83ac899eb71b974a Mon Sep 17 00:00:00 2001 From: Fijxu Date: Sun, 2 Aug 2026 18:59:56 -0400 Subject: [PATCH 6/6] move variables set to if statement --- src/invidious/channels/about.cr | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/invidious/channels/about.cr b/src/invidious/channels/about.cr index bf7ccaaed..a070a3732 100644 --- a/src/invidious/channels/about.cr +++ b/src/invidious/channels/about.cr @@ -174,18 +174,15 @@ def get_about_info(ucid, locale) : AboutChannel metadata_rows.each do |row| metadata_parts = row.dig?("metadataParts") - subscribe_metadata_part = metadata_parts.try &.as_a.find { |i| i.dig?("text", "content").try &.as_s.includes?("subscribers") } - if !subscribe_metadata_part.nil? + if (subscribe_metadata_part = metadata_parts.try &.as_a.find { |i| i.dig?("text", "content").try &.as_s.includes?("subscribers") }) sub_count = short_text_to_number(subscribe_metadata_part.dig("text", "content").as_s.split(" ")[0]).to_i32 end - channel_handle_part = metadata_parts.try &.as_a.find { |i| i.dig?("text", "content").try &.as_s.includes?("@") } - if !channel_handle_part.nil? + if (channel_handle_part = metadata_parts.try &.as_a.find { |i| i.dig?("text", "content").try &.as_s.includes?("@") }) channel_handle = channel_handle_part.dig("text", "content").as_s end - pronoun_metadata_part = metadata_parts.try &.as_a.find { |i| i.dig?("tooltip").try &.as_s.includes?("Pronouns") } - if !pronoun_metadata_part.nil? + if (pronoun_metadata_part = metadata_parts.try &.as_a.find { |i| i.dig?("tooltip").try &.as_s.includes?("Pronouns") }) pronouns = pronoun_metadata_part.dig("text", "content").as_s end