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.
- 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
-
Clone the repository:
git clone https://github.com/yourusername/youtube-summarizer.git cd youtube-summarizer
-
Install the required dependencies:
pip install -r requirements.txt
-
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
- 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.
- Note: you can copy the
-
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.
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.
You can also run the application with the included binary:
./youlama
- Streamlit
- Pytube
- Ollama
- YouTube Data API
- Python-dotenv
- pytubefix
- Gradio
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
Contributions are welcome! Please feel free to submit a Pull Request.
WTFPL License
Icon: "https://www.flaticon.com/free-icons/subtitles" by Freepik - Flaticon