Skip to main content
Glama

yt

CLI de YouTube orientada a agentes: búsqueda, transcripciones, metadatos y una caché FTS5 local para la recuperación de contexto de IA. Envuelve yt-dlp con sobres JSON, streaming NDJSON y un co-binario MCP.

Sin clave de API de datos de YouTube. Sin cuotas. Sin límite de tasa en la ruta predeterminada.

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

Por qué

Las herramientas de YouTube existentes son:

  • Creadas para humanos (TUI interactivas como ytfzf),

  • Creadas para creadores de contenido (análisis de nicho, auditorías de la competencia),

  • O bloqueadas dentro de servidores solo para MCP.

yt está creado para agentes: Claude Code, Cursor, Codex, Gemini CLI y tus scripts de bash. Una llamada (yt context <url>) entrega a un LLM todo lo que necesita para razonar sobre un vídeo.

Instalación

# 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

Verificación de integridad:

yt doctor

Inicio rápido

# 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

El uso de tuberías (pipes) cambia la salida a JSON automáticamente (patrón redis-cli):

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

Comandos

Comando

Descripción

yt search <query>

Búsqueda en YouTube, sin clave de API. --limit, --since 7d.

yt transcript <url>

JSON de transcripción con marca de tiempo. En caché. --lang en, --text.

yt info <url>

Metadatos: título, canal, capítulos, duración. En caché.

yt context <url>

Titular. Información de un solo paso + transcripción + capítulos para agentes.

yt find <query>

Búsqueda FTS5 sobre transcripciones en caché. Resultados a nivel de línea con marcas de tiempo.

yt channel <handle|id|url>

Vídeos recientes de un canal.

yt doctor [--deep]

Diagnóstico: yt-dlp, caché, detección de agentes.

yt self-test

Suite de regresión: detecta la degradación de los endpoints de YouTube.

yt schema <cmd>

Esquema JSON para la salida de ese comando.

yt mcp serve

Servidor MCP Stdio. Co-binario.

Integración de agentes

Claude Code / Cursor / etc — MCP

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

Herramientas expuestas 1:1 con comandos CLI: search, info, transcript, context, find, channel, whoami.

Scripts / 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

Caché

Base de datos SQLite en ~/.cache/yt/yt.db. Contenido:

  • videos: una fila por vídeo (metadatos).

  • transcripts: una fila por par (vídeo, idioma).

  • transcript_segments_fts: tabla virtual FTS5 sobre cada segmento de transcripción.

Se puede sobrescribir con YT_CACHE_DIR=/path/to/dir.

Cada llamada a transcript / info / context comprueba primero la caché. Usa --refresh para forzar una nueva obtención.

Formato de salida

Sobre predeterminado (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"
  }
}

Usa --raw para datos sin procesar. Esquema JSON completo mediante yt schema <command>.

Códigos de salida

0 ok · 1 genérico · 2 uso · 3 validación · 4 autenticación · 5 límite de tasa · 6 red · 7 no encontrado · 75 fallo temporal

Entorno

Var

Propósito

YT_CACHE_DIR

Directorio de caché (predeterminado: ~/.cache/yt)

YT_DLP_BIN

Sobrescribir la ruta al binario yt-dlp

YT_NO_RETRY

Establecer en 1 para deshabilitar el reintento automático único en RATE_LIMIT/NETWORK/TIMEOUT

YT_JSON=1

Forzar salida JSON

YT_API_KEY

Reservado para futuros extras de la API de datos

NO_COLOR

Deshabilitar ANSI

CI

Forzar modo no interactivo

Licencia

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.