Skip to content

maxbeizer/gh-yt2md

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

demo

Installation

gh extension install maxbeizer/gh-yt2md

Usage

# 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:

# 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:

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

go build -o gh-yt2md .
./gh-yt2md dQw4w9WgXcQ

License

MIT

About

YouTube to Markdown - gh CLI extension

Topics

Resources

Stars

Watchers

Forks

Contributors