Youtube transcript
Skill johnreitano/claude-skill-youtube-transcript/skills/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.From its SKILL.md
npx -y skills add johnreitano/claude-skill-youtube-transcript --skill youtube-transcriptAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
2.3 KB, as published. Nobody here has run it
YouTube Transcript
Fetch the transcript of a YouTube video and respond appropriately based on what the user asked for.
Steps
- Ensure Homebrew and yt-dlp are installed
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
- Download the transcript to a temp SRT file:
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.
- Extract clean text from the SRT file:
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.
- Read the transcript text and respond based on what the user asked for:
| 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.
Example invocations
/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 section