https://github.com/maxbeizer/gh-yt2md
YouTube to Markdown - gh CLI extension
https://github.com/maxbeizer/gh-yt2md
cli gh gh-extension youtube
Last synced: 2 months ago
JSON representation
YouTube to Markdown - gh CLI extension
- Host: GitHub
- URL: https://github.com/maxbeizer/gh-yt2md
- Owner: maxbeizer
- License: mit
- Created: 2026-02-23T16:25:37.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2026-03-21T11:22:29.000Z (3 months ago)
- Last Synced: 2026-03-22T02:11:59.923Z (3 months ago)
- Topics: cli, gh, gh-extension, youtube
- Language: Go
- Homepage:
- Size: 1.65 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gh-yt2md
A `gh` CLI extension that extracts YouTube video transcripts into markdown, optionally processing them with GitHub Models. Single Go binary, zero runtime dependencies.

## Installation
```bash
gh extension install maxbeizer/gh-yt2md
```
## Usage
```bash
# 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"
```
### Output
By default, output goes to **stdout** — pipe it wherever you like:
```bash
# Pipe to clipboard
gh yt2md dQw4w9WgXcQ | pbcopy
# Pipe to a file
gh yt2md dQw4w9WgXcQ > notes.md
```
Status messages go to stderr, so piping works cleanly.
### Flags
| 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`) |
### GitHub Models Integration
To use `--prompt`, set the `GITHUB_TOKEN` environment variable:
```bash
export GITHUB_TOKEN=ghp_...
gh yt2md dQw4w9WgXcQ -p "Translate to Spanish" -m "openai/gpt-4.1"
```
## How It Works
1. Calls YouTube's Innertube API to get video metadata and caption track URLs
2. Fetches the caption track XML and parses transcript segments
3. Renders as markdown with video metadata header
4. Optionally sends the transcript text to GitHub Models for AI processing
## Development
```bash
go build -o gh-yt2md .
./gh-yt2md dQw4w9WgXcQ
```
## License
MIT