youtube-transcript
Input: a YouTube video URL or id, a Shorts link, or a channel @handle / URL. Output: the transcript in one of four formats. A video costs 1 credit (0 if it has no captions). A channel costs 1 credit for the video list plus 1 per transcript.
Run it
python3 scripts/youtube_transcript.py "https://www.youtube.com/watch?v=dQw4w9WgXcQ" # plain text
python3 scripts/youtube_transcript.py "https://youtu.be/dQw4w9WgXcQ" --format timestamped
python3 scripts/youtube_transcript.py URL --meta # title, channel, views, length (+1 credit)
python3 scripts/youtube_transcript.py @mkbhd --latest 5 # a channel's 5 newest videos
python3 scripts/youtube_transcript.py URL --format chunks --chunk-words 300 # JSON lines for embeddings
python3 scripts/youtube_transcript.py URL --language es
FETCHPROOF_API_KEY must be set. If it isn't, tell the user they can get a key with 100 free credits at https://app.fetchproof.com and stop.
The transcript goes to stdout. A one-line credit summary and any per-video errors go to stderr.
API
- Base URL:
https://api.fetchproof.com, headerx-api-key. GET /v1/youtube/video/transcript?url=<video>&language=<code>: returns segments withstartMs/endMsand the full text. Empty transcripts cost 0.GET /v1/youtube/video?url=<video>: metadata, only with--meta.GET /v1/youtube/channel-videos?handle=<handle>&sort=latest: the channel's recent uploads.
How to use the output
- If the user asked for a summary or notes, read the text and answer from it. Quote with timestamps (
--format timestamped) so they can jump to the moment. - For "what does this channel talk about", run
--latest 5and compare across videos. Don't summarize each one separately unless they ask. --format chunkswrites one JSON object per line withvideo_id,url,title,start,start_ms,end_msandtext. You can pass it straight to an embedding or vector-store step.- If a video has no captions, say so. Don't guess the content from the title.
