While attempting to write my own script, I found that there are many websites which offer YouTube summaries, which are probably an easier solution. For example (not affiliated) https://www.easemate.ai/video-summary It even allows you to ask questions about the transcript.
I also found a Python library for fetching YouTube video transcripts, but some issue mentioned that they got banned, so out of caution, I implemented my summary script as a JavaScript bookmarklet instead. It will probably break on the next YouTube update, so I am not sure how useful it is. Also, you have to set your own API key (and maybe URL). I used Groq (not to be confused with Grok), because it is free and very fast.
I also found a Python library for fetching YouTube video transcripts, but some issue mentioned that they got banned, so out of caution, I implemented my summary script as a JavaScript bookmarklet instead. It will probably break on the next YouTube update, so I am not sure how useful it is. Also, you have to set your own API key (and maybe URL). I used Groq (not to be confused with Grok), because it is free and very fast.