Skip to content

About

Feed YouTube videos into your agent’s context.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

youtube-transcript

Feed a YouTube video into your agent's context.

Give the agent a URL. It runs this CLI, gets the captions, and answers from that text. It does not watch the video or guess from memory.

For agents

Download a binary from GitHub Releases (linux, macOS, Windows; amd64 and arm64). Archives are named youtube-transcript_<os>_<arch>.tar.gz (.zip on Windows).

Or install from source:

go install github.com/hasangenc0/youtube-transcript/cmd/youtube-transcript@latest

Install the skill with the skills CLI:

npx skills add hasangenc0/youtube-transcript -g

Then paste a youtube.com or youtu.be URL and ask for a recap, quotes, or whether it said something.

-g installs for your user account (Claude Code, Cursor, Codex, Copilot, and the other harnesses the CLI supports). Add -y to skip prompts.

npx skills add hasangenc0/youtube-transcript --list
npx skills add https://github.com/hasangenc0/youtube-transcript -g

npx skills copies .agents/skills/summarize-youtube-video. It does not install the Go binary. youtube-transcript still has to be on PATH.

Manual fallback if you are not using the skills CLI:

ln -s "$(pwd)/.agents/skills/summarize-youtube-video" "$SKILLS_DIR/summarize-youtube-video"

Typical asks:

  • Summarize a talk, lecture, or review you were sent and do not want to watch end to end
  • Pull timestamped quotes for notes, an issue, or a post
  • Ask whether a long video mentioned a specific claim, product, or person

A two-hour transcript will not fit in most context windows. The skill writes long captions to /tmp and summarizes in timestamp windows, then merges. Do not dump the whole file into one prompt.

CLI

youtube-transcript "https://www.youtube.com/watch?v=VIDEO_ID"

Prints timestamped captions to stdout. Pipe it, capture it, or let the agent read the command output.

Write a file with -o (prints the path):

youtube-transcript "https://youtu.be/VIDEO_ID" -o ~/Desktop/transcript.txt

From a clone: go install ./cmd/youtube-transcript. Without installing: go run ./cmd/youtube-transcript URL.

Prefer a language other than English:

youtube-transcript "https://www.youtube.com/watch?v=VIDEO_ID" --lang de

If that language is missing, the program uses the first available track. A bare 11-character video ID works in place of a URL. -o - is stdout.

Output

One caption per line:

[00:00] I've made a lot of content over the
[00:01] years about renting versus owning a
[00:03] home, showing that renters in Canada can

Videos longer than an hour use [HH:MM:SS]. Existing -o files are overwritten.

Dependencies

  • Go 1.22 or newer
  • Network access to YouTube
  • Captions already on the video (manual or auto-generated)

No API key. This talks to YouTube's Innertube player API and timedtext tracks. It does not transcribe audio.

URLs

  • https://www.youtube.com/watch?v=VIDEO_ID
  • https://youtu.be/VIDEO_ID
  • https://www.youtube.com/shorts/VIDEO_ID
  • https://www.youtube.com/embed/VIDEO_ID
  • https://www.youtube.com/live/VIDEO_ID
  • m.youtube.com and music.youtube.com

Extra query params (t=, feature=) are ignored.

Errors

Bad URLs, private or unavailable videos, and videos with no captions print to stderr and exit 1.

YouTube sometimes blocks datacenter IPs. Retry from another network if you get a request or IP error.

Tests and eval

go test ./...
go run ./eval

Release

Push a version tag. GitHub Actions runs GoReleaser and publishes the archives.

git tag v0.1.0
git push origin v0.1.0

License

MIT

About

Feed YouTube videos into your agent’s context.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages