Skip to content

Parse channel handle and display it on channel page and API#5640

Open
Fijxu wants to merge 5 commits intoiv-org:masterfrom
Fijxu:display-channel-handle
Open

Parse channel handle and display it on channel page and API#5640
Fijxu wants to merge 5 commits intoiv-org:masterfrom
Fijxu:display-channel-handle

Conversation

@Fijxu
Copy link
Member

@Fijxu Fijxu commented Feb 20, 2026

It also fixes some inconsistencies with the CSS and HTML that was introduced in #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 in the first place.

Closes #5638


Looks like this in the Invidious frontend (with borders enabled just to see each element sizes and limits):

image

The API looks like this:

  ...
  "author": "Fijxu - Topic",
  "authorHandle": "@Fijxuu",
  "authorId": "UCw-aR42z5gUcarpPGN5OKfA",
  ...

It also fixes some inconsistencies with the CSS and HTML that was
introduced in iv-org#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 iv-org#5638
Co-authored-by: ChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds channel handle parsing and display functionality to Invidious, addressing issue #5638. It extracts the channel handle (e.g., @username) from YouTube's metadata and displays it on the channel page alongside the channel name and pronouns. The change also exposes the handle in the API response.

Changes:

  • Parses channel handle from YouTube metadata and stores it in the AboutChannel record
  • Displays channel handle on the channel page below the channel name
  • Adds channel handle to the API response for channel endpoints
  • Refactors CSS classes to match the new HTML structure

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
src/invidious/channels/about.cr Adds author_handle field to AboutChannel record and parsing logic to extract it from metadata
src/invidious/routes/api/v1/channels.cr Adds authorHandle field to the JSON API response
src/invidious/views/components/channel_info.ecr Updates HTML template to display channel handle with restructured CSS classes
assets/css/default.css Updates CSS selectors to match new HTML structure

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Fijxu Fijxu requested a review from unixfox February 23, 2026 21:42
@ashleyirispuppy143
Copy link
Contributor

why rename author_handle to channel_handle? the channel id and like the channel name and stuff is called author so why the handle wouldnt be?

@Fijxu
Copy link
Member Author

Fijxu commented Feb 27, 2026

channel_handle

Just to be consistent by how is set in src/invidious/helpers/serialized_yt_data.cr! If any other maintainer wants to change it to author_handle, I'll change it. I really have no preference, once the new key is set, people that use the API will use that and is not going to be changed as it will be a breaking change ;)

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature request] Add Channel Handles to channel page

5 participants