Skip to main content

llm-youtube-transcript

PyPI Changelog License

LLM plugin for fetching YouTube video transcripts.

This plugin fetches the text transcript of a YouTube video using the Supadata API and makes it available as an LLM fragment.

For background on LLM fragments:

Installation

Install this plugin in the same environment as LLM.

llm install llm-youtube-transcript

Configuration

This plugin requires a Supadata API key to function. You get 100 requests per month with a free acount.

  1. Sign up at Supadata.ai and get your API key.

  2. Set the API key as an environment variable named SUPADATA_API_KEY:

    export SUPADATA_API_KEY=your_api_key_here
    

    You can add this line to your shell profile (e.g., ~/.bashrc, ~/.zshrc) to make it persistent across sessions.

Usage

You can feed the transcript of a YouTube video into LLM using the yt: fragment prefix followed by either the full video URL or just the video ID.

Make sure you have set the SUPADATA_API_KEY environment variable first.

Note: If your YouTube URL contains special characters (like ? or &), you must enclose the entire fragment identifier (e.g., yt:https://...) in single or double quotes on the command line. This prevents your shell from misinterpreting the URL or ID.

For example:

llm -f yt:https://youtu.be/dQw4w9WgXcQ 'Summarize this transcript'

# Fetch transcript using the full YouTube video URL (note the quotes)
llm -f 'yt:https://www.youtube.com/watch?v=dQw4w9WgXcQ' 'Summarize this transcript'

# Fetch transcript using just the video ID
llm -f yt:dQw4w9WgXcQ 'Summarize this transcript'

The plugin will call the Supadata API to retrieve the plain text transcript of the specified video. If the API key is missing or invalid, or if the transcript cannot be fetched, an error will be raised.

TODO

  • Use youtube-transcript-api library instead of Supadata.
  • Add support for yt:VIDEO_ID.

Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:

cd llm-youtube-transcript
python -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

# Installs llm, httpx, and testing tools like pytest
pip install -e '.[test]'

To run the tests:

python -m pytest

Metadata

Release files for llm-youtube-transcript 0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llm-youtube-transcript 0.2
File Size Uploaded
llm_youtube_transcript-0.2.tar.gz 5.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for llm-youtube-transcript 0.2
File Interpreter ABI Platform
llm_youtube_transcript-0.2-py3-none-any.whl Python 3 none any Details

Total release size: 9.2 kB

Release files / llm_youtube_transcript-0.2.tar.gz

Download URL llm_youtube_transcript-0.2.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
2de0dbcc4f1c605701ddee87610cc094112617a8a3ca2ff812b8c97c4b61fe27
BLAKE2b-256 checksum
How to use checksums
726e278dd0b077db9bd897779db486986bd7d417fbd036dabb9b9e200170bbe3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 17, 2025.

Transparency log

Release files / llm_youtube_transcript-0.2-py3-none-any.whl

Download URL llm_youtube_transcript-0.2-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b0b06bcb0bf58b6300bfd77f8afb432e94231970e650f4a969d531758ad03855
BLAKE2b-256 checksum
How to use checksums
3cd01be1b44b510d1dfea246333baac2ed65a18e57a982b64901c814459b9120
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 17, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.2 This release

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page