Build a YouTube video summarizer
Summarise any YouTube video in seconds. Fetch the transcript with TranscriptAPI, pass it to your language model and return a short summary, key points and action items.
Get API keyRead the docscurl "https://api.transcriptapi.org/v1/youtube/transcript?video=dQw4w9WgXcQ" \ -H "X-API-Key: YOUR_API_KEY"

Why this is hard without an API
In practice, long videos are expensive to watch and hard to skim. Moreover, a summary saves time, but a summariser needs the full text of the video first.
Pasting captions by hand does not scale. Of course, an API gives your app the transcript on demand.
Four steps with TranscriptAPI
YouTube video summarizer: get the transcript
In fact, request the transcript for a video link. Besides, use the text output if you only need plain text.
YouTube video summarizer: Join the segments
Combine the segment text into one string. Likewise, for very long videos, split it into sections.
YouTube video summarizer: Prompt your model
Ask your LLM for a summary, key points or action items, and include the title for context.
YouTube video summarizer: Show the result
In short, return the summary with links to the original video and, if you like, to key timestamps.
YouTube video summarizer: See it in code
Of course, set your API key in the TRANSCRIPTAPI_KEY environment variable. Furthermore, the helper below is used in the example.
import os, requests
API = 'https://api.transcriptapi.org'
HEADERS = {'X-API-Key': os.environ['TRANSCRIPTAPI_KEY']}
def get_transcript(video, lang='en'):
r = requests.get(API + '/v1/youtube/transcript',
params={'video': video, 'lang': lang}, headers=HEADERS)
r.raise_for_status()
return r.json()
data = get_transcript('dQw4w9WgXcQ')
text = ' '.join(s['text'] for s in data['transcript'])
prompt = (
'Summarise this video titled ' + data['title'] + ' in 5 bullet points, '
'then list any action items.\n\n' + text
)
# send prompt to your LLM and return the answerIn fact, the transcript endpoint returns the video details and timed segments:
{
"video_id": "dQw4w9WgXcQ",
"video_url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"title": "Rick Astley - Never Gonna Give You Up",
"author": "Rick Astley",
"length_seconds": 213,
"language_code": "en",
"is_generated": false,
"available_languages": [
{ "language_code": "en", "name": "English", "is_generated": false }
],
"transcript": [
{ "text": "We're no strangers to love", "start": 18.64, "duration": 3.2 }
],
"cached": false
}YouTube video summarizer: why teams use it for this
Of course, no manual copy and paste: send a link, get structured text.
Overall, works for any language the video has captions in.
In short, segment timestamps let you add 'jump to' links to each key point.
Predictable cost: billed per transcript.
Tips for better results
Tip 1
Of course, for very long videos, summarise sections first and then summarise the summaries.
Tip 2
Overall, keep the title and channel in the prompt. It improves relevance.
Tip 3
Cache the summary by video ID so repeat requests cost nothing on your side.
What to plan before you build
First, list the formats you need and the people who will use them. Also, decide how often you will run the job. In addition, keep each output linked to its source video, so you can trace every claim back to the original words.
However, always review automatic output before it goes public. Meanwhile, keep a short style guide, so every result stays consistent. For example, set rules for summary length and the facts you must keep. In practice, the JSON format guide is a useful reference when you design the data format. Finally, test the flow on a few short videos first. Then, scale up once the results look right. Besides, log every failed request, so you can retry it later without losing any work. Therefore, a small pilot saves time, and it shows early which settings need a change. As a result, your team spends less effort on fixes and more on useful output for readers.
Frequently asked questions
Does it work for YouTube Shorts?
Yes. Shorts have their own endpoint with the same response shape.
Can I summarise podcasts the same way?
Yes. Besides, podcast transcripts published in the show's RSS feed are available from the podcast endpoint.
Do I need an API key to try it?
Yes, create a key in the dashboard and send it in the X-API-Key header.
Related use cases
Transcript to blog post
Turn a YouTube transcript into a blog post
Video chapters
In practice, create video chapters from a transcript
Lecture notes
Of course, create lecture notes and study guides from videos