The official Node.js / TypeScript SDK (getyoutubetranscript) for the GetYouTubeTranscript YouTube Transcript API. Get YouTube video transcripts in JavaScript without a Google API key, yt-dlp, or a headless browser, plus YouTube search, channel, and playlist data over a simple REST API.
- Fully typed, Promise-based client
- Zero dependencies - built on native
fetch(Node 18+) - ESM and CommonJS builds, with
.d.tstypes included - Typed errors: every failed request throws a
GetYouTubeTranscriptErrorwith acode,message, andstatusCode
Not yet published to npm. Install directly from GitHub:
npm install github:tubeagentkit/youtube-transcript-api-nodeimport { GetYouTubeTranscript } from "getyoutubetranscript";
const client = new GetYouTubeTranscript({ apiKey: process.env.GYT_API_KEY! });
const { title, transcript, word_count } = await client.getTranscript({
v: "https://www.youtube.com/watch?v=jNQXAC9IVRw",
});
console.log(title, word_count, transcript.slice(0, 200));Every request needs an API key. New accounts get 100 free credits, no card required - grab one at getyoutubetranscript.com.
Prefer to do it in code? Use the self-serve signup flow, which sends a 6-digit email OTP and hands back a key once verified:
import { signup, verifySignup } from "getyoutubetranscript";
await signup("you@example.com");
// check your inbox for the 6-digit code, then:
const { api_key } = await verifySignup("you@example.com", "123456");Every method returns the parsed data payload directly - no need to unwrap { success, data } yourself.
// Search videos or channels
const results = await client.search({ q: "lofi beats" });
// Resolve a channel handle to its channel ID (free)
const { channel_id } = await client.resolveChannel({ handle: "@mkbhd" });
// List a playlist's videos
const playlist = await client.getPlaylist({ list: "PLillGF-RfqbYE6Ik_EuXA2iZFcE082B3s" });
// Channel metadata + latest uploads (free)
const channel = await client.getChannelLatest({ channel: "@mkbhd" });
// Search within a channel
const channelResults = await client.searchChannel({ channel: "@mkbhd", q: "iphone" });
// List all of a channel's uploads
const uploads = await client.listChannelVideos({ channel: "@mkbhd" });
// Check remaining credits, plan, and rate limit (free)
const { plan_credits_left, plan } = await client.getCredits();Paginated endpoints (search, getPlaylist, searchChannel, listChannelVideos) return a continuation token you feed back in on the next call:
let page = await client.search({ q: "lofi beats" });
while (page.pagination?.next_page_token) {
page = await client.search({ pageToken: page.pagination.next_page_token });
}import { GetYouTubeTranscriptError } from "getyoutubetranscript";
try {
await client.getTranscript({ v: "invalid" });
} catch (err) {
if (err instanceof GetYouTubeTranscriptError) {
console.error(err.statusCode, err.code, err.message);
// e.g. 402 PAYMENT_REQUIRED "You have used all your credits."
} else {
throw err;
}
}| Method | Endpoint | Credits |
|---|---|---|
getTranscript(params) |
GET /transcript |
1 |
search(params) |
GET /search |
1 |
resolveChannel(params) |
GET /resolve |
free |
getPlaylist(params) |
GET /playlist |
1 |
getChannelLatest(params) |
GET /channel/latest |
free |
searchChannel(params) |
GET /channel/search |
1 |
listChannelVideos(params) |
GET /channel/videos |
1 |
getCredits() |
GET /credits |
free |
signup(email) |
POST /signup |
free |
verifySignup(email, otp) |
POST /signup/verify |
free |
Full parameter and response shapes are exported as TypeScript types (TranscriptData, SearchData, PlaylistData, etc.) - see src/types.ts or your editor's autocomplete.
npm install
npm run build # tsup -> dist/ (ESM + CJS + .d.ts)
npm test # unit tests, mocked fetch, no network
npm run typecheckLive integration tests hit the real API and are skipped unless GYT_API_KEY is set:
GYT_API_KEY=sk_live_... npm run test:live- Docs: getyoutubetranscript.com/docs
- API reference (OpenAPI): getyoutubetranscript.com/openapi.json
Other ways to use the GetYouTubeTranscript API:
- youtube-transcript-api: YouTube Transcript API docs, endpoint reference, OpenAPI spec and examples in curl, Python, JavaScript, Go and PHP
- youtube-transcript-api-python: YouTube Transcript API SDK for Python
- youtube-mcp: Remote YouTube MCP server for Claude, ChatGPT, Cursor and VS Code
- youtube-transcript-skills: YouTube transcript Agent Skill for Claude Code, Cursor, Codex and OpenClaw
- youtube-transcript-cursor-plugin: YouTube Transcript Cursor plugin bundling the MCP server, skills, commands and a research agent
- n8n-nodes-getyoutubetranscript: YouTube transcript n8n community node, also usable as an AI Agent tool
MIT © tubeagentkit