feat: restore CC (subtitles) indicator on channel /videos page (fixes #1522)
Summary
YouTube removed the Closed Captions (CC) indicator badge from channel /videos and /shorts pages. This PR restores it.
Problem
Channel video lists no longer show which videos have subtitles/captions. The CC indicator still appears on playlist pages but was removed from channel video grids — making it harder for users who rely on subtitles to find accessible content.
Solution
3 files changed, +150 lines:
| File | Change |
|---|---|
channel.js |
New ImprovedTube.ccIndicator() function + containerHasCaptions() helper |
general.css |
.it-cc-indicator styles using YouTube design tokens |
init.js |
Hooks into yt-navigate-finish and yt-page-data-updated |
How it works:
- On channel
/videosor/shortspages, scans all video renderers (ytd-rich-item-renderer,ytd-grid-video-renderer) - For each video, checks YouTube internal
__datafor caption availability via 3 methods:- Badges array —
tooltipcontaining "closed caption" / "subtitle" - Thumbnail overlay badges —
accessibilityData.labelcontaining "closed caption" - Caption track infos —
captionTrackInfos.length > 0
- Badges array —
- Inserts a styled CC badge next to the video metadata
- Re-runs on SPA navigation (
yt-navigate-finish) and infinite scroll (yt-page-data-updated)
Design
The badge uses YouTube CSS variables to match native styling:
- Font:
var(--yt-sans-font)10px/500 weight - Background:
var(--yt-spec-badge-chip-background) - Color:
var(--yt-text-secondary) - Hover state with slightly darker background
Testing
Manual testing steps:
- Open any YouTube channel with subtitled videos (e.g., a news/educational channel)
- Navigate to the
/videostab - Verify CC badges appear on videos that have captions
- Scroll down (infinite scroll) — verify new badges appear
- Click a video then go back — verify badges persist after SPA navigation
- Disable ImprovedTube — verify native YouTube behavior is unchanged
Screenshots
N/A (UI feature — visual verification needed)
LLM Disclosure: This PR was authored with assistance from AI coding tools (Claude/Hermes agent). I analyzed the ImprovedTube codebase structure, YouTubes internal data model for caption info, and the existing navigation hook patterns before implementing.
hi! @jiangyj545 this PR is broken. thanks