ClaudeMod
ModsWhile You WaitNetwork

Youtube Mod

Plays a Youtube video while Claude is working

Install· Claude Code 2.1.284+
$git clone https://github.com/mdelapenya/claude-plugin-youtube.git
$claude --plugin-dir ./claude-plugin-youtube
Run claude plugin validate to auditGuide →
Access & PermissionsNetwork

Makes outbound network requests, calls MCP servers, or requests auth handles.

Draws UIRuns shell commandsNetwork access

Statically scanned from hooks & source. Learn how to audit

Manuel de la PeñaAdded 1 months ago

YouTube for Claude Code

Watch a YouTube video or playlist inside Claude Code's terminal pane while Claude works. Paste a link into the pane, or use /youtube <link>.

This is an experimental terminal-graphics player. It uses Claude's early-access function hooks and Image/ui.blit API, yt-dlp for YouTube URLs, and FFmpeg for video frames. It does not open a browser.

YouTube playlist playing in Claude Code's terminal pane, with playback controls and diagnostics

Requirements

  • macOS or Linux, with Kitty or Ghostty (Kitty graphics protocol support).
  • Claude Code with function hooks and the image API, tested on 2.1.284 and 2.1.296. These early-access APIs can change.
  • Node.js 22.13+, a recent yt-dlp with Node JavaScript-runtime support, and FFmpeg 8+. ffplay, normally included with FFmpeg, is optional for audio.
  • Network access to YouTube and its media hosts from the machine running Claude.

The Claude Desktop and VS Code surfaces do not expose the terminal Image element. An unsupported terminal shows the image's fallback text. Terminal multiplexers may also prevent graphics from reaching the terminal.

Run it

For Docker Sandboxes, use the included v3 video-processing kit. It installs the tools inside the sandbox and declares the YouTube/media network access. Run these commands on your Mac host, from this repository in Kitty or Ghostty:

sbx create --name claude-youtube-v3 \
  --kit ./kits/video-processing \
  -e CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1 \
  -e CLAUDE_CODE_NO_FLICKER=1 \
  docker.io/docker/sbx-kit-claude:2.1.296 "$PWD"
sbx exec -w "$PWD" claude-youtube-v3 node src/bridge.js doctor
sbx run --name claude-youtube-v3 -- --plugin-dir "$PWD"

V3 requires a v3 workload reference; the built-in claude/codex shortcuts currently select v2. Create this new sandbox with its kit at creation time.

For running Claude directly on macOS, install the media tools with Homebrew:

brew install ffmpeg yt-dlp

On Linux, install current versions of FFmpeg and yt-dlp using your package manager or their official installers. Older distribution packages may lack required features. Keep yt-dlp updated as YouTube changes.

From this repository, check the tools and start Claude with the plugin:

npm run doctor
CLAUDE_CODE_NO_FLICKER=1 CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1 claude --plugin-dir "$PWD"

No npm runtime dependencies or build step are needed. In Claude, enter:

/youtube

CLAUDE_CODE_NO_FLICKER=1 explicitly enables the fullscreen layout used by the DOOM demo, including on older Claude versions where it is not the default.

Paste a video or playlist URL into YouTube link, then submit Load. You can also pass the URL directly to /youtube. youtube.com/watch, youtu.be, shorts, live, embed, and playlist links are accepted. Links containing list= load the playlist, starting at the linked video when it is among the first 100 entries. Other query parameters, including timestamps, are discarded. Bare 11-character IDs are treated as videos; other valid IDs as playlists.

Claude places the pane beside the transcript in its fullscreen layout when the terminal is wide enough; otherwise it may appear above the prompt. Use the mouse or ctrl+x tab, then Tab and Enter, to operate the pane controls.

For an initial source on every session, set YouTube video or playlist under the plugin's /config options and restart. Links entered into the pane otherwise last for the current session. Start muted defaults to on.

Playback

ControlBehavior
Auto (default)Plays during the main agent's turn; pauses on completion, interruption, refusal, or error. Includes tool calls, not just model reasoning.
PlayPlays even when Claude is idle. Overrides Auto until you choose Auto again. Restarts a finished video/playlist.
PauseStays paused across subsequent turns until Play or Auto is selected.
Previous / NextChanges the video within the loaded playlist.
Video selectorJumps to a playlist entry.
Mute / UnmuteEnables optional audio on the machine running Claude.
ReloadResolves the current input again after a network or playback error.
HideCloses the pane and pauses both video and audio. /youtube open brings it back.

The same actions are available as /youtube play, pause, auto, next, previous, mute, unmute, open, and close, including during a running turn. Loading a source while Claude is idle cues its first frame; choose Play to preview it immediately. Subagent completions do not pause the main turn's video.

For the guitar-course example, enter:

/youtube https://www.youtube.com/watch?v=vnBd5kL7ynE&list=PL-RYb_OMw7Geie3oIeLVBUtJlep5Ir7UZ

