feat: add 4 universal skills from cli-ai-skills
- Add audio-transcriber skill (v1.2.0): Transform audio to Markdown with Whisper - Add youtube-summarizer skill (v1.2.0): Generate summaries from YouTube videos - Update prompt-engineer skill: Enhanced with 11 optimization frameworks - Update skill-creator skill: Improved automation workflow All skills are zero-config, cross-platform (Claude Code, Copilot CLI, Codex) and follow Quality Bar V4 standards. Source: https://github.com/ericgandrade/cli-ai-skills
This commit is contained in:
65
skills/youtube-summarizer/scripts/extract-transcript.py
Normal file
65
skills/youtube-summarizer/scripts/extract-transcript.py
Normal file
@@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Extract YouTube video transcript
|
||||
Usage: ./extract-transcript.py VIDEO_ID [LANGUAGE_CODE]
|
||||
"""
|
||||
|
||||
import sys
|
||||
from youtube_transcript_api import YouTubeTranscriptApi, TranscriptsDisabled, NoTranscriptFound
|
||||
|
||||
def extract_transcript(video_id, language='en'):
|
||||
"""Extract transcript from YouTube video"""
|
||||
try:
|
||||
# Try to get transcript in specified language with fallback to English
|
||||
transcript = YouTubeTranscriptApi.get_transcript(
|
||||
video_id,
|
||||
languages=[language, 'en']
|
||||
)
|
||||
|
||||
# Combine all transcript segments
|
||||
full_text = " ".join([entry['text'] for entry in transcript])
|
||||
return full_text
|
||||
|
||||
except TranscriptsDisabled:
|
||||
print(f"❌ Transcripts are disabled for video {video_id}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
except NoTranscriptFound:
|
||||
print(f"❌ No transcript found for video {video_id}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
except Exception as e:
|
||||
print(f"❌ Error: {e}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
def list_available_transcripts(video_id):
|
||||
"""List all available transcripts for a video"""
|
||||
try:
|
||||
transcript_list = YouTubeTranscriptApi.list_transcripts(video_id)
|
||||
print(f"✅ Available transcripts for {video_id}:")
|
||||
|
||||
for transcript in transcript_list:
|
||||
generated = "[Auto-generated]" if transcript.is_generated else "[Manual]"
|
||||
translatable = "(translatable)" if transcript.is_translatable else ""
|
||||
print(f" - {transcript.language} ({transcript.language_code}) {generated} {translatable}")
|
||||
|
||||
return True
|
||||
except Exception as e:
|
||||
print(f"❌ Error listing transcripts: {e}", file=sys.stderr)
|
||||
return False
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) < 2:
|
||||
print("Usage: ./extract-transcript.py VIDEO_ID [LANGUAGE_CODE]")
|
||||
print(" ./extract-transcript.py VIDEO_ID --list (list available transcripts)")
|
||||
sys.exit(1)
|
||||
|
||||
video_id = sys.argv[1]
|
||||
|
||||
# Check if user wants to list available transcripts
|
||||
if len(sys.argv) > 2 and sys.argv[2] == "--list":
|
||||
list_available_transcripts(video_id)
|
||||
sys.exit(0)
|
||||
|
||||
# Extract transcript
|
||||
language = sys.argv[2] if len(sys.argv) > 2 else 'en'
|
||||
transcript = extract_transcript(video_id, language)
|
||||
print(transcript)
|
||||
28
skills/youtube-summarizer/scripts/install-dependencies.sh
Normal file
28
skills/youtube-summarizer/scripts/install-dependencies.sh
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
# Install youtube-transcript-api dependency
|
||||
|
||||
set -e
|
||||
|
||||
echo "📦 Installing youtube-transcript-api..."
|
||||
|
||||
if command -v pip3 &>/dev/null; then
|
||||
pip3 install youtube-transcript-api
|
||||
echo "✅ Installation complete using pip3!"
|
||||
elif command -v pip &>/dev/null; then
|
||||
pip install youtube-transcript-api
|
||||
echo "✅ Installation complete using pip!"
|
||||
else
|
||||
echo "❌ Error: pip not found"
|
||||
echo "Please install Python pip first:"
|
||||
echo " macOS: brew install python3"
|
||||
echo " Ubuntu/Debian: sudo apt install python3-pip"
|
||||
echo " Fedora: sudo dnf install python3-pip"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Verify installation
|
||||
python3 -c "import youtube_transcript_api; print('✅ youtube-transcript-api is ready to use!')" 2>/dev/null || {
|
||||
echo "⚠️ Installation completed but verification failed"
|
||||
echo "Try running: python3 -c 'import youtube_transcript_api'"
|
||||
exit 1
|
||||
}
|
||||
Reference in New Issue
Block a user