youtube_transcript_api
A simple Python API that can obtain an YouTube Video transcription given an Video ID or an URL.
72
This Docker image contains an API built in Python using FastAPI, allowing users to retrieve transcripts from YouTube videos given a video ID or URL.
By default, the API runs on port 8000. To start the container with default settings:
docker run -d -p 8000:8000 subipranuvem/youtube_transcript_api:latest
To change the default port, set the PORT environment variable:
docker run -d -p 8001:8001 -e PORT=8001 subipranuvem/youtube_transcript_api:latest
GET /youtube/transcript
| Parameter | Type | Description | Example |
|---|---|---|---|
video_id | Optional (str) | YouTube video ID | dQw4w9WgXcQ |
video_url | Optional (str) | Full YouTube video URL | https://www.youtube.com/watch?v=dQw4w9WgXcQ |
preferred_languages | Optional (list) | Preferred languages for transcript (default: ["en"]) | ["pt", "es"] |
Note: At least one of the parameters (video_id or video_url) must be provided.
After running the container, access the interactive Swagger UI documentation at the /docs route:
http://localhost:8000/docs
(or replace with your configured port)
curl -X GET "http://localhost:8000/youtube/transcript?video_url=https://www.youtube.com/watch?v=dQw4w9WgXcQ&preferred_languages=pt" -H "accept: application/json"
Content type
Image
Digest
sha256:1ee70f89c…
Size
155.6 MB
Last updated
11 months ago
docker pull subipranuvem/youtube_transcript_api