Youtube Summariser with LlamaIndex
Project description
yt-summary
A tool to generate YouTube video summaries with LlmaIndex
The project was named
yt-summaryinitially but PyPI rejected it for being too similar to an existing project. Hence it's renamed toyt-plsfor the CLI tool (YouTube please)
Install
pip
pip install yt-pls
If you want to use the Gemini and/or Claude models, you need to install the optional dependencies:
pip install "yt-pls[google]"
pip install "yt-pls[anthropic]"
# or
pip install "yt-pls[all]"
Global
You can install the package globally with pipx or uvx:
pipx install yt-pls
uvx run yt-pls
Development
Install uv and run:
git clone https://github.com/nelnn/yt-summary.git
cd yt-summary
make install
source .venv/bin/activate
CLI
Export your API key(s) as an environment variable:
export OPENAI_API_KEY="sk-..."
export GOOGLE_API_KEY="..."
export ANTHROPIC_API_KEY="..."
Then execute
yt-pls [url/video_id]
You can specify the LLM provider and model:
yt-pls --provider openai --model gpt-5-mini-2025-08-07 [url/video_id]
You can also specify the summariser type:
yt-pls --summariser refined [url/video_id]
To save the output to a file, for example in markdown:
yt-pls [url/video_id] > summary.md
API
You can also use yt-summary as a library:
from yt_summary.run import get_youtube_summary
summary = await get_youtube_summary("https://www.youtube.com/watch?v=abc123")
Remember to export your LLM API key as an environment variable before running
the function. Alternatively, you can save them in a .env file in your project
root directory.
Transcript Extractor
To fetch the transcript and metadata:
from yt_summary.extractors import TranscriptExtractor
url = "url or video id"
transcript_extractor = TranscriptExtractor()
transcript_raw = await transcript_extractor.fetch(url)
This will return a Pydantic model YoutubeTranscriptRaw which looks like:
YoutubeTranscriptRaw(
metadata=YoutubeMetadata(
video_id="abc123",
title="Video Title",
author="Author Name",
channel_id="channel123",
video_url="https://www.youtube.com/watch?v=abc123",
channel_url="https://www.youtube.com/channel/channel123",
thumbnail_url="https://i.ytimg.com/vi/abc123/hqdefault.jpg",
is_generated=True,
language="English (auto-generated)",
language_code="en",
),
text="[00:00 (0s)] First sentence. Second sentence. [00:10 (10s)] Third sentence...",
)
Note: The extractor is just a wrapper around youtube-transcript-api which you can pass the same parameters to
fetchas you would toYouTubeTranscriptApi.fetchbut here we stitch the transcript snippets into a single string with timestamps embedded in the text. You can also pass the proxy settings toTranscriptExtractoras you would toYouTubeTranscriptApi.
Summariser
There are currently two summariser implementations: CompactSummariser and
RefineSummariser.
CompactSummariser lists metadata, high level summary and
Q&A with timestamps. It utilises the DocumentSummaryIndex from LLamaIndex.
RefineSummariser achieves the same by chunking the transcript to generate
summaries for each chunk before consolidating them by making multiple calls to
the LLM asynchronously. Be aware of the rate limits of your chosen LLM
provider.
For example, to generate summary with CompactSummariser:
from yt_summary.extractors import TranscriptExtractor
from yt_summary.schemas import LLMModel, LLMProvidersEnum
from yt_summary.summarisers import CompactSummariser, RefinedSummariser
transcript_extractor = TranscriptExtractor()
transcript_raw = await transcript_extractor.fetch(url)
summariser = CompactSummariser(
llm=LLMModel(
provider=LLMProvidersEnum.OPENAI,
model="gpt-5-mini-2025-08-07",
)
)
summary = await summariser.summarise(transcript)
The repository is under development, expect breaking changes. Sugguestions and contributions are welcome!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file yt_pls-0.0.1b2.tar.gz.
File metadata
- Download URL: yt_pls-0.0.1b2.tar.gz
- Upload date:
- Size: 16.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3871c78b6483cd0de0acbb05ba2b77cf1459193bed920a953e90dd32babb30f5
|
|
| MD5 |
d7f3426ba465259defabb4417290d8d8
|
|
| BLAKE2b-256 |
d3a864f7864d10c5a01b1e2ee9d0bd304cbd98707b3c74d64904cbfa4a760950
|
File details
Details for the file yt_pls-0.0.1b2-py3-none-any.whl.
File metadata
- Download URL: yt_pls-0.0.1b2-py3-none-any.whl
- Upload date:
- Size: 24.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d1709d757eb4c78de79cbe980ae7eb02e676cb6b7d7901502512f73f8763015
|
|
| MD5 |
ad8fd97923e2173b926c970c1d1c6148
|
|
| BLAKE2b-256 |
ca0a693a9decc4bda50008f07a8a76391ed7cec5eb21abd57801ce464abf5e27
|