From youtube-transcript
Fetch and process a YouTube video transcript. Use when the user provides a YouTube URL and wants a transcript, summary, or to extract information from a video.
How this skill is triggered — by the user, by Claude, or both
Slash command
/youtube-transcript:youtube-transcriptThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Fetch the transcript of a YouTube video and respond appropriately based on what the user asked for.
Fetch the transcript of a YouTube video and respond appropriately based on what the user asked for.
if ! command -v brew &> /dev/null; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
if ! command -v yt-dlp &> /dev/null; then
brew install yt-dlp
fi
TMPDIR=$(mktemp -d)
yt-dlp --write-auto-sub --sub-format srt --skip-download "$URL" -o "$TMPDIR/transcript"
Where $URL is the YouTube URL provided by the user.
import re, glob
srt_files = glob.glob(f"{tmpdir}/*.srt")
if not srt_files:
print("ERROR: No transcript found")
exit(1)
with open(srt_files[0], 'r') as f:
content = f.read()
blocks = re.split(r'\n\n+', content.strip())
lines = []
for block in blocks:
parts = block.strip().split('\n')
for part in parts[2:]:
text = re.sub(r'<[^>]+>', '', part).strip()
if text:
lines.append(text)
deduped = []
for line in lines:
if not deduped or line != deduped[-1]:
deduped.append(line)
print(' '.join(deduped))
Save the output to $TMPDIR/transcript.txt.
| User intent | Response |
|---|---|
| Just a URL, no other instructions | Display the full transcript text |
| "summarize" or similar | Write a concise summary |
| "extract X" or specific question | Pull out the relevant information |
| Any other instruction | Follow it using the transcript as source material |
If yt-dlp reports no subtitles available, tell the user the video has no transcript.
/youtube-transcript:youtube-transcript https://youtube.com/watch?v=abc123 → display full transcript/youtube-transcript:youtube-transcript https://youtube.com/watch?v=abc123 summarize → summary/youtube-transcript:youtube-transcript https://youtube.com/watch?v=abc123 what does it say about sleep? → extract relevant sectionCreates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub johnreitano/claude-skill-youtube-transcript --plugin youtube-transcript