Awesome
YouTube Summarizer by TCSenpai
YouTube Summarizer is a Streamlit-based web application that allows users to generate summaries of YouTube videos using AI-powered language models and optionally Whisper for transcription.
Features
- Supports multiple YouTube frontends (e.g. YouTube, Invidious, etc.)
- Fetch and cache YouTube video transcripts
- Summarize video content using Ollama AI models
- Display video information (title and channel)
- Customizable Ollama URL and model selection
- Fallback to Whisper for transcription if no transcript is found
- Customizable Whisper URL and model selection
- Optional force Whisper transcription
Installation
-
Clone the repository:
git clone https://github.com/yourusername/youtube-summarizer.git cd youtube-summarizer
-
Install the required dependencies:
2a. Using pip:
pip install -r requirements.txt
2b. Using conda:
conda env create -f environment.yml
Note: You might need to install
conda
first. -
Set up environment variables: Create a
.env
file in the root directory and add the following:YOUTUBE_API_KEY=your_youtube_api_key OLLAMA_MODEL=default_model_name WHISPER_URL=http://localhost:8000/ WHISPER_MODEL=Systran/faster-whisper-large-v3 PASTEBIN_API_KEY=your_pastebin_api_key
- Note: you can copy the
env.example
file to.env
and modify the values. - Important: the
WHISPER_URL
should point to the whisper server you want to use. You can leave it as it is if you are not planning on using Whisper. - Important: the
PASTEBIN_API_KEY
is optional, but if you want to use it, you need to get one from Pastebin.
- Note: you can copy the
Usage
-
Run the Streamlit app:
streamlit run src/main.py
-
Open your web browser and navigate to the provided local URL (usually
http://localhost:8501
). -
Enter a YouTube video URL in the input field.
-
(Optional) Customize the Ollama URL and select a different AI model.
-
(Optional) Customize the Whisper URL and select a different Whisper model.
-
Click the "Summarize" button to generate a summary of the video.
Global Installation
You can install the application globally on your system by running the following command:
sudo ./install.sh
This will create a new command youlama
that you can use to run the application.
Run with the included binary
You can also run the application with the included binary:
./youlama
Dependencies
- Streamlit
- Pytube
- Ollama
- YouTube Data API
- Python-dotenv
- pytubefix
- Gradio
Project Structure
src/main.py
: Main Streamlit applicationsrc/ollama_client.py
: Ollama API client for model interactionsrc/video_info.py
: YouTube API integration for video informationsrc/whisper_module.py
: Whisper API client for transcriptionsrc/yt_audiophile.py
: Audio downloader for YouTube videostranscript_cache/
: Directory for caching video transcriptsdownloads/
: Directory for downloaded audio files, might be empty
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
WTFPL License
Credits
Icon: "https://www.flaticon.com/free-icons/subtitles" by Freepik - Flaticon