Skip to content

fix(youtube): Videos tab fallback misses lockupViewModel format#1733

Open
FSpark wants to merge 1 commit into
jackwener:mainfrom
FSpark:fix/youtube-channel-lockupviewmodel
Open

fix(youtube): Videos tab fallback misses lockupViewModel format#1733
FSpark wants to merge 1 commit into
jackwener:mainfrom
FSpark:fix/youtube-channel-lockupviewmodel

Conversation

@FSpark
Copy link
Copy Markdown

@FSpark FSpark commented May 23, 2026

Problem

After #1164 landed, opencli youtube channel <id> still returns empty recent_videos for channels whose Home tab is empty AND whose Videos tab uses the newer lockupViewModel InnerTube format.

Reproducer: opencli youtube channel @Jett.franzen (~207K subs, 216 videos). Returns 0 videos despite the Videos tab being fully populated.

Root cause

The Videos-tab fallback added in #1109 only parses item.richItemRenderer?.content?.videoRenderer (the legacy format). Many channels now return the newer lockupViewModel format from the Videos tab browse endpoint, which the fallback silently skips.

Meanwhile, the Home tab extraction (lines 101-118) already handles lockupViewModel, creating an inconsistency between the two code paths.

Concrete shape on the reproducer channel:

// Videos tab richGrid item — lockupViewModel (skipped)
{
  richItemRenderer: {
    content: {
      lockupViewModel: {
        contentType: 'LOCKUP_CONTENT_TYPE_VIDEO',
        contentId: 'G4ngHcS4aJs',
        metadata: { lockupMetadataViewModel: { title: { content: '...' }, ... } },
        contentImage: { thumbnailViewModel: { overlays: [/* duration badge */] } },
        ...
      }
    }
  }
}

Fix

Extract a shared parseVideoItem() helper that handles both lockupViewModel and videoRenderer formats, and use it in the Videos-tab fallback loop. This reuses the same parsing logic already proven in the Home tab path.

Changes:

  • clis/youtube/channel.js: +32 lines (new parseVideoItem helper, updated fallback)
  • clis/youtube/channel.test.js: +6 test cases for the new helper

Verification

$ opencli youtube channel @Jett.franzen --limit 10 -f json
# Before: returns metadata only, 0 videos
# After:  returns 10 videos with title, duration, views, url

npm test --project adapter passes (3418 / 3418).

🤖 Generated with Claude Code

The Videos tab fallback (added in jackwener#1109, fixed in jackwener#1164) only handled
the legacy `videoRenderer` format. Channels whose Videos tab returns
the newer `lockupViewModel` format got zero videos despite having content.

Extract `parseVideoItem()` as a shared helper that handles both formats,
and reuse it in the Videos tab fallback. Add comprehensive tests for
the new helper including serialization checks for browser injection.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant