Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
[flagged] How to summarize YouTube videos using artificial intelligence (implementing.substack.com)
75 points by MarcoMoauro on Feb 14, 2024 | hide | past | favorite | 60 comments


Can't you just paste the video URL into https://gemini.google.com/ with the prompt "Summarize this video" ?

Example (Gemini free tier):

    Summarize this video: https://www.youtube.com/watch?v=7nsE4MyqQf4

The video is about a Cloudflare outage caused by a poorly written regular expression.

The regular expression was part of a web application firewall rule designed to detect cross-site scripting attempts. The rule was supposed to match JavaScript keywords, suspicious characters, and strings with equal signs, which are potential indicators of malicious URL query strings. However, the regular expression was written in a way that caused it to match an unexpectedly large number of strings. This led to the web application firewall consuming 100% of CPU on all of Cloudflare's servers, which caused a global outage.

The video goes into detail about how the regular expression worked and why it was so inefficient. It also discusses the steps that Cloudflare took to fix the problem and prevent it from happening again.

Here are some of the key points from the video:

The regular expression used a non-capturing group, which caused it to match many more strings than it was intended to. The regular expression used a dot star, which matches any character zero or more times. This can be very inefficient if the regular expression is not carefully written. The regular expression used backtracking, which is a technique that can be very slow if the regular expression is not carefully written. The video concludes with a warning about the dangers of using regular expressions without understanding how they work. It also suggests that people should use simpler tools, such as string contains, whenever possible.


I get mixed results when asking Gemini to summarize videos. Sometimes it works perfectly, other times it just says I have an invalid link. My hypothesis was that YouTube creators had some sort of option to opt out of AI-related tooling, but maybe there's more to the story.

Edit: here's a random example, I picked a recent penguinz0 video (https://m.youtube.com/watch?v=UbXYzFEh-bw&pp=ygUJcGVuZ3Vpbno...) and it just gives me a message saying "I'm just a LLM I can't help you".


I get:

"I'm sorry, but I'm unable to access this YouTube content. This is possible for a number of reasons, but the most common are: the content isn't a valid YouTube link, the video is potentially unsafe, the content does not have a captions file that I can read, or the video language is currently not supported."


Go to settings -> extensions and make sure youtube is enabled Maybe it only works for gemini advanced


Post a link to the conversation or YouTube URL you are trying to summarize?


OK, yesterday it didn't work, but today, without any other activity in between, it worked:

"Pretty please summarize this video: https://www.youtube.com/watch?v=7nsE4MyqQf4"

"The video is about a Cloudflare outage caused by a poorly written regular expression. ..." (the answer is quite long and detailed)

https://g.co/gemini/share/fa9e40ed7e74


I've noticed that typically Gemini seems to fail on longer Youtube videos, I think I've had trouble for anything longer than 30 mins or so. Shorter videos (which have captions) seem fine. Are you seeing this as well?


Yes, I think there's an issue when the video doesn't have captions.


Seems Gemini is blocking this: "I apologize that I can't access and process videos directly at this time."


Post a link to the conversation or YouTube URL you are trying to summarize?


Both Gemini and ChatGPT 3.5 refused to summarize this video

https://www.youtube.com/watch?v=0YY7K7Xa5rE&ab_channel=Ethan...


Kagi's Universal Summarizer produced this summary. I wonder why a relatively smaller player can get it working but the "big boys" cannot.

The video analyzes whether more expensive eggs are worth it by testing the claims that they are more ethical, healthier, and tastier. Through research and blind taste tests, the author found that expensive pasture-raised or free-range eggs come from hens that are treated more humanely. While there are some minor nutritional differences between egg types, the author determined they are insignificant unless eggs are a major part of one's diet. Blind taste tests revealed only subtle differences in flavor and texture between expensive and conventional eggs. In conclusion, while expensive eggs may be slightly better for hens and sight, their higher cost is hard to justify solely based on nutrition or taste.


Wow, that summary is really good. Thanks


I got a summary on both Gemini Pro and Gemini Advanced:

    Summarize this video: https://www.youtube.com/watch?v=0YY7K7Xa5rE
#Gemini Pro (free tier):

Here is a summary of the video Are Expensive Eggs Worth It? by Ethan Chlebowski:

The video discusses the different factors that affect the price of eggs, including the egg size and grades, and the egg certifications. It also does a blind taste test to see if there is a difference in taste between expensive eggs and cheaper eggs.

