Flask API to fetch YouTube video transcripts using yt-dlp.
docker-compose up -dAPI will be available at http://localhost:5000
Health check endpoint.
Get transcript for a video.
Parameters:
video_idorurl: YouTube video ID or URLlanguages(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"List available transcripts for a video.
Example:
curl "http://localhost:5000/transcript/list?video_id=dQw4w9WgXcQ"If you get "Sign in to confirm you're not a bot" errors, export your browser cookies:
- Chrome/Edge: Get cookies.txt LOCALLY
- Firefox: cookies.txt
- Log into YouTube in your browser
- Open any YouTube video
- Click the extension icon and export cookies
- Save as
cookies.txt
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-networkThen rebuild:
docker-compose down
docker-compose up -d --buildTo connect to n8n or other Docker containers, ensure the external network exists:
networks:
n8n_n8n-network:
external: trueFrom n8n, use: http://youtube-transcript-api:5000