Transcribe a YouTube video and summarize into structured markdown notes
Transcribe a YouTube video and produce structured markdown notes.
Parse arguments — extract the YouTube URL and output directory from $ARGUMENTS. Both are required. If either is missing, tell the user the usage: /transcribe <youtube-url> <output-directory> and stop.
Extract video ID from the URL. Handle these formats:
youtube.com/watch?v=VIDEO_IDyoutu.be/VIDEO_IDyoutube.com/embed/VIDEO_IDyoutube.com/v/VIDEO_ID-_)Check youtube_transcript_api CLI is available:
which youtube_transcript_api 2>/dev/null || pipx install youtube-transcript-api
Fetch video title using Python:
python3 -c "
import json, urllib.request, re
url = 'https://www.youtube.com/watch?v=VIDEO_ID'
req = urllib.request.Request(url, headers={'User-Agent': 'Mozilla/5.0', 'Accept-Language': 'en-US,en;q=0.9'})
html = urllib.request.urlopen(req).read().decode()
match = re.search(r'<title>(.*?)(?:\s*-\s*YouTube)?</title>', html)
print(match.group(1).strip() if match else 'Untitled')
"
Fetch transcript using the CLI:
youtube_transcript_api VIDEO_ID --format json
If that fails (no transcript available), tell the user and stop.
Generate kebab-case filename from the video title:
.mdEnsure the output directory exists — create it with mkdir -p if needed.
Summarize and format — read the full transcript text and produce structured markdown notes. Follow this format:
# <Video Title>
Source: <youtube-url>
## Overview
<1-2 paragraph summary of the video's main thesis/content>
## <Topic Section>
- **Key point**: explanation
- **Key point**: explanation
## <Another Section>
...additional sections as appropriate...
Guidelines for the summary:
# Title from the video titleSource: <youtube-url> right after the titleWrite the file to <output-directory>/<kebab-case-title>.md using the Write tool.
Confirm by telling the user: