1 unstable release
Uses new Rust 2024
| 0.1.0 | Apr 4, 2026 |
|---|
#1016 in Text processing
22KB
433 lines
ytx
Extract YouTube transcripts from the terminal. Pipe-friendly, no API key needed.
Why ytx?
- Stdout by default -- transcripts go straight to your terminal, ready to pipe anywhere
- No API key, no setup -- scrapes what it needs from the video page automatically
- Built for LLM workflows -- feed any YouTube video into
llm,fabric,mods, or your own tools in one command
Install
cargo install ytx-cli
Or build from source:
git clone https://github.com/koguchic/ytx.git
cd ytx && cargo install --path .
Quick Start
ytx dQw4w9WgXcQ # bare video ID
ytx https://youtu.be/dQw4w9WgXcQ # short URL
ytx https://youtube.com/watch?v=... # full URL
ytx dQw4w9WgXcQ -t # with timestamps
ytx dQw4w9WgXcQ -l ja # Japanese captions
Pipe It Anywhere
This is where ytx shines. It's a Unix building block -- grab a transcript and send it wherever you want.
# Search a lecture for a specific concept
ytx https://youtube.com/watch?v=... | grep -i "attention mechanism"
# Summarize a video with an LLM
ytx https://youtube.com/watch?v=... | llm "what are the key takeaways?"
# Extract action items with fabric
ytx https://youtube.com/watch?v=... | fabric -p extract_wisdom
# Get a word count
ytx https://youtube.com/watch?v=... | wc -w
# Save to a file
ytx https://youtube.com/watch?v=... > transcript.txt
# Copy to clipboard (macOS)
ytx https://youtube.com/watch?v=... | pbcopy
# Translate via LLM
ytx https://youtube.com/watch?v=... -l ja | llm "translate this to English"
# Timestamped transcript to file
ytx https://youtube.com/watch?v=... -t -o notes.txt
Options
| Flag | Description | Default |
|---|---|---|
-t, --timestamps |
Prepend [MM:SS] or [HH:MM:SS] timestamps |
off |
-l, --lang <CODE> |
Caption language code | en |
-o, --output <FILE> |
Write to file instead of stdout | stdout |
How It Works
- Fetches the YouTube video page and extracts the InnerTube API key
- Calls the InnerTube player API (ANDROID client) to get caption URLs -- no PoToken needed
- Fetches and parses the caption XML (supports both srv3 and legacy formats)
No API key required. No browser automation. Just HTTP requests.
Supported URL Formats
https://www.youtube.com/watch?v=VIDEO_IDhttps://youtu.be/VIDEO_IDhttps://www.youtube.com/shorts/VIDEO_ID- Bare 11-character video IDs
License
MIT
Dependencies
~8–17MB
~289K SLoC