YouTube Transcript
Extract transcript and metadata from YouTube videos using youtube-transcript-api.
Usage
bash
uv run scripts/get_transcript.py "VIDEO_URL_OR_ID" uv run scripts/get_transcript.py "VIDEO_URL_OR_ID" --timestamps uv run scripts/get_transcript.py "VIDEO_URL_OR_ID" --lang en,ru
Parameters
| Flag | Default | What it does |
|---|---|---|
--timestamps / -t | off | Add [MM:SS] before each line |
--lang / -l | ru,en | Language priority (first available wins) |
Output
Script prints to stdout: metadata header (title, channel, URL, video ID), separator, then transcript text.
The Iron Law
NEVER modify the transcript text. Output it exactly as received. Reformat into paragraphs (merge short lines into logical blocks) but NEVER change, summarize, or rephrase any words.
After Getting Transcript
- •Save raw transcript as
{video_id}-transcript.txt(or user-specified file) - •Then — and only then — analyze, summarize, or process if the user asked for it
Limitations
- •Requires video to have subtitles (manual or auto-generated). If none — inform user, do not attempt workarounds
- •Subject to YouTube rate limiting on heavy use