A gh CLI extension that extracts YouTube video transcripts into markdown, optionally processing them with GitHub Models. Single Go binary, zero runtime dependencies.
gh extension install maxbeizer/gh-yt2md# Pass a URL or video ID — it just works
gh yt2md "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
gh yt2md "https://youtu.be/dQw4w9WgXcQ"
gh yt2md dQw4w9WgXcQ
# Save to a file
gh yt2md dQw4w9WgXcQ -o transcript.md
# Process with GitHub Models (requires GITHUB_TOKEN)
gh yt2md dQw4w9WgXcQ -p "Summarize in 3 bullet points" -m "openai/gpt-4.1"By default, output goes to stdout — pipe it wherever you like:
# Pipe to clipboard
gh yt2md dQw4w9WgXcQ | pbcopy
# Pipe to a file
gh yt2md dQw4w9WgXcQ > notes.mdStatus messages go to stderr, so piping works cleanly.
| Flag | Short | Description |
|---|---|---|
--output |
-o |
Output file path (default: stdout) |
--prompt |
-p |
Process transcript with GitHub Models using this prompt |
--model |
-m |
GitHub Models model ID (default: openai/gpt-4o-mini) |
To use --prompt, set the GITHUB_TOKEN environment variable:
export GITHUB_TOKEN=ghp_...
gh yt2md dQw4w9WgXcQ -p "Translate to Spanish" -m "openai/gpt-4.1"- Calls YouTube's Innertube API to get video metadata and caption track URLs
- Fetches the caption track XML and parses transcript segments
- Renders as markdown with video metadata header
- Optionally sends the transcript text to GitHub Models for AI processing
go build -o gh-yt2md .
./gh-yt2md dQw4w9WgXcQMIT
