How I Created a Chrome Extension that Summarizes YouTube Videos Using ChatGPT

Laurentiu Raducu
3 min readFeb 8, 2023

--

Photo by Andrea De Santis on Unsplash

As a content creator, you know the importance of keeping up with the latest trends and events in your industry. Whether you’re creating YouTube videos or writing blog posts, staying informed is key to creating relevant and engaging content. But with so many videos and news stories being published every day, it can be overwhelming to keep up with all of them. This is where YouTube GPT Summarizer comes in.

YouTube GPT Summarizer is a Chrome extension that leverages the power of ChatGPT to summarize YouTube videos in just a few sentences. This extension makes it easy to quickly understand what a video is about without having to watch it in full. Whether you’re in a hurry or just want to save time, YouTube GPT Summarizer has you covered.

The YouTube GPT Summarizer extension is simple to use. All you need to do is have a YouTube video open on one tab, right-click on the page and select Summarize from the context menu. The summarization will be generated in seconds, allowing you to quickly read and understand what the video is about.

The source code for the YouTube GPT Summarizer extension is available on GitHub, making it easy for developers to use and modify the code to fit their specific needs. Whether you’re a content creator or a developer, YouTube GPT Summarizer is a tool that can help you save time and stay informed.

Explaining the Code

The code for the extension can be split into two parts: the extension itself, which only consists of client-side code, and the server. The code for the server sets up a server using Express framework and starts the server on port 3000. The server uses middlewares such as cors and body-parser to handle incoming requests. It utilizes the ChatGPTAPIBrowser class from the chatgpt package to send and receive messages from the OpenAI GPT-3 API. The code initializes a session with the API and creates a new instance of the Conversation class, which contains methods for sending messages and summarizing a YouTube video.

The server listens to the POST request on the endpoint /youtube-summary and summarizes the YouTube video in 3 sentences. The message received in the request is passed to the Conversation class's summarize method to get a summarized response. The response from the API is passed through the plugin parsers to format the response before sending it back to the client. The code also includes a configure function that collects the rules and parsers from the plugins and trains the ChatGPT on these rules. The server starts by calling the start function.

If you are curious about the code for the extension itself, check out my blog post where I post the details on how I built it.

YouTube GPT Summarizer is a must-have tool for anyone who wants to stay on top of the latest trends and events in their industry. Whether you’re a content creator or a developer, this extension will help you quickly understand what a video is about, allowing you to stay informed and create engaging content. So why wait? Give it a try and join the revolution of efficient video consumption!

--

--