DEV Community

Cover image for How to Summarize Any YouTube Video in 2 Minutes with Python
Vasyl Smutok
Vasyl Smutok

Posted on

How to Summarize Any YouTube Video in 2 Minutes with Python

Have you ever opened a YouTube video that is 30, 60, or even 120 minutes long and thought:

“This looks interesting, but I don't have time to watch the whole thing.”

There is a simple solution.

Instead of watching the entire video, we can get its transcript, send the text to an AI model, and ask it to summarize the content or answer specific questions about the video.

The workflow is simple:

YouTube → Transcript → AI → Summary

And with ytscrape, we can get the transcript without downloading the actual video.

What do we need?

We only need two things:

  • Python
  • ytscrape — a free, open-source Python library for scraping YouTube data

ytscrape can retrieve different types of YouTube data, including video information, comments, search results, and transcripts/captions.

You can install it with:

pip install ytscrape
Enter fullscreen mode Exit fullscreen mode

Or with uv:

uv add ytscrape
Enter fullscreen mode Exit fullscreen mode

Get the YouTube transcript

Let's say we have a YouTube video ID:

jNQXAC9IVRw
Enter fullscreen mode Exit fullscreen mode

We can use ytscrape to retrieve its transcript.

The important part is that we don't need the video file itself.

Instead, we get the text of what was said in the video.

The result looks something like this:

Start   Dur    Text

1.20    2.16   All right, so here we are, in front of the elephants
5.32    2.66   the cool thing about these guys is that they have really...
7.97    4.64   really really long trunks
12.62   1.75   and that's cool
14.42   1.31   (baaaaaaaaaaahhhh!!)
16.88   2.00   and that's pretty much all there is to say
Enter fullscreen mode Exit fullscreen mode

Now we have a text representation of the video.

And this is where AI becomes useful.

Send the transcript to AI

Once we have the transcript, we can send it to any AI model you like.

For example, you can use ChatGPT, Claude, Gemini, or an API from any other LLM provider.

Then simply ask:

Summarize this video.

Give me:
1. The main idea
2. The key points
3. The most important facts
4. The practical takeaways

Do not add information that is not present in the transcript.
Enter fullscreen mode Exit fullscreen mode

That's it.

Instead of spending an hour watching a video, you can get a short summary in a few minutes.

But summaries are only the beginning

Personally, I think the more interesting use case is not simply asking for a summary.

You can ask the AI specific questions about the video.

For example, imagine you're watching a 90-minute Python tutorial and you want to know whether the author talks about PostgreSQL.

You can ask:

Does this video mention PostgreSQL?

If yes:
- Explain the context
- Summarize what the author says about it
- Give me the approximate timestamp
Enter fullscreen mode Exit fullscreen mode

Or:

Does the video discuss Docker?

If yes, find every mention of Docker
and briefly explain the context of each one.
Enter fullscreen mode Exit fullscreen mode

Now you don't have to manually search through 90 minutes of video.

You can turn any video into a searchable knowledge base

Once you have the transcript, you can ask almost any question about the content.

For example:

Create notes

Turn this transcript into structured notes
with headings and bullet points.
Enter fullscreen mode Exit fullscreen mode

Find specific information

Does the author mention Kubernetes?

If yes, give me the timestamps
and explain the context.
Enter fullscreen mode Exit fullscreen mode

Extract tools and resources

Find all books, websites, libraries,
frameworks, and tools mentioned in the video.
Enter fullscreen mode Exit fullscreen mode

Create learning material

Create 10 questions based on this transcript
to test whether I understood the video.
Enter fullscreen mode Exit fullscreen mode

Get a quick TL;DR

Give me a TL;DR of this video
in no more than 10 bullet points.
Enter fullscreen mode Exit fullscreen mode

The whole pipeline

The entire process looks like this:

YouTube URL
     ↓
  ytscrape
     ↓
  Transcript
     ↓
     AI
     ↓
┌─────────────────┐
│    Summary      │
│   Questions     │
│   Key points    │
│    Analysis     │
└─────────────────┘
Enter fullscreen mode Exit fullscreen mode

The interesting part is that the AI doesn't need to process the actual video.

It only needs the transcript.

That makes the whole process much simpler.

Why use this approach?

You don't need to:

  • Download the video
  • Extract the audio
  • Run Whisper
  • Set up browser automation
  • Configure Selenium or Playwright
  • Get a YouTube API key

Instead:

Get the transcript → send it to an AI → ask questions.

ytscrape provides a simple way to retrieve YouTube data, including transcripts, so it can be a useful building block for this workflow.

One more interesting use case

Let's say someone sends you a 2-hour conference talk.

You don't necessarily want a summary.

You want to know:

“Does this video contain anything useful for my project?”

You can give the transcript to an AI and ask:

I'm working on a web scraping system using Python and PostgreSQL.

Analyze this transcript and tell me:

1. Whether the video contains information relevant to my project
2. Which parts are relevant
3. The approximate timestamps
4. What I can learn from those sections

Ignore everything that is not relevant.
Enter fullscreen mode Exit fullscreen mode

Now the AI becomes a filter between you and the video.

Instead of watching everything and looking for the information yourself, you can first ask AI whether the information is even there.

Conclusion

The next time you find an interesting 60-minute YouTube video, you don't necessarily have to spend 60 minutes watching it.

You can build a simple pipeline:

YouTube
   ↓
ytscrape
   ↓
Transcript
   ↓
AI
   ↓
Summary / Q&A / Analysis
Enter fullscreen mode Exit fullscreen mode

And the best part is that you can use the transcript for much more than just summaries.

You can ask:

“Is there anything in this video that I need to know?”

And get an answer in a couple of minutes instead of watching the entire video.

Check out ytscrape on GitHub if you want to try it yourself.

It can also serve as a simple building block for a much larger YouTube → AI research pipeline.

Top comments (0)