YouTube Transcript (Apify)

為 AI 代理提供任何 YouTube 影片、播放清單或頻道的逐字稿:文字、時間戳記、SRT/VTT、標題和頻道。沒有字幕的影片會從音訊轉錄(Whisper);語言不符的字幕會由 AI 翻譯,並保留時間戳記。每項結果都會說明其產生方式,處理失敗的影片則會回傳錯誤代碼。遠端:https://mcp.apify.com?tools=luisbendeckdev/youtube-transcript-scraper(需要 Apify 帳戶)。推出期間免費;您只需支付 Apify 平台使用費。這是我打造的。

託管 MCP 伺服器

npx add-mcp 'https://mcp.apify.com?tools=luisbendeckdev/youtube-transcript-scraper'

可安裝到 Claude Code、Codex、Cursor 等客戶端

文件

YouTube transcripts for scripts, RAG pipelines and LLM prompts: examples

Small, copy-paste examples that get YouTube transcripts (plain text, timestamped segments, SRT) into your code, using a free Apify Actor I built: YouTube Transcript API.

ExampleWhat it does
python/get_transcript.pyOne video → plain text, optionally in another language
node/videos_to_srt.mjsVideos, a playlist or a channel → one .srt file per video (no dependencies)
curl/run.shThe raw API call, JSON out

You need an Apify account (the free plan works) and its API token in APIFY_TOKEN (Console → Settings → API & Integrations).

pip install apify-client
python python/get_transcript.py https://www.youtube.com/watch?v=jNQXAC9IVRw
# # Me at the zoo [en, from captions]
# All right, so here we are, in front of the elephants ...

node node/videos_to_srt.mjs https://www.youtube.com/watch?v=jNQXAC9IVRw
# jNQXAC9IVRw.en.srt  Me at the zoo  (captions, 39 words)

What the Actor does when YouTube says no

  • No captions at all: it transcribes the audio (Whisper large-v3-turbo), with timestamps.
  • No captions in your language: it uses YouTube's translation, and when YouTube refuses, translates with AI line by line so every timestamp is kept.
  • Every result says how it was made (transcriptSource: captions or audio; translationStatus), and a failed video comes back with an errorCode instead of a silent wrong answer.

Audio transcription and AI translation need a paid Apify plan; captions and YouTube's own translations work on the free plan.

Cost

The Actor is free during launch: you only pay Apify's platform usage, about $0.0002–0.0014 per captioned video (measured), which the free plan's monthly credit covers. See the pricing section for what comes later.

Not using a hosted service?

youtube-transcript-api is the open-source Python library for captions. It doesn't transcribe audio or fall back to AI translation, and from cloud servers YouTube often blocks it unless you add proxies.

Use from an AI agent

The Actor is also a tool for AI agents through Apify's MCP server: https://mcp.apify.com?tools=luisbendeckdev/youtube-transcript-scraper

MIT licensed. Issues and questions welcome.