YouTube search
Search YouTube from the agent with YTAPI, then pull transcripts of what you find.
Setup
If YTAPI_API_KEY is not set, read references/auth-setup.md
and follow it: the user either pastes a key or you create a free account
with their email (200 credits, no card). Send the key as
Authorization: Bearer $YTAPI_API_KEY and never print it.
Search (1 credit per page)
curl -s -G "https://api.ytapi.dev/v1/search" \
--data-urlencode "q=QUERY" -d type=video -d limit=20 \
-H "Authorization: Bearer $YTAPI_API_KEY"
| Param | Values |
|---|---|
q |
Search text |
type |
all, video, channel, playlist, shorts, movie |
upload_date |
hour, today, week, month, year |
duration |
short (under 4 min), medium, long (over 20 min) |
sort_by |
relevance, upload_date, view_count, rating |
limit |
Results per page, 1 to 50 (default 20) |
cursor |
next_cursor from the previous page, when has_more is true |
Results are in items: id, type, title, author, channel_id,
length_seconds, view_count_text, published_text.
Free autocomplete: GET /v1/search/suggestions?q=TEXT.
Then read the videos (1 credit each)
curl -s "https://api.ytapi.dev/v1/transcripts?video_id=VIDEO_ID&format=text" \
-H "Authorization: Bearer $YTAPI_API_KEY"
Pick the few most relevant results by title, channel and length before fetching transcripts; each transcript costs a credit.
Credits and errors
Only successful responses use credits; errors are free. New accounts get 200
free credits. Until a credit pack is bought, a key can make 1 request per
second and 100 per day (UTC); 429 daily_limit_exceeded means that day's
limit is used up (it resets at 00:00 UTC; any pack removes it).
402 insufficient_credits means the balance is empty: packs from $9 at
https://ytapi.dev/?utm_source=skill#pricing. 401 means the key is missing or wrong.
For video details, search, channels, playlists and batches in one skill,
install ytapi. Full reference: https://docs.ytapi.dev
