Loading...
Loading...
Extract transcripts from YouTube videos and generate comprehensive, detailed summaries using intelligent analysis frameworks
npx skill4agent add sickn33/antigravity-awesome-skills youtube-summarizeryoutube-transcript-api# Check if youtube-transcript-api is installed
python3 -c "import youtube_transcript_api" 2>/dev/null
if [ $? -ne 0 ]; then
echo "⚠️ youtube-transcript-api not found"
# Offer to install
fi
# Check Python availability
if ! command -v python3 &>/dev/null; then
echo "❌ Python 3 is required but not installed"
exit 1
fiyoutube-transcript-api is required but not installed.
Would you like to install it now?
- [ ] Yes - Install with pip (pip install youtube-transcript-api)
- [ ] No - I'll install it manuallypip install youtube-transcript-apipython3 -c "import youtube_transcript_api; print('✅ youtube-transcript-api installed successfully')"echo "[████░░░░░░░░░░░░░░░░] 20% - Step 1/5: Validating URL"╔══════════════════════════════════════════════════════════════╗
║ 📹 YOUTUBE SUMMARIZER - Processing Video ║
╠══════════════════════════════════════════════════════════════╣
║ → Step 1: Validating URL [IN PROGRESS] ║
║ ○ Step 2: Checking Availability ║
║ ○ Step 3: Extracting Transcript ║
║ ○ Step 4: Generating Summary ║
║ ○ Step 5: Formatting Output ║
╠══════════════════════════════════════════════════════════════╣
║ Progress: ██████░░░░░░░░░░░░░░░░░░░░░░░░ 20% ║
╚══════════════════════════════════════════════════════════════╝https://www.youtube.com/watch?v=VIDEO_IDhttps://youtube.com/watch?v=VIDEO_IDhttps://youtu.be/VIDEO_IDhttps://m.youtube.com/watch?v=VIDEO_ID# Extract video ID using regex or URL parsing
URL="$USER_PROVIDED_URL"
# Pattern 1: youtube.com/watch?v=VIDEO_ID
if echo "$URL" | grep -qE 'youtube\.com/watch\?v='; then
VIDEO_ID=$(echo "$URL" | sed -E 's/.*[?&]v=([^&]+).*/\1/')
# Pattern 2: youtu.be/VIDEO_ID
elif echo "$URL" | grep -qE 'youtu\.be/'; then
VIDEO_ID=$(echo "$URL" | sed -E 's/.*youtu\.be\/([^?]+).*/\1/')
else
echo "❌ Invalid YouTube URL format"
exit 1
fi
echo "📹 Video ID extracted: $VIDEO_ID"❌ Invalid YouTube URL
Please provide a valid YouTube URL in one of these formats:
- https://www.youtube.com/watch?v=VIDEO_ID
- https://youtu.be/VIDEO_ID
Example: https://www.youtube.com/watch?v=dQw4w9WgXcQecho "[████████░░░░░░░░░░░░] 40% - Step 2/5: Checking Availability"from youtube_transcript_api import YouTubeTranscriptApi, TranscriptsDisabled, NoTranscriptFound
import sys
video_id = sys.argv[1]
try:
# Get list of available transcripts
transcript_list = YouTubeTranscriptApi.list_transcripts(video_id)
print(f"✅ Video accessible: {video_id}")
print("📝 Available transcripts:")
for transcript in transcript_list:
print(f" - {transcript.language} ({transcript.language_code})")
if transcript.is_generated:
print(" [Auto-generated]")
except TranscriptsDisabled:
print(f"❌ Transcripts are disabled for video {video_id}")
sys.exit(1)
except NoTranscriptFound:
print(f"❌ No transcript found for video {video_id}")
sys.exit(1)
except Exception as e:
print(f"❌ Error accessing video: {e}")
sys.exit(1)| Error | Message | Action |
|---|---|---|
| Video not found | "❌ Video does not exist or is private" | Ask user to verify URL |
| Transcripts disabled | "❌ Transcripts are disabled for this video" | Cannot proceed |
| No transcript available | "❌ No transcript found (not auto-generated or manually added)" | Cannot proceed |
| Private/restricted video | "❌ Video is private or restricted" | Ask for public video |
echo "[████████████░░░░░░░░] 60% - Step 3/5: Extracting Transcript"from youtube_transcript_api import YouTubeTranscriptApi
video_id = "VIDEO_ID"
try:
# Try to get transcript in user's preferred language first
# Fall back to English if not available
transcript = YouTubeTranscriptApi.get_transcript(
video_id,
languages=['pt', 'en'] # Prefer Portuguese, fallback to English
)
# Combine transcript segments into full text
full_text = " ".join([entry['text'] for entry in transcript])
# Get video metadata
from youtube_transcript_api import YouTubeTranscriptApi
transcript_list = YouTubeTranscriptApi.list_transcripts(video_id)
print("✅ Transcript extracted successfully")
print(f"📊 Transcript length: {len(full_text)} characters")
# Save to temporary file for processing
with open(f"/tmp/transcript_{video_id}.txt", "w") as f:
f.write(full_text)
except Exception as e:
print(f"❌ Error extracting transcript: {e}")
exit(1)echo "[████████████████░░░░] 80% - Step 4/5: Generating Summary"# Use the transcript file as input to the AI prompt
TRANSCRIPT_FILE="/tmp/transcript_${VIDEO_ID}.txt"
# The AI agent will:
# 1. Read the transcript
# 2. Apply the STAR + R-I-S-E summarization framework
# 3. Generate comprehensive Markdown output
# 4. Structure with headers, lists, and highlights
Read "$TRANSCRIPT_FILE" # Read transcript into contextecho "[████████████████████] 100% - Step 5/5: Formatting Output"# [Video Title]
**Canal:** [Channel Name]
**Duração:** [Duration]
**URL:** [https://youtube.com/watch?v=VIDEO_ID]
**Data de Publicação:** [Date if available]
## 📝 Detailed Summary
### [Topic 1]
[Comprehensive explanation with examples, data, quotes...]
#### [Subtopic 1.1]
[Detailed breakdown...]
### [Topic 2]
[Continued detailed analysis...]
## 📚 Concepts and Terminology
- **[Term 1]:** [Definition and context]
- **[Term 2]:** [Definition and context]
## 📌 Conclusion
[Final synthesis and takeaways]
### **Example 2: Missing Dependency**
**User Input:**
**Skill Response:**
**User selects "Yes":**
```bash
$ pip install youtube-transcript-api
Successfully installed youtube-transcript-api-0.6.1
✅ Installation complete! Proceeding with video summary...claude> summarize youtube video www.youtube.com/some-video❌ Invalid YouTube URL format
Expected format examples:
- https://www.youtube.com/watch?v=VIDEO_ID
- https://youtu.be/VIDEO_ID
Please provide a valid YouTube video URL.
**Save Options:**
Welcome to this comprehensive tutorial on machine learning fundamentals. In today's video, we'll explore the core concepts that power modern AI systems...