Transcribe Any YouTube Video with Gemini 2.5 Pro

I don't watch every tutorial end to end before I know if it's relevant. Watch time is expensive. The wrong hour spent on a video that doesn't match your problem is worse than a blunt summary that tells you to skip it.
Gemini 2.5 Pro can take a YouTube URL and return a clean summary with a short Python script — no manual download step, no local ffmpeg pipeline. Project with uv, GenAI SDK, URL in, summary out.
In the video#
- Set up a Python project with
uv - Add the Gemini SDK
- Send a YouTube URL to Gemini
- Get a concise summary back
Minimal path#
curl -LsSf https://astral.sh/uv/install.sh | sh
uv init my-project
cd my-project
uv add google-genai # package name may vary — follow current Gemini SDK docsThen a script in this shape:
from google import genai
from google.genai import types
client = genai.Client(api_key="YOUR_KEY")
youtube_url = "https://www.youtube.com/watch?v=V7nugySdrgw"
prompt = "Analyze the following YouTube video content. Provide a concise summary."
response = client.models.generate_content(
model="gemini-2.5-pro",
contents=types.Content(
parts=[
types.Part(text=prompt),
types.Part(file_data=types.FileData(file_uri=youtube_url)),
]
),
)
print(response.text)Get an API key from Google AI Studio, replace the key, run with uv run.
Model IDs move — pin whatever current Gemini 2.5 Pro ID the docs show the day you run this. The pattern (URL as file URI + text prompt) is the point.
Use it as a filter#
Summaries compress. They also drop nuance.
This is excellent for triage: Is this video about the problem I have? Should I watch the middle 20 minutes? Is it outdated marketing?
It is a bad replacement for watching when accuracy matters — legal claims, security advice, anything you'd bet a production incident on. Compress first. Verify when the stakes show up.
Takeaway#
Build the script once. Keep it in a tiny repo. Next time someone drops a 40-minute "must watch" link in Slack, spend thirty seconds on a summary before you spend forty minutes on hope.
AI engineering, weekly.
Join developers getting practical AI engineering in their inbox.