Skip to main content

Terminal-first YouTube search, download, catalog, and clip tooling built on yt-dlp.

Project description

yt-agent

yt-agent hero

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

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:

Doctor screenshot

yt-agent history shows recent downloads with channel and timestamp:

History screenshot

yt-agent library channels lists all channels in your local catalog:

Library channels screenshot

yt-agent export --format json streams the full catalog as structured JSON:

Export JSON screenshot

yt-agent cleanup --dry-run previews what would be removed without touching files:

Cleanup dry-run screenshot

yt-agent --verbose surfaces debug-level SQL and lifecycle events:

Verbose output screenshot

yt-agent search prints normalized results in a clean table:

Search screenshot

Playlist selection lets you pick specific entries before downloading:

Playlist selection screenshot

yt-agent clips search finds moments across transcripts and chapters:

Clip search screenshot

The TUI is a read-mostly catalog browser for exploring your indexed library:

TUI screenshot

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 json on read and mutation commands for structured output
  • JSON failures on stderr with schema_version, status, exit_code, error_type, message, and optional stderr
  • --select 1,3 to bypass interactive prompts
  • --dry-run to preview mutations before approval
  • --quiet to reduce chatter after approval
  • yt-agent doctor --output json to 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:

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-agent is intentionally scoped to YouTube targets
  • A zero-terminal consumer product

Recipes and Examples

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

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yt_agent-0.3.0.tar.gz (4.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yt_agent-0.3.0-py3-none-any.whl (65.0 kB view details)

Uploaded Python 3

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

Hashes for yt_agent-0.3.0.tar.gz
Algorithm Hash digest
SHA256 1ae864a8b3b16a5b2ec233ce385f9e5593dcbdb365d5a490568a939c101449f3
MD5 e81a4f73f53afe9d9b8c6e10d9568f24
BLAKE2b-256 0af8ebb6a4f28fd8d375953a58a2bb43b5a19922aa6e57325d351132ff20343f

See more details on using hashes here.

Provenance

The following attestation bundles were made for yt_agent-0.3.0.tar.gz:

Publisher: release.yml on jvogan/yt-agent

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for yt_agent-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c9c0451924ddfe5d7b494b4e942e65ab0e3e2e18ae67bddb3c48f626d562d399
MD5 a49fa6d2072ea9f8389a1ba090ca0449
BLAKE2b-256 8e533f91f4098d2c923491e72e17a69dd67e4c3323f4aed6918d85eea8cf25d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for yt_agent-0.3.0-py3-none-any.whl:

Publisher: release.yml on jvogan/yt-agent

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page