Skip to main content

videorag

A simple Python library to extract and retrieve the most relevant transcript chunks from a YouTube video for a user query using vector search and semantic retrieval. It helps developers quickly index video transcripts and answer questions about the video content.


🧠 What It Does

videorag fetches the transcript of a YouTube video and uses a vector store with MMR retrieval to find the most relevant text parts for a user query. This makes it easy to build tools like video Q&A bots, summarizers, and RAG systems.


🚀 Features

  • Automatically download YouTube transcripts (English first, fallback languages)
  • Clean and split transcripts into searchable chunks
  • Build a FAISS vector index for fast retrieval
  • Retrieve top-k relevant chunks for a query
  • Minimal and easy-to-use API

🧾 Installation

Install directly via pip in your Python environment:

pip install videorag

Or install from the local repository (after cloning):

pip install -e .

Make sure you are using a virtual environment (venv) when installing dependencies. ([pyOpenSci][1])


📦 Usage Example

Here is a simple usage example in Python:

from videorag import get_relevant_chunks_from_video

video_link = "https://www.youtube.com/watch?v=HbZD0XoN5fc"
query = "Who is Sunita Williams?"
k = 3

relevant_text = get_relevant_chunks_from_video(video_link, query, k)
print(relevant_text)

This returns the top-k relevant transcript text chunks that best match your query.


🛠️ How It Works

  1. Fetch the YouTube video transcript
  2. Clean and split it into chunks
  3. Create or load a FAISS vector index
  4. Run MMR (Maximal Marginal Relevance) to get diverse, relevant chunks

🧪 Contributing

Contributions are welcome! You can:

  • Report bugs
  • Suggest new features
  • Improve documentation
  • Add tests

Feel free to open issues or submit pull requests.

Legal Notice

This software is provided under the MIT License. Users are responsible for complying with YouTube's Terms of Service when using this library. The author assumes no liability for how this library is used.

Metadata

Release files for videorag 0.1.0

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

Source distribution (sdist)

Source distribution for videorag 0.1.0
File Size Uploaded
videorag-0.1.0.tar.gz 4.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for videorag 0.1.0
File Interpreter ABI Platform
videorag-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.0 kB

Release files / videorag-0.1.0.tar.gz

Download URL videorag-0.1.0.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
873e59e1b85e30bd7b648558c4c4e590adcfa7451674f0c931faeb117b97ae75
BLAKE2b-256 checksum
How to use checksums
406c74dd4dbe48c979cb57b1186c45882edde3e073ee8d95bdf35a4fbecc5631
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.6

Release files / videorag-0.1.0-py3-none-any.whl

Download URL videorag-0.1.0-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ea2b29d8484bf78805d0047f3e5a27809e2f5d45e2ec99011e960d7882d1f13a
BLAKE2b-256 checksum
How to use checksums
54249c6563eccdd0bac20ceef5d4c623d4498c9444d1b53cd0bef113e7ad0b9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.6

Release history Release notifications | RSS feed

This release

0.1.0 This release

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