A plugin for Simon Willison's LLM tool that adds a youtube
fragment loader to download and use YouTube video subtitles in your prompts.
-
Make sure you have the LLM tool installed:
pip install llm
-
Install this plugin:
llm install llm-fragments-youtube
This will automatically install all dependencies, including yt-dlp.
You can use the youtube
or yt
fragment in your LLM prompts to include subtitles from YouTube videos:
# Using a YouTube video ID
llm -f youtube:dQw4w9WgXcQ "summarize this video"
# You can also use the shorter 'yt' prefix
llm -f yt:dQw4w9WgXcQ "summarize this video"
# Continue chatting
llm -c "at which minute do they talk about ..."
# Language can also be specified
llm -f youtube:es:dQw4w9WgXcQ "resume el video"
# Using a full YouTube URL
llm -f youtube:https://www.youtube.com/watch?v=dQw4w9WgXcQ "summarize video"
To run the tests, first install the package with test dependencies:
pip install -e ".[test]"
Then run the tests using pytest:
pytest
Beerware