This project provides a script to download a YouTube video, Read its transcript, capture scenes from the video, summarize the transcript using OpenAI's GPT-4, and compile everything into a PDF document. Each page of the PDF contains a scene image, a summary of the transcript for that scene, and the full transcript text.
- Python 3.6 or higher
- pip (Python package installer)
- OpenAI API key
-
Clone this Repository
-
Create a Virtual Environment (Optional but Recommended)
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Install Dependencies
pip install -r requirements.txt
Create a
requirements.txt
file with the following content:opencv-python pytube fpdf tqdm openai
-
Set Up OpenAI API Key
Replace
'YOUR_OPENAI_API_KEY'
in the script with your actual OpenAI API key.openai.api_key = 'YOUR_OPENAI_API_KEY'
-
Set YouTube Video URL
Replace the YouTube URL in the script with the desired video URL.
youtube_url = 'https://www.youtube.com/watch?v=IpGxLWOIZy4' # Replace with your YouTube URL
-
Prepare Transcript File Install chrome extention youtube summary from the follwing link
https://chromewebstore.google.com/detail/youtube-summary-with-chat/nmmicjeknamkfloonkhhcjmomieiodli
Create a
transcript.txt
file in the same directory as the script, and copy the transcript using the above extention on the you tube page and paste on the file.Example
transcript.txt
:A Friendly Introduction to Machine Learning - YouTube (00:01) Hi and welcome to the machine learning course (00:35) machine learning is about...
-
Run the Script
python CreateLectureNotes.py
-
Output
The script will generate a PDF file named
lecture_notes.pdf
in the current directory. This file contains the captured scenes, summaries, and full transcript text for each segment of the video.