Terminal-first YouTube search, download, catalog, and clip tooling built on yt-dlp.
Project description
yt-agent
An Agent friendly YouTube skill. Point Anthropic's Claude Code, OpenAI's Codex, Google's Gemini, and more, at this repo and then have your preferred AI search, download, and process YouTube vids from terminal.
Terminal-first YouTube download, catalog, and clip workflows for humans and coding agents.
yt-agent is built on yt-dlp, local sidecar files, SQLite FTS, and a small Textual catalog browser. It works well for direct human use and for coding agents that need structured, scriptable output.
Quickstart
Install yt-dlp first. That is the only required runtime for basic search and download. Add ffmpeg for clip extraction and fzf for multi-select convenience when you need them.
# macOS
brew install yt-dlp
uv tool install git+https://github.com/jvogan/yt-agent
yt-agent doctor
# Linux
python3 -m pip install -U yt-dlp
uv tool install git+https://github.com/jvogan/yt-agent
yt-agent doctor
If you prefer pipx, use pipx install git+https://github.com/jvogan/yt-agent instead.
Optional follow-on tools:
# macOS
brew install ffmpeg fzf
# Linux
sudo apt-get install -y ffmpeg fzf
60-second success path:
yt-agent download "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
If you want a starter config, the tool can write one:
yt-agent config init
yt-agent config path
More install detail lives in docs/getting-started.md. Shell-specific completion notes live in docs/shell-completion.md.
Docker
The repo ships with a multi-stage Dockerfile that builds a wheel with uv build and installs it into a python:3.12-slim runtime image with both yt-dlp and ffmpeg preinstalled.
docker build -t yt-agent .
docker run --rm -it yt-agent doctor
To use your local config or media directories, mount them into the container as needed:
docker run --rm -it \
-v "$HOME/.config/yt-agent:/root/.config/yt-agent" \
-v "$HOME/Media/YouTube:/root/Media/YouTube" \
yt-agent download "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
Choose Your Path
- I already have a YouTube URL
- I want to search or curate a playlist
- I want to index a library and cut clips
- I want to drive this from Codex, Claude Code, Gemini CLI, opencode, or antigraviti
Core Workflows
Full recipe guide: docs/recipes.md
Direct download
If you already know the URL or video ID, download is the fastest path:
yt-agent download "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
Preview the exact target first without writing anything:
yt-agent download "https://www.youtube.com/watch?v=dQw4w9WgXcQ" --dry-run
Search and curate
grab searches, shows results, prompts you to pick, and downloads:
yt-agent grab "lofi hip hop"
# shows numbered results, you type 1,3 to pick, downloads start
If you want to browse results first without downloading anything:
yt-agent search "lofi hip hop" --limit 5
# note the video ID from the results table, then:
yt-agent download abc123def45
For audio only (music, podcasts), add --audio:
yt-agent grab "podcast interview" --audio
Curate a playlist
See what's in a YouTube playlist, then pick which entries to download:
yt-agent download "https://www.youtube.com/playlist?list=PL123" --select-playlist
# shows all entries, you pick interactively, only selected items download
Or preview the playlist first without downloading:
yt-agent info "https://www.youtube.com/playlist?list=PL123" --entries
Find and extract clips
After downloading videos, index them into the local catalog so you can search transcripts and chapters. Then find specific moments and cut clips:
yt-agent index refresh --fetch-subs # add --fetch-subs when transcript coverage matters
yt-agent clips search "chorus drop"
# shows matches with result IDs like transcript:12, chapter:3
yt-agent clips show transcript:12
# inspect the match in context before extracting
yt-agent clips grab transcript:12 --padding-before 2 --padding-after 2
index refresh is local-first by default. It replays the manifest and uses any sidecars already on disk. Add --fetch-subs when you want transcript coverage from the network. You can also fetch subtitles during download:
yt-agent download abc123def45 --fetch-subs
Curate your library
yt-agent library stats
yt-agent library channels
yt-agent library playlists
yt-agent library list
yt-agent library search "ambient mix"
yt-agent library show abc123def45
yt-agent tui
Screens
yt-agent doctor shows what tools are installed and where data lives:
yt-agent history shows recent downloads with channel and timestamp:
yt-agent library channels lists all channels in your local catalog:
yt-agent export --format json streams the full catalog as structured JSON:
yt-agent cleanup --dry-run previews what would be removed without touching files:
yt-agent --verbose surfaces debug-level SQL and lifecycle events:
yt-agent search prints normalized results in a clean table:
Playlist selection lets you pick specific entries before downloading:
yt-agent clips search finds moments across transcripts and chapters:
The TUI is a read-mostly catalog browser for exploring your indexed library:
Commands
The compact command reference lives in docs/command-reference.md.
Most read commands accept --output table|json|plain. Mutating commands also support --output json, --dry-run, and --quiet. Selection commands accept --select 1,3 to skip interactive prompts.
Agent-Friendly Surface
yt-agent is designed to work cleanly with coding agents and shell-driven automation:
--output jsonon read and mutation commands for structured output- JSON failures on
stderrwithschema_version,status,exit_code,error_type,message, and optionalstderr --select 1,3to bypass interactive prompts--dry-runto preview mutations before approval--quietto reduce chatter after approvalyt-agent doctor --output jsonto diagnose missing tools (includes install hints per tool)- Stable exit codes: 0 = ok, 3 = missing dependency, 4 = bad input, 5 = bad config, 6 = external failure, 7 = busy mutation lock, 8 = storage error, 130 = interrupted
Agent recipes, troubleshooting, and copy-paste prompts live in docs/agent-workflows.md.
Two strong starting points:
- Approval-safe operator flow: examples/agents/approval-safe-download.md
- Library curator flow: examples/agents/library-curator.md
What Gets Stored Locally
| Path | Purpose |
|---|---|
~/.config/yt-agent/config.toml |
Configuration |
~/.local/share/yt-agent/archive.txt |
Duplicate-prevention archive |
~/.local/share/yt-agent/downloads.jsonl |
Append-only download manifest |
~/.local/share/yt-agent/catalog.sqlite |
Searchable catalog (FTS) |
~/Media/YouTube/ |
Downloaded media |
~/Media/YouTube/_clips/ |
Extracted clips |
Downloads are organized as <channel>/<upload_date> - <title> [<video_id>].<ext>.
More detail in docs/concepts.md.
Support Matrix
| Status | |
|---|---|
| macOS | First-class |
| Linux | First-class |
| Windows | Experimental |
yt-dlp |
Required |
ffmpeg |
Required for local clip extraction |
fzf |
Optional, for terminal multi-select |
mpv |
Optional, reserved for future preview |
Full matrix: docs/support-matrix.md
Who This Is For
- People who already live in the terminal and want a reliable YouTube workflow
- Codex, Claude Code, Gemini CLI, opencode, antigraviti, and similar agents that need structured output and approval-safe mutations
- Users who want a local searchable catalog and transcript or chapter clip workflows
Not For
- People who want a one-click desktop media manager with subscriptions, queues, and previews already built
- Generic arbitrary-site downloading;
yt-agentis intentionally scoped to YouTube targets - A zero-terminal consumer product
Recipes and Examples
- Workflow guide: docs/workflow.md
- Recipes overview: docs/recipes.md
- Troubleshooting: docs/troubleshooting.md
- Command reference: docs/command-reference.md
- Batch download script: examples/scripts/batch-download-from-file.sh
- Playlist preview script: examples/scripts/playlist-curation-preview.sh
- Remote index + clip script: examples/scripts/remote-index-and-clip.sh
- Library cleanup preview script: examples/scripts/library-cleanup-preview.sh
- Approval-safe download: examples/agents/approval-safe-download.md
- Playlist curator: examples/agents/playlist-curator.md
- Clip hunter: examples/agents/clip-hunter.md
- Library curator: examples/agents/library-curator.md
- Codex prompt starter: examples/agents/codex.md
- Claude Code prompt starter: examples/agents/claude-code.md
- Gemini CLI prompt starter: examples/agents/gemini-cli.md
- opencode prompt starter: examples/agents/opencode.md
- antigraviti prompt starter: examples/agents/antigraviti.md
- Skill pack: skills/yt-agent/SKILL.md
Responsible Use
yt-agent is not affiliated with YouTube or Google. It accepts YouTube URLs and YouTube video IDs, not arbitrary web URLs. You are responsible for complying with platform terms, copyright, licenses, permissions, and local law when you search, download, index, or clip media. Do not commit cookies, exported browser sessions, downloaded media, or private caches to this repo.
Docs
- Getting Started
- Shell Completion
- Concepts
- Agent Workflows
- FAQ
- Recipes
- Support Matrix
- Troubleshooting
- Command Reference
- Architecture
- Workflow
- Roadmap
- Release Checklist
Development
uv sync --dev
uv run ruff check .
uv run pytest
uv build
See CONTRIBUTING.md for contribution expectations and THIRD_PARTY.md for upstream acknowledgements.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file yt_agent-0.3.0.tar.gz.
File metadata
- Download URL: yt_agent-0.3.0.tar.gz
- Upload date:
- Size: 4.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ae864a8b3b16a5b2ec233ce385f9e5593dcbdb365d5a490568a939c101449f3
|
|
| MD5 |
e81a4f73f53afe9d9b8c6e10d9568f24
|
|
| BLAKE2b-256 |
0af8ebb6a4f28fd8d375953a58a2bb43b5a19922aa6e57325d351132ff20343f
|
Provenance
The following attestation bundles were made for yt_agent-0.3.0.tar.gz:
Publisher:
release.yml on jvogan/yt-agent
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
yt_agent-0.3.0.tar.gz -
Subject digest:
1ae864a8b3b16a5b2ec233ce385f9e5593dcbdb365d5a490568a939c101449f3 - Sigstore transparency entry: 1107660280
- Sigstore integration time:
-
Permalink:
jvogan/yt-agent@cc8cbb5f0222b281a204ba822de8c7593261e257 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/jvogan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@cc8cbb5f0222b281a204ba822de8c7593261e257 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file yt_agent-0.3.0-py3-none-any.whl.
File metadata
- Download URL: yt_agent-0.3.0-py3-none-any.whl
- Upload date:
- Size: 65.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c9c0451924ddfe5d7b494b4e942e65ab0e3e2e18ae67bddb3c48f626d562d399
|
|
| MD5 |
a49fa6d2072ea9f8389a1ba090ca0449
|
|
| BLAKE2b-256 |
8e533f91f4098d2c923491e72e17a69dd67e4c3323f4aed6918d85eea8cf25d3
|
Provenance
The following attestation bundles were made for yt_agent-0.3.0-py3-none-any.whl:
Publisher:
release.yml on jvogan/yt-agent
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
yt_agent-0.3.0-py3-none-any.whl -
Subject digest:
c9c0451924ddfe5d7b494b4e942e65ab0e3e2e18ae67bddb3c48f626d562d399 - Sigstore transparency entry: 1107660292
- Sigstore integration time:
-
Permalink:
jvogan/yt-agent@cc8cbb5f0222b281a204ba822de8c7593261e257 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/jvogan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@cc8cbb5f0222b281a204ba822de8c7593261e257 -
Trigger Event:
workflow_dispatch
-
Statement type: