rename author_handle to channel_handle

This commit is contained in:
Fijxu 2026-02-23 18:32:20 -03:00
parent 55f5bde69e
commit 2c5076b97c
No known key found for this signature in database
GPG Key ID: 32C1DDF333EDA6A4
3 changed files with 10 additions and 10 deletions

View File

@ -2,7 +2,7 @@
record AboutChannel, record AboutChannel,
ucid : String, ucid : String,
author : String, author : String,
author_handle : String?, channel_handle : String?,
auto_generated : Bool, auto_generated : Bool,
author_url : String, author_url : String,
author_thumbnail : String, author_thumbnail : String,
@ -163,7 +163,7 @@ def get_about_info(ucid, locale) : AboutChannel
sub_count = 0 sub_count = 0
pronouns = nil pronouns = nil
author_handle = nil channel_handle = nil
if (metadata_rows = initdata.dig?("header", "pageHeaderRenderer", "content", "pageHeaderViewModel", "metadata", "contentMetadataViewModel", "metadataRows").try &.as_a) if (metadata_rows = initdata.dig?("header", "pageHeaderRenderer", "content", "pageHeaderViewModel", "metadata", "contentMetadataViewModel", "metadataRows").try &.as_a)
metadata_rows.each do |row| metadata_rows.each do |row|
@ -174,9 +174,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 sub_count = short_text_to_number(subscribe_metadata_part.dig("text", "content").as_s.split(" ")[0]).to_i32
end end
author_handle_part = metadata_parts.try &.as_a.find { |i| i.dig?("text", "content").try &.as_s.includes?("@") } channel_handle_part = metadata_parts.try &.as_a.find { |i| i.dig?("text", "content").try &.as_s.includes?("@") }
if !author_handle_part.nil? if !channel_handle_part.nil?
author_handle = author_handle_part.dig("text", "content").as_s channel_handle = channel_handle_part.dig("text", "content").as_s
end end
pronoun_metadata_part = metadata_parts.try &.as_a.find { |i| i.dig?("tooltip").try &.as_s.includes?("Pronouns") } pronoun_metadata_part = metadata_parts.try &.as_a.find { |i| i.dig?("tooltip").try &.as_s.includes?("Pronouns") }
@ -186,14 +186,14 @@ def get_about_info(ucid, locale) : AboutChannel
# This is to prevent processing more metadata parts if we already have # This is to prevent processing more metadata parts if we already have
# all the parts we care about, which are the ones below # 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
end end
AboutChannel.new( AboutChannel.new(
ucid: ucid, ucid: ucid,
author: author, author: author,
author_handle: author_handle, channel_handle: channel_handle,
auto_generated: auto_generated, auto_generated: auto_generated,
author_url: author_url, author_url: author_url,
author_thumbnail: author_thumbnail, author_thumbnail: author_thumbnail,

View File

@ -48,7 +48,7 @@ module Invidious::Routes::API::V1::Channels
# TODO: Refactor into `to_json` for InvidiousChannel # TODO: Refactor into `to_json` for InvidiousChannel
json.object do json.object do
json.field "author", channel.author json.field "author", channel.author
json.field "authorHandle", channel.author_handle json.field "channelHandle", channel.channel_handle
json.field "authorId", channel.ucid json.field "authorId", channel.ucid
json.field "authorUrl", channel.author_url json.field "authorUrl", channel.author_url

View File

@ -16,8 +16,8 @@
<span class="channel-name"><%= author %></span><% if !channel.verified.nil? && channel.verified %>&nbsp;<i class="icon ion ion-md-checkmark-circle"></i><% end %> <span class="channel-name"><%= author %></span><% if !channel.verified.nil? && channel.verified %>&nbsp;<i class="icon ion ion-md-checkmark-circle"></i><% end %>
<span class="channel-metadata"> <span class="channel-metadata">
<br/> <br/>
<% if !channel.author_handle.nil? %> <% if !channel.channel_handle.nil? %>
<span class="channel-metadata-item"><b><%= channel.author_handle %></b></span> <span class="channel-metadata-item"><b><%= channel.channel_handle %></b></span>
<span>•</span> <span>•</span>
<% end %> <% end %>
<% if !channel.pronouns.nil? %><span class="channel-metadata-item"><%= channel.pronouns %></span><% end %> <% if !channel.pronouns.nil? %><span class="channel-metadata-item"><%= channel.pronouns %></span><% end %>