| name | ytube |
| description | Transcribe a YouTube video to markdown using yt-dlp auto-captions. Use when a YouTube URL appears, or the user asks to transcribe/summarise a video. |
ytube
Transcribe a YouTube video to a markdown file using yt-dlp's auto-captions.
Arguments
A YouTube URL. If not provided, ask the user.
Your Task
1. Get video metadata
yt-dlp --print "%(title)s" --print "%(channel)s" --print "%(duration_string)s" --print "%(webpage_url)s" --skip-download "$URL" 2>/dev/null
Output is 4 lines, in order: title, channel, duration_string, webpage_url
2. Generate filename
Sanitize video title (replace / : " with -, trim to 80 chars)
Ensure filename ends with the normal markdown extension: ".md"
3. Download auto-captions
yt-dlp --write-auto-sub --sub-lang "en-orig,en" --sub-format vtt --skip-download -o "/opt/clones/github/jalanb/tmp/ytube_$$" "$URL"
The VTT file will be at /opt/clones/github/jalanb/tmp/ytube_$$.en-orig.vtt or /opt/clones/github/jalanb/tmp/ytube_$$.en.vtt
Note that "en-orig" captions may not be available, only "en"
4. Clean and convert to markdown
clean_vtt.py (in this skill's ytube/ package) cleans VTT formatting from
the transcript, unwraps caption line-breaks into proper paragraphs, and
writes a markdown file.
The call looks like this example if the "en-orig" captions are available:
python3 -m ytube.clean_vtt \
"/opt/clones/github/jalanb/tmp/ytube_$$.en-orig.vtt" \
"$filename" \
"$title" \
"$channel" \
"$duration_string" \
"$webpage_url"
The script will output the full path to the markdown file it wrote, under
/opt/clones/github/jalanb/clawdrs/clawdr/skills/ytube/transcripts/
5. Cleanup
rm -f /opt/clones/github/jalanb/tmp/ytube_$$.*
6. Report
Show the user the output from the script, which is expected to be a path.
User will normally copy/paste that path into another tool, e.g. vim
7. Review
Give user a chance to read transcript, then ask user about the quality of the transcript.
Then consider whether any changes to this text/skill might improve the next transcript for user
If there are such changes, propose them to user.