Skip to main content
Glama

yt

エージェントファーストなYouTube CLI — 検索、文字起こし、メタデータ、そしてAIコンテキスト取得のためのローカルFTS5キャッシュ。yt-dlpをJSONエンベロープ、NDJSONストリーミング、およびMCPコバイナリでラップします。

YouTube Data APIキーは不要。クォータも不要。デフォルトのパスではレート制限の上限もありません。

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

なぜこれが必要か

既存のYouTubeツールは以下のいずれかです:

  • 人間向け(ytfzfのようなインタラクティブなTUI)

  • コンテンツクリエイター向け(ニッチな分析、競合監査)

  • またはMCP専用サーバー内に閉じ込められている

ytはエージェント(Claude Code、Cursor、Codex、Gemini CLI、およびあなたのbashスクリプト)のために構築されています。1回の呼び出し(yt context <url>)で、LLMが動画について推論するために必要なすべてを提供します。

インストール

# 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

健全性チェック:

yt doctor

クイックスタート

# 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

パイプ処理を行うと、出力が自動的にJSONに切り替わります(redis-cliパターン):

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

コマンド

コマンド

説明

yt search <query>

YouTube検索(APIキー不要)。--limit、--since 7dが使用可能。

yt transcript <url>

タイムスタンプ付き文字起こしJSON。キャッシュされます。--lang en、--textが使用可能。

yt info <url>

メタデータ:タイトル、チャンネル、チャプター、再生時間。キャッシュされます。

yt context <url>

重要。 エージェント向けに情報、文字起こし、チャプターを一度に取得します。

yt find <query>

キャッシュされた文字起こしに対するFTS5検索。タイムスタンプ付きの行レベルのヒットを表示。

yt channel <handle|id|url>

チャンネルの最近の動画。

yt doctor [--deep]

診断:yt-dlp、キャッシュ、エージェント検出。

yt self-test

回帰テストスイート — YouTubeエンドポイントの変更を検知。

yt schema <cmd>

そのコマンドの出力に対するJSONスキーマ。

yt mcp serve

Stdio MCPサーバー。コバイナリ。

エージェント統合

Claude Code / Cursor / その他 — MCP

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

ツールはCLIコマンドと1:1で公開されています:search、info、transcript、context、find、channel、whoami。

スクリプト / シェル

# 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/yt/yt.db にSQLiteデータベースが作成されます。内容は以下の通りです:

  • videos — 動画1件につき1行(メタデータ)。

  • transcripts — (動画, 言語) のペアにつき1行。

  • transcript_segments_fts — すべての文字起こしセグメントに対するFTS5仮想テーブル。

YT_CACHE_DIR=/path/to/dir で上書き可能です。

すべての transcript / info / context 呼び出しは、最初にキャッシュを確認します。強制的に再取得するには --refresh を渡してください。

出力形式

デフォルトのエンベロープ (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"
  }
}

生のデータが必要な場合は --raw を使用してください。完全なJSONスキーマは yt schema <command> で確認できます。

終了コード

0 正常 · 1 一般エラー · 2 使用法エラー · 3 検証エラー · 4 認証エラー · 5 レート制限 · 6 ネットワークエラー · 7 見つかりません · 75 一時的な失敗

環境変数

変数

用途

YT_CACHE_DIR

キャッシュディレクトリ(デフォルト: ~/.cache/yt)

YT_DLP_BIN

yt-dlp バイナリへのパスを上書き

YT_NO_RETRY

1 に設定すると、RATE_LIMIT/NETWORK/TIMEOUT 時の自動再試行を無効化

YT_JSON=1

JSON出力を強制

YT_API_KEY

将来のData API拡張用に予約

NO_COLOR

ANSIカラーを無効化

CI

非インタラクティブモードを強制

ライセンス

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.