Node.js Integration

YouTube Transcript API for Node.js

Build powerful YouTube transcript pipelines with Node.js. Our API integrates seamlessly with Express, Fastify, and serverless platforms like Vercel and AWS Lambda. Process transcripts for chatbots, content management systems, or data pipelines with minimal code.

Install Dependencies

npm install node-fetch

Complete Code Example

import fetch from "node-fetch";

const API_KEY = process.env.YT_TRANSCRIPTS_API_KEY;

async function getTranscript(videoUrl) {
  const res = await fetch(
    `https://api.youtubetranscripts.co/v1/transcript?url=${encodeURIComponent(videoUrl)}`,
    { headers: { "x-api-key": API_KEY } }
  );

  if (!res.ok) {
    throw new Error(`API error: ${res.status} ${res.statusText}`);
  }

  return res.json();
}

// Usage
const data = await getTranscript("https://www.youtube.com/watch?v=dQw4w9WgXcQ");
console.log(`Title: ${data.title}`);
console.log(`Segments: ${data.transcript.length}`);

// Get plain text
const fullText = data.transcript.map((s) => s.text).join(" ");
console.log(fullText);

Key Features for Node.js Developers

Native ESM and CommonJS support

Works with Express, Fastify, Hono, and Koa

Deploy on Vercel, AWS Lambda, Cloudflare Workers

Stream-friendly JSON responses for large transcripts

Batch API for processing video playlists

TypeScript type definitions available

Start Building with Node.js Today

Sign up in 30 seconds. Get 150 free API requests. No credit card required. Your Node.js integration can be live in minutes.