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 the video URL.

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.

For example:

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

# Example with a different video
llm -f 'yt:https://www.youtube.com/watch?v=VIDEO_ID_HERE' 'What are the main points discussed in this video?'

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.

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.1.tar.gz (3.3 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.1-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: llm_youtube_transcript-0.1.tar.gz
  • Upload date:
  • Size: 3.3 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.1.tar.gz
Algorithm Hash digest
SHA256 f0fb2f5f9a5d11f80d77ca0f97b923648b4af647e522ced6563b6efa63ad285f
MD5 531159b25b129e24e23731f06cadc3bf
BLAKE2b-256 d066c02d267133c956dbada07604db653be002bc12917cf98a8fd32576479872

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_youtube_transcript-0.1.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.1-py3-none-any.whl.

File metadata

File hashes

Hashes for llm_youtube_transcript-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e65b23ec1e6dd9750eb77d7e2f2960b1d6120ba1ce498df9b220b321bcaebb1a
MD5 2016326a33f3ef098528ff484d523012
BLAKE2b-256 ef94833ef31c46ac66acd596fd70d637b804bd1a715438c5b2c77464ed9c3e89

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_youtube_transcript-0.1-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