AndreasMarcec / gpt_summary

Command-line tool for downloading videos and summarize their content to text or speech.
Other
6 stars 0 forks source link

YouTube Audio Summarizer

This project provides a command-line tool for downloading YouTube videos, extracting their audio, splitting the audio into manageable chunks, transcribing the audio using OpenAI's Whisper API, summarizing the transcription using OpenAI's GPT-4, and optionally converting the summary back to speech.

Features

Prerequisites

Before you begin, ensure you have met the following requirements:

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/YouTube-Audio-Summarizer.git
    cd YouTube-Audio-Summarizer
  2. Install the dependencies:

    pip install -r requirements.txt
  3. Set up your OpenAI API key:

    Create a .env file in the root directory of the project and add your OpenAI API key:

    OPENAI_KEY=your_openai_api_key
  4. Ensure FFmpeg is installed:

    Follow the instructions on the FFmpeg website to install FFmpeg on your system.

Usage

To use this tool, run the summarize command with the necessary options:

python main.py summarize --url <YouTube-URL> [--log <log-level>] [--clean] [--tts]

Options

Example

Download, transcribe, and summarize a YouTube video:

python main.py summarize --url https://www.youtube.com/watch?v=dQw4w9WgXcQ

Download, transcribe, summarize, and convert the summary to speech:

python main.py summarize --url https://www.youtube.com/watch?v=dQw4w9WgXcQ --tts

How It Works

  1. Download Audio: The tool downloads the audio from the provided YouTube URL using yt_dlp.
  2. Split Audio: The downloaded audio is split into smaller chunks if necessary.
  3. Transcription: Each audio chunk is sent to OpenAI's Whisper API for transcription.
  4. Summarization: The transcriptions are summarized into concise bullet points using OpenAI's GPT-4.
  5. Text-to-Speech (optional): The final summary can be converted to speech using OpenAI's text-to-speech API.

Logging

The tool provides comprehensive logging at different levels (INFO, ERROR, DEBUG, CRITICAL). By default, the logging level is set to INFO. You can change the logging level using the --log option.

Contributing

Contributions are welcome! Please fork the repository and create a pull request with your changes. Make sure to update the documentation as needed.

License

This project is licensed under the MIT License. See the LICENSE file for more information.

Feel free to open an issue or contact us if you have any questions or feedback.