Skip to main content

Plugin for LLM that adds support for fetching transcripts from YouTube videos using Supadata API

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llm_youtube_transcript-0.2.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llm_youtube_transcript-0.2-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file llm_youtube_transcript-0.2.tar.gz.

File metadata

  • Download URL: llm_youtube_transcript-0.2.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for llm_youtube_transcript-0.2.tar.gz
Algorithm Hash digest
SHA256 2de0dbcc4f1c605701ddee87610cc094112617a8a3ca2ff812b8c97c4b61fe27
MD5 3348bd0ad966c53c5fc8e68e8199c80e
BLAKE2b-256 726e278dd0b077db9bd897779db486986bd7d417fbd036dabb9b9e200170bbe3

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_youtube_transcript-0.2.tar.gz:

Publisher: publish.yaml on saeedesmaili/llm-youtube-transcript

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file llm_youtube_transcript-0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for llm_youtube_transcript-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b0b06bcb0bf58b6300bfd77f8afb432e94231970e650f4a969d531758ad03855
MD5 37783f07d0bba5195d1340635484ec0b
BLAKE2b-256 3cd01be1b44b510d1dfea246333baac2ed65a18e57a982b64901c814459b9120

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_youtube_transcript-0.2-py3-none-any.whl:

Publisher: publish.yaml on saeedesmaili/llm-youtube-transcript

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page