Registry / devops / youtube-transcript-plus

youtube-transcript-plus

JSON →
library2.0.0jsnpmunverified

A Node.js library for fetching transcripts from YouTube videos using YouTube's unofficial API. Version 2.0.0 requires Node.js >=20.0.0 and is ESM-only with TypeScript types included. Unlike alternatives, it supports custom fetch functions, caching (in-memory and file system), language selection, and HTTP fallback. Actively maintained, but may break if YouTube changes its internal API.

npm install youtube-transcript-plus
INSTALL
IMPORT
SIG · YOUTUBE-TRANSCRIPT
Y
youtube-transcript-plus
devopsjavascriptv2.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

fetchTranscript
import { fetchTranscript } from 'youtube-transcript-plus'
const fetchTranscript = require('youtube-transcript-plus').fetchTranscript
ESM-only since v2.0.0; TypeScript types are included.
InMemoryCache
import { InMemoryCache } from 'youtube-transcript-plus'
import { InMemoryCache } from 'youtube-transcript-plus/cache'
InMemoryCache is exported directly from main entry. Also available: FileSystemCache.
CacheStrategy
import type { CacheStrategy } from 'youtube-transcript-plus'
For TypeScript users implementing custom cache; use type import.

Fetches transcript for a YouTube video ID with language and caching options.

import { fetchTranscript, InMemoryCache } from 'youtube-transcript-plus'; const videoId = 'dQw4w9WgXcQ'; fetchTranscript(videoId, { lang: 'en', cache: new InMemoryCache(3600), // cache for 1 hour }) .then(transcript => { console.log('Transcript lines:', transcript.length); transcript.forEach(({ text, duration, offset }) => { console.log(`${offset}: ${text} (${duration}s)`); }); }) .catch(err => console.error('Error:', err.message));
Debug
Known issues
breakingv2.0.0 drops CommonJS support; import syntax must be ESM.
fix
Use import { fetchTranscript } from 'youtube-transcript-plus' instead of require().
affects: >=2.0.0
breakingNode.js >=20.0.0 required; older versions will throw an engine error.
fix
Upgrade Node.js to v20 or later.
affects: >=2.0.0
deprecatedThe old export from v1.x (default export 'transcript') is removed.
fix
Use named import { fetchTranscript } instead of default import.
affects: >=2.0.0
gotchaYouTube's unofficial API may break without notice; the library may stop working unexpectedly.
fix
Monitor the GitHub repo for updates or consider official alternatives.
affects: *
gotchaTranscript not available for all videos (e.g., music videos, age-restricted or private videos).
fix
Check video availability; handle errors gracefully.
affects: *
Errors
Common errors & fixes
TypeError: fetchTranscript is not a function
Using CommonJS require() with v2.0.0 which is ESM-only.
fix
Change to import { fetchTranscript } from 'youtube-transcript-plus' and ensure package.json contains "type": "module" or use .mjs extension.
Error: No transcript found for this video
The video does not have captions/subtitles enabled or the requested language is unavailable.
fix
Verify the video has captions; try a different language ('en', 'es', etc.) or omit 'lang' to get the default.
Error: getaddrinfo ENOTFOUND youtube.com
Network connectivity issue or HTTPS blocked in environment (e.g., corporate proxy).
fix
Set { disableHttps: true } in options if HTTP is allowed, or configure proxy via custom fetch functions.
Error: ETIMEDOUT
YouTube request timed out, often due to rate limiting or network congestion.
fix
Implement retries with backoff or use a proxy; consider caching to reduce requests.
Upgrade
Version history
2.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
21 hits · last 30 days
node
20
Resources
youtube-transcript-plus — npm install youtube-transcript-plus · libregistry