This application allows users to extract transcripts from YouTube videos, upload their own video/audio files, create searchable vector databases, and perform semantic searches using a Gradio web interface or command-line interface (CLI). It's powered by faster-whisper for transcription, FAISS for vector search, and sentence-transformers for text embeddings.
Ensure you have Python installed (>= 3.8). Then, install the required dependencies:
pip install offlineyoutube
The app provides two ways to interact:
1. Gradio Web Interface
2. Command-Line Interface (CLI)
Launch the web interface:
offlineyoutube ui
or simply:
offlineyoutube
Then, open the URL (usually http://127.0.0.1:7860) in your browser.
Videos and uploaded files will be transcribed, and the database will be updated with the content.
Search:
The CLI provides more flexibility for programmatic use.
Use the --help command to view available commands and examples:
offlineyoutube --help
Output:
usage: offlineyoutube [-h] {add,search,ui} ...
YouTube Video Search Application
positional arguments:
{add,search,ui} Available commands
add Add videos to the database
search Search the video database
ui Run the Gradio web interface
optional arguments:
-h, --help Show this help message and exit
Examples:
# Add videos from a playlist and keep videos locally
offlineyoutube add --input "https://www.youtube.com/playlist?list=YOUR_PLAYLIST_ID" --keep_videos
# Add specific videos without keeping videos locally
offlineyoutube add --input "https://www.youtube.com/watch?v=VIDEO_ID1,https://www.youtube.com/watch?v=VIDEO_ID2"
# Add videos from a channel (process entire channel)
offlineyoutube add --input "https://www.youtube.com/channel/CHANNEL_ID" --process_channel
# Search the database with a query
offlineyoutube search --query "Your search query" --top_k 5
# Run the Gradio web interface
offlineyoutube ui
bash
offlineyoutube add --input "https://www.youtube.com/playlist?list=YOUR_PLAYLIST_ID,https://www.youtube.com/watch?v=VIDEO_ID"
bash
offlineyoutube add --input "https://www.youtube.com/watch?v=dQw4w9WgXcQ,https://www.youtube.com/watch?v=9bZkp7q19f0"
bash
offlineyoutube add --input "https://www.youtube.com/channel/CHANNEL_ID" --process_channel
bash
offlineyoutube add --input "https://www.youtube.com/watch?v=VIDEO_ID" --keep_videos
bash
offlineyoutube search --query "machine learning tutorials" --top_k 5
faster-whisper.datasets/transcript_dataset.csv.A vector database is updated using FAISS with embeddings generated by sentence-transformers.
Incremental Updating:
This ensures efficient processing, especially when dealing with large datasets.
Searching the Database:
Simply provide a comma-separated list of URLs, and the app will automatically detect and process each link:
offlineyoutube add --input "https://www.youtube.com/playlist?list=PLAYLIST_ID1,https://www.youtube.com/watch?v=VIDEO_ID,https://www.youtube.com/channel/CHANNEL_ID"
If you want to process entire channels, make sure to include the --process_channel flag:
offlineyoutube add --input "https://www.youtube.com/channel/CHANNEL_ID" --process_channel
In the Gradio web interface, navigate to the Add Videos tab. Use the "Upload your own video/audio files" option to upload one or multiple files. The app will process these files and add them to the database.
Ensure that the videos or files have been fully processed and that the vector database has been updated. The app handles this automatically, but processing may take time for large videos, playlists, or channels.
By default, the app keeps videos stored locally. To change this behavior, use the --keep_videos flag and set it to False:
offlineyoutube add --input "VIDEO_OR_PLAYLIST_URL" --keep_videos False
In the Gradio interface, uncheck the "Keep videos stored locally" option in the Add Videos tab.
Yes! Use the --process_channel flag when adding videos via the CLI:
offlineyoutube add --input "https://www.youtube.com/channel/CHANNEL_ID" --process_channel
In the Gradio interface, check the "Process entire channel when a channel URL is provided" option in the Add Videos tab.
Yes! Use the search command via the CLI:
offlineyoutube search --query "Your query" --top_k 5
.
├── app.py # Main application script (Gradio + CLI)
├── functions.py # Helper functions for transcription, FAISS, etc.
├── datasets/
│ ├── transcript_dataset.csv # CSV file storing transcripts
│ └── vector_index.faiss # FAISS vector index
├── thumbnails/ # Folder for storing video thumbnails
├── videos/ # Folder for storing downloaded videos (if keep_videos is True)
├── tmp/ # Temporary folder for videos (if keep_videos is False)
├── uploaded_files/ # Folder for storing uploaded files
--keep_videos False option if storage is a concern.Feel free to fork the repository, open issues, or submit pull requests if you'd like to contribute to this project.
This project is licensed under the MIT License. See the LICENSE file for details.
$ claude mcp add offlineYoutube \
-- python -m otcore.mcp_server <graph>