youtube icon indicating copy to clipboard operation
youtube copied to clipboard

feat: restore CC (subtitles) indicator on channel /videos page (fixes #1522)

Open jiangyj545 opened this issue 6 months ago • 1 comments

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:

  1. On channel /videos or /shorts pages, scans all video renderers (ytd-rich-item-renderer, ytd-grid-video-renderer)
  2. For each video, checks YouTube internal __data for caption availability via 3 methods:
    • Badges array — tooltip containing "closed caption" / "subtitle"
    • Thumbnail overlay badges — accessibilityData.label containing "closed caption"
    • Caption track infos — captionTrackInfos.length > 0
  3. Inserts a styled CC badge next to the video metadata
  4. 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:

  1. Open any YouTube channel with subtitled videos (e.g., a news/educational channel)
  2. Navigate to the /videos tab
  3. Verify CC badges appear on videos that have captions
  4. Scroll down (infinite scroll) — verify new badges appear
  5. Click a video then go back — verify badges persist after SPA navigation
  6. 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.

jiangyj545 avatar May 31 '26 10:05 jiangyj545

hi! @jiangyj545 this PR is broken. thanks

ImprovedTube2 avatar May 31 '26 10:05 ImprovedTube2