yt-summarize.sh
is a Bash script that summarizes Youtube videos by extracting and processing subtitles.
uv
installed (docs)
OpenAI key set for llm
tool with the command:
uvx llm keys set openai
./yt-summarize.sh https://youtube.com/watch?v=dQw4w9WgXcQ
The script will:
- Download English subtitles from the specified Youtube video using yt-dlp
- Remove timestamps and other non-essential information
- Strip the text to fit the token limit using ttok
- Summarize the subtitles into a bullet list using OpenAI API and Simon Willison's great llm tool.
You can add yt-dlp
options to the end of the command, or
create a persistent config file. Especially useful options:
--cookies-from-browser ... # try `chrome` or `safari` as a value
--sub-langs ... # set to your preferred language
To change the prompt, set YT_SUMMARIZE_PROMPT
environment variable. Example:
export YT_SUMMARIZE_PROMPT="summarize video transcript in 2 paragraphs"
./yt-summarize.sh ...