How to get a YouTube transcript with an API (Python, no YouTube API key)
Three ways to get the transcript of a YouTube video as text: one video with a single REST call, whole channels and playlists with a short loop, or straight from your AI assistant. None of them needs a YouTube API key.
Updated 5 December 2026 · TTech Solutions
Why not the official YouTube API?
The official YouTube Data API can list a video's caption tracks, but downloading one (captions.download) needs OAuth and permission to edit the video. So it works for your own videos only, and each download costs 200 of your 10,000 daily quota units.
The open-source youtube-transcript-api library works well on a laptop. On cloud servers (AWS, Google Cloud, Azure) YouTube often blocks it, and you end up buying and rotating proxies yourself. The options below handle that for you.
Option 1: one video from Python
- Sign up for free and create an API key in your TTech dashboard.
- Send the key in the
x-api-keyheader. Every call goes tohttps://api.ttechapi.com/v1/youtubeplus the endpoint path. - Run the code below with a video id or link.
import requests
BASE = "https://api.ttechapi.com/v1/youtube"
HEADERS = {"x-api-key": "YOUR_API_KEY"}
def get(path, **params):
data = requests.get(BASE + path, params=params, headers=HEADERS, timeout=60).json()
if data.get("error"): # errors come back as JSON with an error code and a message
raise RuntimeError(f"{data['error']}: {data.get('msg') or data.get('message')}")
return data
data = get("/get_transcript", id="arj7oStGLkU") # a video id or link
print(data["selected"]) # language, and isAutoGenerated
segments = data["transcript"]
for seg in segments:
seg["text"] = seg["text"].replace("\n", " ") # captions keep their line breaks
text = " ".join(seg["text"] for seg in segments)
print(text[:300])
# With timestamps, so an LLM can cite where it was said
lines = [f"[{seg['startTime']}] {seg['text']}" for seg in segments]
print("\n".join(lines[:5]))const res = await fetch(
'https://api.ttechapi.com/v1/youtube/get_transcript?id=arj7oStGLkU',
{ headers: { 'x-api-key': 'YOUR_API_KEY' } }
);
const data = await res.json();
if (data.error) throw new Error(`${data.error}: ${data.msg ?? data.message}`);
const text = data.transcript.map(s => s.text.replace(/\n/g, ' ')).join(' ');curl -G "https://api.ttechapi.com/v1/youtube/get_transcript" \
--data-urlencode "id=arj7oStGLkU" \
-H "x-api-key: YOUR_API_KEY"
The answer, shortened:
{
"id": "arj7oStGLkU",
"selected": {"title": "English", "languageCode": "en", "isAutoGenerated": false},
"transcript": [
{"startMs": "12645", "endMs": "14015", "startTime": "0:12", "text": "So in college,"},
{"startMs": "15349", "endMs": "16913", "startTime": "0:15", "text": "I was a government major,"}
],
"languages": [
{"title": "Arabic", "languageCode": "ar", "isAutoGenerated": false},
{"title": "Armenian", "languageCode": "hy", "isAutoGenerated": false}
]
}| Field | What it is |
|---|---|
transcript | Timed segments: startMs, endMs, startTime and text |
selected | The caption track you got, and whether YouTube made it automatically |
languages | Every caption language the video has |
Want another language? Add lang=es (or any code from languages). A video without captions answers {"error": "NOT_FOUND", "code": "404", "msg": "This video has no captions"}. Each call costs 1 credit.
Option 2: many videos, whole channels or playlists
List a channel's videos with GET /channel/videos (30 a page) or a playlist with GET /playlist (100 a page). Then ask GET /get_transcript for each video. A video without captions answers an error, so the loop skips it.
import requests
BASE = "https://api.ttechapi.com/v1/youtube"
HEADERS = {"x-api-key": "YOUR_API_KEY"}
def get(path, **params):
data = requests.get(BASE + path, params=params, headers=HEADERS, timeout=60).json()
if data.get("error"): # errors come back as JSON with an error code and a message
raise RuntimeError(f"{data['error']}: {data.get('msg') or data.get('message')}")
return data
page = get("/channel/videos", id="@TED", sort_by="newest") # an @handle, a channel link or a UC id
for video in page["data"][:20]: # the 20 newest videos
try:
data = get("/get_transcript", id=video["videoId"])
except RuntimeError as err: # for example, a video without captions
print("skipped:", video["title"], err)
continue
text = " ".join(seg["text"].replace("\n", " ") for seg in data["transcript"])
print(video["title"], "-", len(text), "characters")
# The next 30 videos: get("/channel/videos", token=page["continuation"])
# A playlist instead: get("/playlist", id="PL...") 100 videos a pageEach page of videos costs 1 credit and each transcript 1 credit, from the same credit balance as every other TTech API.
Option 3: ask your AI assistant
Add the TTech MCP server to Claude, Claude Code, Cursor, Codex, VS Code or ChatGPT. You sign in with your TTech account, so no key goes into the config. Then just ask: "Get the transcript of youtu.be/arj7oStGLkU and summarize it in five bullet points." The assistant calls the youtube_transcript tool.
Run this, then type /mcp in Claude Code and sign in to TTech.
claude mcp add --transport http ttech https://mcp.ttechapi.com/mcpOr install our Claude Code plugin from GitHub. It adds the same server and a YouTube research skill. Then type /mcp and sign in.
claude plugin marketplace add ttechapi/claude-plugins
claude plugin install ttech@ttechTo skip the question before each tool call, add "mcp__ttech" to permissions.allow in .claude/settings.json.
- In claude.ai or Claude Desktop, open Customize > Connectors, select + Add and Add custom connector.
- Paste this URL and continue:
https://mcp.ttechapi.com/mcp- Select Connect and sign in with your TTech account.
Add this to ~/.cursor/mcp.json (or .cursor/mcp.json in a project). Then open Cursor's MCP settings and connect TTech to sign in.
{
"mcpServers": {
"ttech": {
"url": "https://mcp.ttechapi.com/mcp"
}
}
}Add the server, then sign in through the browser.
codex mcp add ttech --url https://mcp.ttechapi.com/mcp
codex mcp login ttech- In ChatGPT on the web, open Plugins, select + and Add custom MCP server (on plans that allow custom MCP servers).
- Paste this URL and choose OAuth:
https://mcp.ttechapi.com/mcp- Sign in with your TTech account and review the tools.
Add this to .vscode/mcp.json, then start the server and sign in.
{
"servers": {
"ttech": {
"type": "http",
"url": "https://mcp.ttechapi.com/mcp"
}
}
}FAQ
Does it work for auto-generated captions?
Yes. selected.isAutoGenerated tells you whether YouTube made the captions automatically.
Can it translate a transcript?
No. You get the languages the video really has; ask your LLM to translate the text if you need another one.
What about videos without captions?
They have no transcript to read, so the call answers an error instead.
Do I need a YouTube API key?
No. You need only a TTech API key. There is no Google Cloud project and no YouTube quota.
Services in this guide
YouTube Channel & Video API
Channels, videos, Shorts, comments, transcripts, search and playlists as JSON. A YouTube Data API alternative with no Google key and no daily quota.
DetailsYouTube Transcript Scraper
The captions of any YouTube video or Short as timed segments, in any language the video has, from one REST endpoint.
DetailsMore guides
YouTube API quota exceeded? Get YouTube data without a Google key or daily quota
What the 10,000-unit quota really allows, your options when it runs out, and how to switch to an API with no Google quota.
Guide ReadHow to scrape YouTube comments and replies with Python
Collect every comment and reply of a video into CSV with Python, or for whole channels, then analyze them with an LLM.
Guide ReadYouTube MCP server for Claude, Claude Code, Cursor, Codex and ChatGPT
Connect YouTube search, video details, transcripts and comments to your AI assistant with one MCP server, with setup steps for each client.
Guide Read