YouTube Summarizer Skill
Automatically fetch transcripts from YouTube videos, generate structured summaries, and deliver full transcripts to messaging platforms.
When to Use
Activate this skill when:
- User shares a YouTube URL (youtube.com/watch, youtu.be, youtube.com/shorts)
- User asks to summarize or transcribe a YouTube video
- User requests information about a YouTube video's content
Dependencies
Required: yt-dlp must be installed and available in PATH.
Check if yt-dlp is available:
which yt-dlp || echo "yt-dlp not found"
If not installed, you can install it:
pip3 install yt-dlp
Workflow
1. Detect YouTube URL
Extract video ID from these patterns:
https://www.youtube.com/watch?v=VIDEO_IDhttps://youtu.be/VIDEO_IDhttps://www.youtube.com/shorts/VIDEO_ID- Direct video ID:
VIDEO_ID(11 characters)
2. Fetch Video Metadata
Get video information using yt-dlp:
yt-dlp --dump-json --skip-download "VIDEO_URL" 2>/dev/null | head -c 10000
Extract from the JSON:
title- Video titleuploader- Channel nameview_count- View countupload_date- Publication date (YYYYMMDD format)duration- Video duration in seconds
3. Fetch Transcript
Option A: Use yt-dlp to get auto-generated subtitles (if available)
yt-dlp --list-subs --skip-download "VIDEO_URL" 2>/dev/null
Download subtitles if available:
yt-dlp --write-auto-sub --sub-lang en --skip-download --sub-format txt -o "/tmp/yt_%(id)s.%(ext)s" "VIDEO_URL" 2>/dev/null
Read the subtitle file:
cat /tmp/yt_VIDEO_ID.en.txt 2>/dev/null || cat /tmp/yt_VIDEO_ID.txt 2>/dev/null
Option B: If yt-dlp subtitles fail, inform user:
"I couldn't retrieve the transcript for this video. This may be because:
- The video doesn't have captions/subtitles enabled
- The video owner has disabled auto-generated captions
- The video is restricted or private
You can try:
- Using YouTube's built-in transcript feature (click '...' below the video → 'Show transcript')
- Trying a different video that has captions enabled"
4. Process the Data
Clean up the transcript text:
- Remove timestamps if present
- Remove duplicate lines
- Join lines into paragraphs
Extract full text for summarization.
5. Generate Summary
Create a structured summary using this template:
📹 **Video:** [title]
👤 **Channel:** [author] | 👁️ **Views:** [views] | 📅 **Published:** [date]
**🎯 Main Thesis:**
[1-2 sentence core argument/message]
**💡 Key Insights:**
- [insight 1]
- [insight 2]
- [insight 3]
- [insight 4]
- [insight 5]
**📝 Notable Points:**
- [additional point 1]
- [additional point 2]
**🔑 Takeaway:**
[Practical application or conclusion]
Aim for:
- Main thesis: 1-2 sentences maximum
- Key insights: 3-5 bullets, each 1-2 sentences
- Notable points: 2-4 supporting details
- Takeaway: Actionable conclusion
6. Save Full Transcript (Optional)
If the user wants the full transcript saved:
Create the transcripts directory:
mkdir -p ~/.smart_bot/transcripts
Save the transcript:
cat > ~/.smart_bot/transcripts/YYYY-MM-DD_VIDEO_ID.txt << 'EOF'
Video: [title]
Channel: [author]
URL: [video_url]
Date: [date]
---
[Full transcript text]
EOF
7. Reply with Summary
Send the structured summary as your response to the user.
If you saved the transcript file, mention its location.
Error Handling
If yt-dlp is not installed:
# Try to install it
pip3 install yt-dlp
If transcript fetch fails:
- Check if video has captions enabled
- Try with
--sub-lang enfallback if requested language unavailable - Inform user that transcript is not available and suggest alternatives:
- Manual YouTube transcript feature
- Video may not have captions
- Try a different video
If video ID extraction fails:
- Ask user to provide the full YouTube URL or video ID
If video is restricted/private:
- Inform user that the video cannot be accessed
- Ask them to check if the video is publicly available
Quality Guidelines
- Be concise: Summary should be scannable in 30 seconds
- Be accurate: Don't add information not in the transcript
- Be structured: Use consistent formatting for easy reading
- Be contextual: Adjust detail level based on video length
- Short videos (<5 min): Brief summary
- Long videos (>30 min): More detailed breakdown
Notes
- yt-dlp is a reliable tool that works on most YouTube videos
- Some videos may not have captions available
- Transcript quality depends on YouTube's auto-generated captions or manual captions
- Auto-generated captions may have errors, especially for technical terms or non-English content
Converted and distributed by TomeVault — claim your Tome and manage your conversions.