Download the transcript from a YouTube video and summarize its main points. Use when the user runs /ps-tube-summary <url> or asks to summarize a YouTube video.
The user wants to summarize a YouTube video.
Arguments: $ARGUMENTS
Parse the URL from the arguments. If --refresh flag is present, skip the history check and re-summarize.
Check if scripts are installed:
ls "$HOME/.local/share/personal-skills/scripts/tube/check_deps.sh" 2>/dev/null
If that file does not exist, run the installer silently:
curl -fsSL https://raw.githubusercontent.com/minhtranin/personal-skills/main/install.sh | bash
Wait for it to complete before continuing. If it fails, tell the user to run the installer manually and stop.
Before doing any network work, check if this video was already summarized:
python3 "$HOME/.local/share/personal-skills/scripts/tube/lookup_history.py" "<URL>"
bash "$HOME/.local/share/personal-skills/scripts/tube/check_deps.sh"
If the script exits non-zero (user declined to install), stop.
Parse the video ID from the URL:
youtube.com/watch?v=VIDEO_ID → extract v= paramyoutu.be/VIDEO_ID → extract path segmentyoutube.com/shorts/VIDEO_ID → extract path segmentyt-dlp --skip-download --print "%(title)s" "<URL>"
bash "$HOME/.local/share/personal-skills/scripts/tube/get_transcript.sh" "<URL>"
Capture the full output as the transcript text.
Using the transcript (or video description if no transcript was available), produce:
Use ASCII tree / hierarchy style for all output. Format as follows:
<VIDEO_ID> — <title>
├── URL : <url>
├── Duration : <duration if available>
└── Fetched : <date>
SUMMARY
└── <3–5 sentence overview: what the video is about, main argument, conclusion>
KEY POINTS
├── <point 1>
├── <point 2>
├── <point 3>
├── <point 4>
├── <point 5>
└── <point N>
Then on a new line: "Browse all history with /ps:web. Want a diagram for this? (y/n)"
python3 "$HOME/.local/share/personal-skills/scripts/tube/save_summary.py" \
--video-id "<VIDEO_ID>" \
--url "<URL>" \
--title "<TITLE>" \
--summary "<SUMMARY_TEXT>" \
--key-points "<KEY_POINTS_TEXT>" \
--transcript "<TRANSCRIPT_FIRST_4000_CHARS>"
If the user replies y or yes:
bash "$HOME/.local/share/personal-skills/scripts/excalidraw/check_deps.sh" 2>/dev/null && echo "ok" || echo "skip"
If skip: tell the user excalidraw deps are not installed and stop.
If ok: generate a full architectural/technical diagram — not a summary. Include all technical details, flows, components, trade-offs, and code patterns from the video. Write to /tmp/tube_diagram.excalidraw, render:
REFS="$HOME/.local/share/personal-skills/scripts/excalidraw/references"
cd "$REFS" && uv run python render_excalidraw.py /tmp/tube_diagram.excalidraw --output /tmp/tube_diagram.png
Display PNG with the Read tool. Then update the saved entry — save_summary.py will automatically copy the PNG from /tmp/ to a persistent ~/.youtube-summary/diagrams/<video_id>.png:
python3 "$HOME/.local/share/personal-skills/scripts/tube/save_summary.py" \
--video-id "<VIDEO_ID>" \
--url "<URL>" \
--title "<TITLE>" \
--summary "<SUMMARY_TEXT>" \
--key-points "<KEY_POINTS_TEXT>" \
--transcript "<TRANSCRIPT_FIRST_4000_CHARS>" \
--diagram-png "/tmp/tube_diagram.png"