Here are the key takeaways from the video: Here is a summary of the video [Are Expensive Eggs Worth It?](https://www.youtube.com/watch?v=0YY7K7Xa5rE) by Ethan Chlebowski:

The video discusses the different factors that affect the price of eggs, including the egg size and grades, and the egg certifications. It also does a blind taste test to see if there is a difference in taste between expensive eggs and cheaper eggs.

Here are the key takeaways from the video:

* *Are expensive eggs more ethical and Humane?* Yes, there are clear differences in how chickens are treated when it comes to laying eggs. If you want to ensure the highest standard of living for chickens, look for pasture-raised certified Humane eggs.

* *Are expensive eggs healthier for you?* There can be small macro and micronutrient differences between different egg types, but you would need to evaluate the rest of your diet and lifestyle to see if that makes sense for you.

* *Do expensive eggs taste better?* No, there may be very minor differences in taste, texture, and Aroma, but nothing significant. However, there is a clear difference in sight, which may matter depending on what you are making.

Overall, the speaker concludes that expensive eggs are not necessarily worth it in terms of taste or health benefits. However, if you are concerned about the ethical treatment of chickens, you may want to consider buying pasture-raised eggs.

#Gemini Advanced:

In this video, Ethan Chlebowski investigates whether expensive eggs are worth it. He covers the following aspects: \ Are expensive eggs more ethical and Humane?

Are expensive eggs healthier for you?

Do expensive eggs taste better?

Are expensive eggs more ethical and Humane?

There are clear differences in how chickens are treated depending on the egg production method. More expensive eggs often come from chickens that are raised in more humane conditions, such as pasture-raised or cage-free. However, there are also certifications and labels that may not necessarily mean what you think they do. Ultimately, the decision of whether or not to buy more expensive eggs based on ethics is up to you.

Are expensive eggs healthier for you?

There can be small differences in the nutrient content of eggs from different production methods. However, it is difficult to say definitively whether these differences are significant enough to impact your health.

Do expensive eggs taste better?

Ethan conducted taste tests to compare expensive eggs to less expensive eggs. He found that there may be very minor differences in taste, texture, and Aroma, but they were not significant enough to say that one type of egg was definitively better than the other.

Overall, Ethan concludes that whether or not expensive eggs are worth it depends on your individual priorities. If you are concerned about animal welfare, you may be willing to pay more for eggs from chickens that are raised in more humane conditions. However, if you are on a tight budget, you may not find that the taste or nutritional benefits of expensive eggs justify the cost.

I hope this summary is helpful!


Written article that takes two minutes to read -> half hour YT vid with 95% fluff against a background of bookshelves with a succulent, a toy robot, and a mildly interesting light fitting -> AI -> text summary that takes two minutes to read.


I blame YouTube, and (separately) the ad-supported model. I don't like the trend of turning articles into videos in the first place, but without the fact that the longer you make a video the more ads you can stuff into it (and YouTube's crazy amount of ads), I think most videos would be much shorter, simply because long videos take more effort to produce.

YouTube Premium doesn't help much here because (1) as long as there is a significant amount of users watching ads, YouTube will still incentivize creators to make longer videos and (2) the subscription model is a bad deal for everyone but YouTube themselves (users only rent their content instead of "own" (which is still a better deal for almost all values of "item own"), creators get a tiny slice of a fixed-size pie).


Why are you not just using yt-dl to download the subtitles? Using yt-dl you can also fallback in case the subtitles don't exist and instead download the videos, convert them to mp3, and then run them through whisper[1] locally.

[1] - https://github.com/openai/whisper


That's still way more work than is necessary, unless you absolutely need to summarize locally for some reason.

You can just paste the URL to gemini.google.com with prompt "Summarize this video."


I just get

"I don't have enough information to do that. I'm a large language model, able to communicate in response to a wide range of prompts and questions, but my knowledge about that specific video is limited. Is there anything else I can do to help?"


Post a link to the conversation or YouTube URL you are trying to summarize?


Lots of videos don't have subtitles for various reasons.


Wouldn't that mean actually more work than even watching the video? The point of such a helper tool is to spare time, not to have fun with toys. I mean nothing wrong with toys but hardly a help in this case.


I'm interested in 1-2h long videos of people talking about interesting stuff. But I don't have time to watch them all.

It'd be great to have a tool to get accurate transcripts. The YouTube subtitles can be easily downloaded, but aren't readable on their own. They often lack even basic punctuation or sentence structure.

It'd be even more great to get good condensed transcripts, or event targeted condensed transcripts of the things I'm interested in in that particular video.


I think you can get pretty accurate transcripts now with off the shelf tooling. Speaker diarization included.


Yeah, it seems local Whisper(-like) tools are pretty good now. Can you recommend any in particular for this?


Deepgram is pretty good if you want speaker diarisation. I think most of the others are comparable.


Dare I add that sometimes the subtitles are auto-generated and words shown are wrong.


Thanks, that's also an issue there.


The Chrome extension Harpa will do this by fetching the transcript and posting it to your ChatGPT session. Takes 3 seconds.


I had no idea about this extension. Now I've tried it, and from a quick test it does seem to indeed work. Thank you for sharing.


A bit tongue in cheek, but I summarized your article using artificial intelligence ;)

P.S. GPT 3.5 has a 16k context window now

--- AI Generated summary:

Marco's newsletter introduces a tutorial on developing a system in Node.js to generate summaries from YouTube videos using OpenAI's completions API. The architecture involves extracting text from videos and then creating text summaries. The process includes scraping subtitles, chunking text, and recursively summarizing using OpenAI. The system is built using Yarn, Node.js, Axios, and other libraries. The CLI allows users to summarize videos by providing the YouTube link and language code. Node.js is favored due to its flexibility, efficiency, and compatibility with the ChatGPT API. The project code and details are available on Marco's GitHub repository.

