Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions assets/css/default.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -417,8 +416,8 @@ 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-name-pronouns > .channel-name
.channel-profile > .channel-info > .channel-name,
.channel-profile > .channel-info > .channel-metadata > .channel-metadata-item
{
overflow-wrap: anywhere;
}
Expand Down Expand Up @@ -902,4 +901,4 @@ h1, h2, h3, h4, h5, p,
.error-issue-template {
padding: 20px;
background: rgba(0, 0, 0, 0.12345);
}
}
18 changes: 15 additions & 3 deletions src/invidious/channels/about.cr
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
record AboutChannel,
ucid : String,
author : String,
channel_handle : String?,
auto_generated : Bool,
author_url : String,
author_thumbnail : String,
Expand Down Expand Up @@ -162,26 +163,37 @@ def get_about_info(ucid, locale) : AboutChannel

sub_count = 0
pronouns = nil
channel_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") }
channel_handle_part = metadata_parts.try &.as_a.find { |i| i.dig?("text", "content").try &.as_s.includes?("@") }
if !channel_handle_part.nil?
Comment on lines +177 to +178
Copy link
Copy Markdown
Member

@SamantazFox SamantazFox Feb 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can combine that in a single if statement:

Suggested change
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?("@") }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(And similarly, you can do this to the other if statements in this .each loop)

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?
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 below
break if sub_count != 0 && !pronouns.nil? && !channel_handle.nil?
end
end

AboutChannel.new(
ucid: ucid,
author: author,
channel_handle: channel_handle,
auto_generated: auto_generated,
author_url: author_url,
author_thumbnail: author_thumbnail,
Expand Down
1 change: 1 addition & 0 deletions src/invidious/routes/api/v1/channels.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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 "channelHandle", channel.channel_handle
json.field "authorId", channel.ucid
json.field "authorUrl", channel.author_url

Expand Down
15 changes: 12 additions & 3 deletions src/invidious/views/components/channel_info.ecr
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,19 @@
<div class="pure-u-1-2 flex-left flexible">
<div class="channel-profile">
<img src="/ggpht<%= channel_profile_pic %>" alt="" />
<div class="channel-name-pronouns">
<span class="channel-info">
<span class="channel-name"><%= author %></span><% if !channel.verified.nil? && channel.verified %>&nbsp;<i class="icon ion ion-md-checkmark-circle"></i><% end %>
<% if !channel.pronouns.nil? %><br /><span class="channel-pronouns"><%= channel.pronouns %></span><% end %>
</div>
<span class="channel-metadata">
<br/>
<% if !channel.channel_handle.nil? %>
<span class="channel-metadata-item"><b><%= channel.channel_handle %></b></span>
<% end %>
<% if !channel.pronouns.nil? %>
<span>•</span>
<span class="channel-metadata-item"><%= channel.pronouns %></span>
<% end %>
</span>
</span>
</div>
</div>

Expand Down