Skip to content
ytb

v0.4.0

A new discover command walks the YouTube graph from a video, channel, or playlist breadth first, following uploaders, related videos, uploads, playlists, items, owners, community posts, and comments.

Every other read answers one question about one object: a video's metadata, a channel's uploads, a playlist's items. This release adds discover, which chains them into a single breadth-first walk.

discover: walk the graph

ytb discover dQw4w9WgXcQ      # what is this video linked to?
ytb discover @MrBeast         # what is this channel linked to?

A seed is any reference ytb already resolves: a video id or watch URL, a channel id, @handle, or URL, or a playlist id or URL. Pass several to start the walk from more than one place. The first row is the seed at depth 0; each later row is tagged with the edge it arrived by.

What gets followed

The default content preset spans every seed kind: a video yields its uploader and related videos, a channel yields its uploads, a playlist yields its items and owner. The full edge vocabulary is channel, related, comments, uploads, playlists, community, items, owner, and commenter.

ytb discover <channel> --follow feed       # uploads, playlists, community posts
ytb discover <video> --follow comments     # comments and the channels behind them
ytb discover <ref> --follow all
ytb discover <channel> --follow uploads,playlists

The presets are content, feed, comments, and all. YouTube serves the open surface to an anonymous request, so most edges need nothing. The two that touch comments are gated by the per-IP Restricted Mode some networks see; when YouTube refuses them, discover notes it on stderr and keeps going on the rest of the graph rather than failing the walk.

Bounds, output, and the store

--depth (default 1; 0 emits only the seeds), --fanout (default 25; 0 for unlimited), and -n (default 500) keep a walk finite. discover streams one row per node through the same formatter as every read, and --store writes every node and edge into the local store as the walk streams, so the graph is queryable afterwards. See the Graph discovery guide for the full tour.

Install

go install github.com/tamnd/ytb-cli/cmd/ytb@latest

Prebuilt archives for Linux, macOS, and Windows, plus Linux packages (deb, rpm, apk) and checksums, are on the release page. The container image is on GHCR:

docker run --rm ghcr.io/tamnd/ytb:0.4.0 discover dQw4w9WgXcQ -n 10