Skip to Content
agentic-yt

Channels and playlists

Channel details and uploads, playlist details and contents — and how to walk them page by page.

Channels

A channel reference can be any of:

FormExample
Channel idUCuAXFkgsw1L7xaCfnd5JJOw
Handle@RickAstleyYT
Any channel URLhttps://www.youtube.com/@RickAstleyYT, /channel/UC…, /c/name, /user/name

Details

ayt channel @RickAstleyYT --json
curl "https://api.agentic-yt.crafter.run/v1/channels/%40RickAstleyYT" \
  -H "Authorization: Bearer $AGENTIC_YT_TOKEN"

Over HTTP the reference goes in the path, so percent-encode it: @ becomes %40, and a full URL is encoded whole. The CLI does this for you.

The response has id (always the canonical UC… id, whatever you passed), url, handle, name, description, subscriber_count, video_count, view_count, thumbnails, banner_url and is_verified. Counters can be null — channels may hide their subscriber count.

Uploads

ayt channel @RickAstleyYT --videos --limit 10 --json
ayt channel @RickAstleyYT --videos --sort popular --json

GET /v1/channels/{id}/videos:

ParameterDefaultNotes
sortnewnew (latest first) or popular (most viewed first).
limit201–100.
cursor—next_cursor from the previous response.

It returns channel_id, videos and next_cursor. Each video is a summary — id, url, title, duration_seconds, channel, thumbnail_url, view_count, published_at, is_live — the same shape as a search result.

"What has this channel posted lately?" is --videos --limit 5. "What is this channel known for?" is --videos --sort popular --limit 5.

Playlists

A playlist reference is its id (PL…, and the other prefixes YouTube uses) or any URL carrying list=.

Details

ayt playlist PLrAXtmErZgOeiKm4sgNOknGvNjby9efdf --json

GET /v1/playlists/{id} returns id, url, title, description, channel, video_count, view_count, thumbnails, visibility and updated_at.

Contents

ayt playlist PLrAXtmErZgOeiKm4sgNOknGvNjby9efdf --videos --limit 50 --json

GET /v1/playlists/{id}/videos takes limit and cursor and returns playlist_id, videos and next_cursor, in playlist order.

A watch URL with list= is a video

https://www.youtube.com/watch?v=…&list=PL… names both a video and a playlist. Passed where a video is expected, it resolves to the video; passed where a playlist is expected, it resolves to the playlist. To see both halves at once, use ayt resolve, which returns playlist_id alongside the video id.

Walking a whole list

cursor=""
while :; do
  page=$(ayt playlist "$PLAYLIST" --videos --limit 100 ${cursor:+--cursor "$cursor"} --json)
  echo "$page" | jq -r '.videos[].id'
  cursor=$(echo "$page" | jq -r '.next_cursor // empty')
  [ -z "$cursor" ] && break
done

Cursors are opaque and tied to the request that produced them: keep sort the same across pages, and do not store a cursor for later — start again from the first page.

Each page is one request against your daily quota. Processing every video in a 300-video playlist is 3 list requests plus whatever you do per video; do the arithmetic before starting, and remember that at most 3 jobs run at once.

Your own playlists

Playlists and lists that belong to you — including private ones, your subscriptions, liked videos and Watch Later — are under /v1/me/… and need a connected YouTube account.

Errors to expect

On this page