1: What prerequisites do I need to know before using ChatGPT API and Node.js for summarizing YouTube videos?

A: Before using ChatGPT API and Node.js for summarizing YouTube videos, you need to have Yarn and Node.js installed, familiarity with ES6 syntax, knowledge of HTTP calls using Axios, understanding of handling queues for promises, and the ability to work with interactive command line tools using yargs.

2: How can the ChatGPT API be applied to summarize the content of a YouTube video?

A: The ChatGPT API can be applied to summarize the content of a YouTube video by first extracting text from the video, chunking the text into manageable parts, and then using the recursive summarization technique to generate a summary by submitting prompts to the completions API. This process involves managing multiple promises concurrently to avoid rate-limiting issues and slower response times.

3: Why is Node.js a preferred choice for implementing a project that summarizes YouTube videos with the ChatGPT API?

A: Node.js is a preferred choice for implementing a project that summarizes YouTube videos with the ChatGPT API due to its efficiency in handling asynchronous operations, ease of building scalable applications, compatibility with various libraries and tools required for the project, and support for modern JavaScript features like ES6 syntax.


I wish this was automatic for HN posts. (Of course optional)



How to summarize YouTube videos using artificial intelligence.

I often miss videos I like because I'm busy with commitments or other matters.

In this issue of Implementing I explain how to make a system from scratch that starting from the link of a YouTube video generates a text summary.

https://implementing.substack.com/p/how-to-summarize-youtube...

Let me know what you think!


How does this approach differ from pasting the URL to gemini.google.com with prompt "Summarize this video"?


I wrote something similar using python if anyone is interested:

https://www.jerpint.io/blog/yougptube/

I also made a YouTube video about it and summarized it using the tool:

https://m.youtube.com/watch?v=WtMrp2hp94E

> The video demonstrates how to use open AI's speech to text model, ChaiGPT, and Librosa to automate the process of summarizing YouTube videos. The tool can provide both long and short summaries of the videos and is best suited for videos with a lot of audio. The examples given in the video include summaries of a video on stretching and a conversation on AI alignment and the future of AI


That's nifty but not really what I want from a summary. I learned what the video is about, but I didn't learn the things I would learn by watching.

If the AI could be prompted to give a transcript minus the usual chatty fluff, that would be perfect.


The code + prompts is all open sourced so of course you could modify it to your liking, it was a fun weekend project and nothing more


Well thanks for doing it! I'll experiment with the prompts first, if it works out I might do that.


Or better yet, convert the transcript into a well-structured article.


You can just paste the URL to gemini.google.com with prompt "Summarize this video."


Ah didn’t know that, definitely was not possible when I made the video, but also it’s fun to hack these things together :)


Definitely a useful learning experience either way. Thanks for taking the time to share what you learned with others :)


I am doing similar thing (for fun) using deno. I posted the entire code on Twitter: https://twitter.com/jjude/status/1757604342310310285

(Code is derived from another open source repository: https://github.com/franekmagiera/just-tell-me/)

P.S: I am just surprised how much our coding infra has evolved. I still remember typing 120 lines of code from Charles Petzold book just to pop up a hello world dialog box. Today in less than 30 lines of code, I can fetch Youtube captions and summarise it.


Interesting. Wonder what happens when you combine search and summarization? https://open.substack.com/pub/jdsemrau/p/searching-youtube-w...


I've long found YouTube to search audio, text, and objects in videos.


YouTube has endpoints in their Data API to list and download captions: https://developers.google.com/youtube/v3/docs/captions


This tech would be useful in enterprises e.g. summarise the town hall, drop it in my inbox.


I believe Microsoft has the same opinion as you, and has done similar using Teams: https://support.microsoft.com/en-gb/office/meeting-recap-in-...


Gemini does this now.


so, I just tried this, and Gemini answered "I don't have enough information to do this". BUT, then I checked the "drafts", and one of the 3 drafted answers actually contains a short summary of the video. What the hell is happening here?


Post a link to your conversation? I just tried it and it worked (posted an example in a separate comment).


I was hoping you were going to share a great prompt. All my efforts with prompting to get the perfect summary have left me wanting.


Can't you just ask GPT to give you a summary? Here's my prompt for 3.5, it's not very sophisticated.

  System: You are a helpful AI assistant who follows instructions to the letter. You will generate a summary of the article.
  Article: {ARTICLE}
  User: Summarize the previous text in one paragraph. Include as many topics as possible, make every word count. Create only one single summary and stop once you are done.


I just using Kagi


Hopefully they will eventually integrate SponsorBlock, otherwise language model seemlessly incorporates ads into summary...


For the text extraction I found the quality of whisper to be better in most videos than the subtitles.


Doesn't Gemini does that for you?


so, I just tried this, and Gemini answered "I don't have enough information to do this". BUT, then I checked the "drafts", and one of the 3 drafted answers actually contains a short summary of the video. What the hell is happening here?


I use https://youtubetranscript.com and then paste into chatgpt. There's also https://www.you-tldr.com but they are a bit slow and do only shorter videos unless you pay.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: