Skip to content

tatasadi/youtube-transcript-api

Repository files navigation

YouTube Transcript API

Flask API to fetch YouTube video transcripts using yt-dlp.

Quick Start

docker-compose up -d

API will be available at http://localhost:5000

Endpoints

GET /health

Health check endpoint.

GET|POST /transcript

Get transcript for a video.

Parameters:

  • video_id or url: YouTube video ID or URL
  • languages (optional): Comma-separated language codes (default: en)

Example:

curl "http://localhost:5000/transcript?video_id=dQw4w9WgXcQ"
curl "http://localhost:5000/transcript?url=https://www.youtube.com/watch?v=dQw4w9WgXcQ"

GET|POST /transcript/list

List available transcripts for a video.

Example:

curl "http://localhost:5000/transcript/list?video_id=dQw4w9WgXcQ"

YouTube Bot Detection Fix

If you get "Sign in to confirm you're not a bot" errors, export your browser cookies:

1. Install Browser Extension

2. Export Cookies

  1. Log into YouTube in your browser
  2. Open any YouTube video
  3. Click the extension icon and export cookies
  4. Save as cookies.txt

3. Add to Docker Container

Place cookies.txt in the same directory as docker-compose.yml, then update docker-compose.yml:

services:
  youtube-transcript-api:
    build: .
    container_name: youtube-transcript-api
    volumes:
      - ./cookies.txt:/app/cookies.txt:ro
    expose:
      - "5000"
    restart: unless-stopped
    networks:
      - n8n_n8n-network

Then rebuild:

docker-compose down
docker-compose up -d --build

Network Configuration

To connect to n8n or other Docker containers, ensure the external network exists:

networks:
  n8n_n8n-network:
    external: true

From n8n, use: http://youtube-transcript-api:5000

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published