Skip to main content
Glama

yt

Agenten-orientiertes YouTube-CLI — Suche, Transkripte, Metadaten und ein lokaler FTS5-Cache für den KI-Kontextabruf. Umhüllt yt-dlp mit JSON-Envelopes, NDJSON-Streaming und einem MCP-Co-Binary.

Kein YouTube Data API-Schlüssel. Keine Kontingente. Keine Ratenbegrenzung auf dem Standardpfad.

██╗   ██╗████████╗
╚██╗ ██╔╝╚══██╔══╝
 ╚████╔╝    ██║
  ╚██╔╝     ██║
   ██║      ██║
   ╚═╝      ╚═╝

Warum

Bestehende YouTube-Tools sind entweder:

  • Für Menschen gebaut (interaktive TUIs wie ytfzf),

  • Für Content-Ersteller gebaut (Nischenanalyse, Wettbewerber-Audits),

  • Oder in MCP-only-Servern eingeschlossen.

yt ist für Agenten gebaut — Claude Code, Cursor, Codex, Gemini CLI und Ihre Bash-Skripte. Ein Aufruf (yt context <url>) liefert einem LLM alles, was es benötigt, um über ein Video zu schlussfolgern.

Installation

# Requires yt-dlp on PATH
brew install yt-dlp

# From source
git clone https://github.com/progrmoiz/yt-cli
cd yt-cli
npm install && npm run build && npm link

Sanity-Check:

yt doctor

Schnellstart

# Search
yt search "rust async" --limit 5

# Grok a single video (the 80% agent use case)
yt context https://www.youtube.com/watch?v=dQw4w9WgXcQ

# Fetch transcript
yt transcript https://www.youtube.com/watch?v=dQw4w9WgXcQ --text

# Query everything you've cached
yt find "borrow checker"

# List a channel's recent videos
yt channel @ThePrimeTimeagen --limit 20

Das Pipelining schaltet die Ausgabe automatisch auf JSON um (redis-cli-Muster):

yt search "typescript" | jq '.data[0].url'
yt context <url> | jq '.data.transcript.full_text'

Befehle

Befehl

Beschreibung

yt search <query>

YouTube-Suche, kein API-Schlüssel. --limit, --since 7d.

yt transcript <url>

Zeitgestempeltes Transkript-JSON. Zwischengespeichert. --lang en, --text.

yt info <url>

Metadaten: Titel, Kanal, Kapitel, Dauer. Zwischengespeichert.

yt context <url>

Headline. One-Shot-Info + Transkript + Kapitel für Agenten.

yt find <query>

FTS5-Suche über zwischengespeicherte Transkripte. Zeilenbasierte Treffer mit Zeitstempeln.

yt channel <handle|id|url>

Aktuelle Videos eines Kanals.

yt doctor [--deep]

Diagnose: yt-dlp, Cache, Agenten-Erkennung.

yt self-test

Regression-Suite — erkennt YouTube-Endpunkt-Änderungen.

yt schema <cmd>

JSON-Schema für die Ausgabe dieses Befehls.

yt mcp serve

Stdio MCP-Server. Co-Binary.

Agenten-Integration

Claude Code / Cursor / etc — MCP

// .mcp.json
{
  "mcpServers": {
    "yt": { "command": "yt", "args": ["mcp", "serve"] }
  }
}

Tools, die 1:1 mit CLI-Befehlen exponiert werden: search, info, transcript, context, find, channel, whoami.

Skripte / Shell

# Ingest the top 10 search hits into the local cache
yt search "machine learning ops" --limit 10 --json \
  | jq -r '.data[].url' \
  | xargs -I{} yt transcript {} --json >/dev/null

# Then query across all of them
yt find "feature store" --limit 5

Cache

SQLite-Datenbank unter ~/.cache/yt/yt.db. Inhalte:

  • videos — eine Zeile pro Video (Metadaten).

  • transcripts — eine Zeile pro (Video, Sprache)-Paar.

  • transcript_segments_fts — FTS5-virtuelle Tabelle über jedes Transkriptsegment.

Überschreiben mit YT_CACHE_DIR=/pfad/zum/verzeichnis.

Jeder transcript / info / context-Aufruf prüft zuerst den Cache. Verwenden Sie --refresh, um einen neuen Abruf zu erzwingen.

Ausgabeformat

Standard-Envelope (v2):

{
  "version": "2",
  "status": "success",
  "command": "context",
  "cli": { "name": "yt", "version": "0.1.0" },
  "data": { /* command payload */ },
  "metadata": {
    "elapsed_ms": 1200,
    "cached": true,
    "has_transcript": true,
    "agent": "CLAUDECODE"
  }
}

Verwenden Sie --raw für Rohdaten. Vollständiges JSON-Schema via yt schema <command>.

Exit-Codes

0 ok · 1 generisch · 2 Verwendung · 3 Validierung · 4 Authentifizierung · 5 Ratenbegrenzung · 6 Netzwerk · 7 nicht gefunden · 75 temporärer Fehler

Umgebung

Var

Zweck

YT_CACHE_DIR

Cache-Verzeichnis (Standard: ~/.cache/yt)

YT_DLP_BIN

Pfad zum yt-dlp-Binary überschreiben

YT_NO_RETRY

Auf 1 setzen, um den automatischen Einzel-Wiederholungsversuch bei RATE_LIMIT/NETWORK/TIMEOUT zu deaktivieren

YT_JSON=1

JSON-Ausgabe erzwingen

YT_API_KEY

Reserviert für zukünftige Data API-Extras

NO_COLOR

ANSI deaktivieren

CI

Nicht-interaktiven Modus erzwingen

Lizenz

MIT.

Related MCP Connectors

  • YouTube transcripts, search, channel browsing, and playlists for AI agents via MCP.

  • An MCP server that gives any LLM or agent clean YouTube transcripts on demand: a single video, a whole channel, or a playlist, plus AI cleanup of auto-generated captions. API-key auth, credit-based, same backend as the public v1 API. Get a free API key with 25 free credits at youtubetranscriptdownload.com/account.

  • YouTube transcripts, search, channel/playlist listings and upload tracking for AI agents.

  • Your agent needs to find video — which channels own a topic, which videos rank for a phrase, what exists in a given country and language. **What you can ask for** • "Which videos rank for 'rag pipeline tutorial' in the US this month?" • "Find channels publishing about MCP, sorted by relevance." • "What playlists cover this subject in Japanese?" • "Search videos uploaded this week only." **How to use it** Point any MCP client at https://mcp.aisa.one/youtube-search/mcp and sign in with OAuth — there is no key to create or paste. One search tool covering videos, channels and playlists, narrowed by country, language, upload date, duration and sort order. **It is also a door to the rest** The same login reaches 26 sources and 580+ operations. Find the video here, then ask the same agent what the channel's site traffic is or what the same phrase does in Google — without adding a second server. **What it costs** Finding and inspecting an operation is free. Running one is billed per call at API prices, with no seat and no monthly minimum, and every call takes max_price_usd so an agent cannot overspend by accident. **Where else it reaches** https://mcp.aisa.one/social/mcp for X plus Instagram, Reddit, Pinterest and YouTube; https://mcp.aisa.one/gtm/mcp for those plus Similarweb and Apollo.