
Security News
/Company News
Securing the Financial Frontier: How Capital One Uses Socket for Open Source Security
Capital One is partnering with Socket to proactively secure its open source supply chain.
ytranscript-api
Advanced tools
Reliable YouTube transcript extraction API client — your servers never get IP-banned, no proxy management, Whisper fallback for captionless videos.
Official JavaScript/TypeScript client for the yTranscript API — reliable YouTube transcript extraction without proxy management or player-response scraping.
Works in Node.js ≥ 18, Bun, Deno, and edge runtimes (anything with fetch).
npm install ytranscript-api
import { YTranscript } from "ytranscript-api";
const yt = new YTranscript("yk_live_..."); // get a key at ytranscript.com/developers
const t = await yt.transcript("dQw4w9WgXcQ"); // video ID or any YouTube URL
console.log(t.lang); // "en"
console.log(t.segments[0]); // { text: "We're no strangers to love", offset: 18800, duration: 3600 }
console.log(t.text); // full transcript as one string
console.log(t.whisper); // true if Whisper produced it (captionless video)
console.log(yt.lastQuota); // { limit: 10000, used: 42, rateLimitRemaining: 59 }
new YTranscript(apiKey, options?)| Option | Type | Default | Description |
|---|---|---|---|
baseUrl | string | https://ytranscript.com/api/v1 | Override the API base URL (rarely needed) |
timeoutMs | number | 120000 | Request timeout — Whisper fallbacks on long videos take time |
yt.transcript(videoIdOrUrl, options?)Accepts an 11-character video ID or any YouTube URL (youtube.com/watch, youtu.be/…, shorts, embeds).
| Option | Type | Description |
|---|---|---|
lang | string | Preferred language code (e.g. "en", "es"). Defaults to the video's source language. |
Returns a Transcript:
interface Transcript {
videoId: string;
lang: string; // language of the returned transcript
whisper: boolean; // produced by Whisper speech-to-text
cached: boolean; // served from cache (always 1 unit)
unitsCharged: number; // captions: 1, Whisper: 15
segments: { text: string; offset: number; duration: number }[]; // ms offsets
text: string; // convenience: all segment text joined
}
yt.lastQuotaQuota headers from the most recent successful request: { limit, used, rateLimitRemaining }.
Every failure throws a typed YTranscriptError:
import { YTranscript, YTranscriptError } from "ytranscript-api";
try {
await yt.transcript(videoId);
} catch (err) {
if (err instanceof YTranscriptError) {
switch (err.code) {
case "no_transcript": // 404 — video has no obtainable transcript
case "quota_exceeded": // 402 — monthly units exhausted
case "rate_limited": // 429 — back off and retry
case "unauthorized": // 401 — bad or revoked key
case "fetch_failed": // 500 — extraction failed (you are NOT charged)
case "network_error": // request never reached the API
}
console.error(err.status, err.message);
}
}
Caption transcripts cost 1 unit; Whisper transcriptions (captionless videos) cost 15 units. Failed requests cost nothing. Plans start at $29/mo for 10,000 units — get an API key at ytranscript.com/developers.
You can — until you deploy. YouTube aggressively bot-detects transcript extraction from datacenter IPs (AWS, GCP, Vercel, Railway…), so DIY libraries tend to work locally and fail in production. This API exists so that arms race is our full-time job instead of your on-call incident. Extraction success rates are high but not absolute, which is exactly why failed requests are never charged.
FAQs
Reliable YouTube transcript extraction API client — your servers never get IP-banned, no proxy management, Whisper fallback for captionless videos.
The npm package ytranscript-api receives a total of 1 weekly downloads. As such, ytranscript-api popularity was classified as not popular.
We found that ytranscript-api demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Security News
/Company News
Capital One is partnering with Socket to proactively secure its open source supply chain.

Security News
Socket CTO Ahmad Nassri discusses how to keep AI agents from bypassing package blocks, limit credential access, and monitor their actions.

Security News
GPT-6 Astra tried to plant malicious code in simulated open source projects using fake GitHub accounts and deceptive PRs during an assigned CTF challenge.