Skip to content

fix(youtube): fall back to Videos tab when Home tab has no videos#1109

Merged
jackwener merged 2 commits intojackwener:mainfrom
kagura-agent:fix/youtube-channel-empty-videos
Apr 21, 2026
Merged

fix(youtube): fall back to Videos tab when Home tab has no videos#1109
jackwener merged 2 commits intojackwener:mainfrom
kagura-agent:fix/youtube-channel-empty-videos

Conversation

@kagura-agent
Copy link
Copy Markdown
Contributor

Problem

opencli youtube channel <id> returns an empty recent_videos list for some channels that have videos visible in the browser (Closes #1108).

Root Cause

The command only extracts videos from the Home tab (tabs.find(t => t.tabRenderer?.selected)). Some channels don't have video shelves on their Home tab — they may have a minimal or empty Home layout — so the extraction finds nothing.

Fix

When the Home tab yields zero videos, the command now:

  1. Finds the Videos tab from the tabs array (tabRenderer.title === 'Videos')
  2. Makes a second InnerTube browse request using the Videos tab's browseEndpoint.params
  3. Extracts videos from the richGridRenderer format used by the Videos tab

This is a pure fallback — channels that already show videos on their Home tab are unaffected.

Testing

  • npx tsc --noEmit — clean
  • npm test — all 1695 tests pass (222 files)
  • Only clis/youtube/channel.js modified (+29 lines)

kagura-agent and others added 2 commits April 21, 2026 11:11
…ckwener#1108)

Some channels have no video shelves on their Home tab, causing
`opencli youtube channel <id>` to return an empty `recent_videos` list
even though the channel has videos visible in the browser.

When the Home tab extraction finds zero videos, the command now makes
a second InnerTube browse request to the Videos tab and extracts from
its richGridRenderer format.
@jackwener jackwener merged commit b3db955 into jackwener:main Apr 21, 2026
11 checks passed
luxiaolei pushed a commit to luxiaolei/OpenCLI that referenced this pull request Apr 22, 2026
…ckwener#1109)

* fix(youtube): fall back to Videos tab when Home tab has no videos (jackwener#1108)

Some channels have no video shelves on their Home tab, causing
`opencli youtube channel <id>` to return an empty `recent_videos` list
even though the channel has videos visible in the browser.

When the Home tab extraction finds zero videos, the command now makes
a second InnerTube browse request to the Videos tab and extracts from
its richGridRenderer format.

* fix(youtube): make Videos tab fallback locale-safe

---------

Co-authored-by: jackwener <jakevingoo@gmail.com>
(cherry picked from commit b3db955)
jackwener added a commit that referenced this pull request Apr 27, 2026
…ube response (#1164)

* fix(youtube): channel videos-tab fallback reads wrong tab from InnerTube response

After PR #1109, `opencli youtube channel <id>` still returns empty
`recent_videos` for channels whose Home tab is empty AND whose InnerTube
`/youtubei/v1/browse` response includes multiple tabs.

Root cause: the fallback fetch sends a browse request with the Videos
tab's `params`. The response, however, includes ALL tabs (Home, Videos,
Shorts, ...), with only the requested tab marked `selected: true`. The
existing code reads `tabs?.[0]?.tabRenderer?.content?.richGridRenderer?.contents`
— for multi-tab responses `tabs[0]` is Home (empty), so `richGrid` ends
up `[]` and `recentVideos` stays empty. PR #1109's test channels happened
to return single-tab lists with Videos at index 0, masking the bug.

Fix: find the tab with `selected: true` instead of assuming `tabs[0]`.

Reproducer: `opencli youtube channel UC44DSuDgw7_qccvZzIK3Jpg`
(杀鱼伟-Vi, ~3.1K subs, posts daily). Returns 0 videos pre-patch, 30+
videos post-patch.

`npm run typecheck` clean, `npm test` passes (1952/1952).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(youtube): preserve videos tab fallback

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: jackwener <jakevingoo@gmail.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.

[Bug]: twitter channel returns empty recent_videos for some channels that have videos

2 participants