Summarize the transcript of a YouTube video using ChatGPT

Summarize the transcript of a YouTube video using ChatGPT

20 December, 2022 2 min read
ChatGPT, LLM, video, transcript, Python

Here’s how to summarize any YouTube video with a transcript for free using ChatGPT without paying for the Summarize browser extension.

The “Summarize” extension for Google Chrome uses ChatGPT to summarize a YouTube video with a single click on a button placed underneath the video viewport on YouTube. The free plan gives you a small number of uses per day.

Unfortunately, the free plan is limited to videos with at least 30000 views. Out of curiosity I wanted to test out Summarize on a speech I gave back in 2019 with currently only 10487 views. Also, I’m not a big fan of artificial scarcity.

Here’s how to replicate Summarize’s functionality with open source software and the free tier of ChatGPT:


Step 1

Find the video you want and copy its URL, e.g.:

https://www.youtube.com/watch?v=1Gyjj8pyi_0

Step 2

Use yt-dlp to download the subtitles of the video in JSON3 format:

yt-dlp --write-subs en --sub-format json3 "YOUTUBE URL GOES HERE"

You now have a file with the extension .json3.

Step 3

Use jq , sed and tr to extract the transcript:

jq ".events[] | .segs[] | .[]" *.json3 | sed -e 's/\\n/ /g' -e 's/\n/ /g' -e 's/"//g' | tr '\n' ' ' > transcript.txt

You now have a transcript.txt file.

Step 4

Prompt ChatGPT accordingly, followed by the contents of transcript.txt. The following is not the perfect prompt, but is good enough for my use:

I will provide you with the transcript of a presentation. I want you to extract the main sections and arguments of the presentation along its duration. Then, list them in the sequence they were presented in and in separate paragraphs. Here’s the transcript:

Step 5

Enjoy the video summary!


Potential improvements:

  1. Perhaps I could retain the timestamps of the JSON file and ask ChatGPT to summarize what was said every X minutes into the presentation.
  2. Potentially automate the GPT inquiry through OpenAI’s API.