From e1cfb5c73e7bd184292fe7ee15fbb96143471298 Mon Sep 17 00:00:00 2001 From: csjad Date: Sat, 19 Sep 2026 12:16:18 +0800 Subject: [PATCH] Keep byline author and channel id a matched pair Follow-up to the initial fix: when the first byline run has no browse id, the previous change substituted ucid from a later run while the displayed author name still came from run zero, so the card could show one channel's name linked to another channel. Take author text and browse id together from the first run that carries a link instead. Single-creator bylines are unaffected: the fallback still only runs when ucid is empty. Fixes #5722 --- src/invidious/videos/parser.cr | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/invidious/videos/parser.cr b/src/invidious/videos/parser.cr index 5511f53be..e159f0096 100644 --- a/src/invidious/videos/parser.cr +++ b/src/invidious/videos/parser.cr @@ -31,10 +31,15 @@ module Invidious::Videos::Parser # Multi-creator ("collab") videos split the byline into several runs and # the channel link isn't always attached to the first one, which left # ucid empty and the related-video card without an author hyperlink (#5722). - # Scan every byline run for a browse id instead of only the first one. + # Fall back to the first run that carries a browse id, keeping author and + # ucid a matched pair so the displayed name always matches the linked channel. if ucid.try(&.empty?) && (byline_runs = (related["shortBylineText"]? || related["longBylineText"]?) .try &.dig?("runs").try &.as_a) - ucid = byline_runs.map { |run| HelperExtractors.get_browse_id(run) }.find { |id| !id.empty? } + matched = byline_runs.find { |run| !HelperExtractors.get_browse_id(run).empty? } + if matched + author = matched.dig?("text") + ucid = HelperExtractors.get_browse_id(matched) + end end short_view_count = related.try do |r|