If playback is slow, select Play and run /youtube stats. It samples five seconds while playback continues, then reports decoding fps, frames received by the hook, accepted paints per second, the active transport, and the longest waits. file-png is the fast local macOS path; inline-png sends the image bytes through the hook. Accepted paints are Claude acknowledgments, not measured screen refreshes. The report also includes the last paint refusal, so a file access problem can be distinguished from a slow decoder or renderer.

Experimental limits

  • Video is letterboxed to 320 × 180 at 24 fps, then scaled to the pane. On local macOS, the terminal reads the current PNG directly, keeping pixel data out of Claude's hook messages. Sandbox, SSH, and Linux sessions use compressed inline PNGs. File access is probed asynchronously: pending probes are retried, including the first paused frame. Ten consecutive non-probe refusals fall back to inline PNGs; a successful paint resets the count.
  • Only the latest frame is retained, so slow drawing skips frames instead of queuing old ones. Local playback atomically replaces one private temporary PNG; helper shutdown removes it. Media is streamed, not saved to video files. Fetching continues while a paint is pending. A tiny Client redraw during playback keeps Claude's idle paint clock moving, using the technique described in the Reporails DOOM demo.
  • HLS streams are preferred because some YouTube media servers reject open-ended byte-range requests for progressive/DASH streams.
  • Audio uses a separate ffplay process and is only approximately synchronized. Separate YouTube video and audio streams are supported without merging files. It plays on the machine running Claude, not a remote SSH client. Audio errors leave muted video usable; headphones/audio routing are the host's own.
  • Public, accessible videos are the target. The plugin does not import cookies, read your yt-dlp configuration, or implement sign-in. Private, restricted, region-blocked, unavailable, or unsupported-format videos report an error; select Next or another link. YouTube may require a newer yt-dlp/EJS install or refuse automated access. Live streams may not resume cleanly after a long pause.
  • Playlists are limited to their first 100 entries and do not loop automatically.
  • The helper has a private Unix socket, with no listening TCP port. Session end and terminal hangup stop it and its media processes. It also checks every 250 ms whether the owning Claude process has exited. A 30-second heartbeat timeout handles a plugin that stops polling while Claude remains alive. Closing the pane keeps the paused helper available until the session ends.

Development and checks

npm ci
npm run lint               # JavaScript/TypeScript rules and installer shell syntax
npm test                    # parsing, playback state, framing, socket protocol
npm run test:coverage       # unit-test coverage of src/; no FFmpeg or YouTube needed
npm run types:fetch         # pinned public Claude API declarations; no login needed
npm run check:hooks         # typecheck hooks and native hook tests
npm run test:integration    # real FFmpeg/ffplay, synthetic local media; no YouTube
claude plugin validate .
npm run test:hooks          # Claude's own test harness; no model/API calls

npm run lint:fix applies ESLint's automatic fixes. Hooks are linted without Node globals, matching Claude's sandbox. The TypeScript compiler is pinned to a version supported by the TypeScript ESLint parser.

npm run types:fetch downloads the public declarations from the immutable commit behind Claude Code's v2.1.296 tag. To check your own installed API instead, run /plugin-types with the plugin loaded, then npm run check:hooks. Generated engine types are ignored by Git. Claude's harness validates the pane's element tree and input/control callbacks, but does not verify physical terminal paint.

GitHub Actions runs on pushes to main and all pull requests. It checks lint, types and unit coverage on Node 22 and 24; validates and tests the hooks on Claude Code 2.1.284 and 2.1.296; and runs real media tests with Ubuntu 26.04's FFmpeg/ffplay. Tests need no YouTube access or API credentials.

Implementation: hooks/register.js owns the pane and turn lifecycle; src/bridge.js starts the session helper; src/player.js resolves and decodes media. Pure parsers and playback-state logic are shared with the tests.

The implementation checks passed with synthetic HTTP media and a real HTTPS proxy rejection. The guitar-course URL above also loaded its 11-entry playlist, decoded real frames, and passed pause/resume and process-cleanup checks after the host approved the media domains. The user confirmed working local playback on macOS with Ghostty 1.2.2 and Claude Code 2.1.284 after the file-probe fix and fullscreen restart. See verification.

See API research for the upstream sources and API limits.

Details

Sub-category
While You Wait
Added
1 months ago
Last synced
today

Weekly Mods Digest

Top new Claude Code mods and install commands, once a week. No fluff, unsubscribe anytime.

More Mods

Claude Flightdeck
ModsSecurity

Claude Flightdeck

Live agent dashboard pane with context consumption, advisor timeline, permission verdicts, and subagent swimlanes.

Reads Files
by Sam Casella
GitHub
ModsInterface

Terminal Browser

Browse documentation, GitHub pull requests, and web pages in a split terminal pane directly beside your Claude Code conversation.

Network
by Zenbu Labs
GitHub
Agent Flow
ModsAutomation

Agent Flow

Interactive visual tree of the active session's subagents, background tasks, and teammates beside the transcript via /flow.

UI Only
by Charlie
GitHub

Command Palette

Search for a command to run...