https://github.com/marcelocantos/ytt
Fetch YouTube video transcripts from the command line.
https://github.com/marcelocantos/ytt
cli python transcripts youtube
Last synced: 24 days ago
JSON representation
Fetch YouTube video transcripts from the command line.
- Host: GitHub
- URL: https://github.com/marcelocantos/ytt
- Owner: marcelocantos
- License: apache-2.0
- Created: 2026-04-21T20:41:35.000Z (29 days ago)
- Default Branch: master
- Last Pushed: 2026-04-22T10:48:56.000Z (29 days ago)
- Last Synced: 2026-04-22T12:14:18.304Z (29 days ago)
- Topics: cli, python, transcripts, youtube
- Language: Python
- Size: 24.4 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ytt
Fetch YouTube video transcripts from the command line.
A thin wrapper around [`youtube-transcript-api`](https://github.com/jdepoix/youtube-transcript-api)
that extracts video IDs from URLs, handles multiple videos, and optionally
prefixes each segment with a timestamp.
## Install
### Homebrew (recommended)
```sh
brew install marcelocantos/tap/ytt
```
### From the GitHub release
Each release attaches standalone binaries for macOS arm64, Linux x86_64,
and Linux arm64. Download the tarball matching your platform from the
[releases page](https://github.com/marcelocantos/ytt/releases/latest),
extract, and put `ytt` on your PATH.
### From source
Requires Python 3.10+:
```sh
pipx install git+https://github.com/marcelocantos/ytt
```
## Usage
```sh
ytt dQw4w9WgXcQ # raw video ID
ytt https://www.youtube.com/watch?v=dQw4w9WgXcQ # full URL
ytt https://youtu.be/dQw4w9WgXcQ # short URL
ytt --timestamps dQw4w9WgXcQ # one line per segment, [mm:ss] prefix
ytt # multiple videos, blank line between
```
Plain output joins all segments with spaces — convenient for piping into
word counts, LLM prompts, or search tools:
```sh
ytt dQw4w9WgXcQ | wc -w
ytt dQw4w9WgXcQ | grep -i "never"
```
With `--timestamps` (`-t`), each segment is on its own line:
```
[00:00] Never gonna give you up
[00:03] Never gonna let you down
[00:07] Never gonna run around and desert you
...
```
## Flags
| Flag | Purpose |
|---|---|
| `-t`, `--timestamps` | Prefix each segment with `[mm:ss]` (or `[h:mm:ss]` for long videos), one per line |
| `--version` | Print version |
| `--help` | Print usage |
| `--help-agent` | Extended help oriented toward AI/agent consumers |
## Exit codes
| Code | Meaning |
|---|---|
| 0 | All transcripts fetched successfully |
| 1 | One or more videos failed (unavailable, transcripts disabled, etc.) |
| 2 | Usage error (no arguments, bad flag) |
Errors are written to stderr, one line per failure, in the form
`ytt: : `.
## Requirements
- Internet access to YouTube (the underlying library scrapes YouTube's
caption endpoints; YouTube occasionally changes these and breaks
transcript fetching until the library catches up)
- Python 3.10+ only if installing from source; the Homebrew and
GitHub-release downloads bundle their own interpreter
## License
Apache 2.0 — see [LICENSE](LICENSE).