YouTube Search
Give your agent YouTube search results as JSON
Give it searches and get the videos YouTube finds for each one: id, URL, title, channel, duration, views, date and thumbnail. For agents that need to find videos to research, summarize or cite, and then get their transcripts or frames.
$0.003 per search with results. Searches without videos are not charged.
{
"query": "lofi hip hop",
"sort": "relevance",
"uploadDate": "any",
"hl": "en",
"gl": "US",
"resultCount": 20,
"videos": [
{
"videoId": "8b3fqIBrNW0",
"url": "https://www.youtube.com/watch?v=8b3fqIBrNW0",
"title": "lofi hip hop mix 📚 beats to relax/study to (Part 2)",
"channelName": "Lofi Girl",
"channelId": "UCSJ4gkVC6NrvII8umztf0Ow",
"channelUrl": "https://www.youtube.com/channel/UCSJ4gkVC6NrvII8umztf0Ow",
"duration": "4:05:02",
"durationSeconds": 14702,
"viewCount": 2071299,
"publishedAt": "1 year ago",
"isLive": false,
"isUpcoming": false,
"thumbnail": "https://i.ytimg.com/vi/8b3fqIBrNW0/hq720.jpg"
}
]
}One video shown of 20. publishedAt is the date as YouTube shows it in the language asked, and null when YouTube shows none. duration and viewCount are null for live and upcoming videos.
Use cases
Research from Claude or Cursor
Ask the agent about a topic and it finds the videos that cover it, with channel, views and date to pick the ones worth watching.
Search, then transcripts
Pass the URLs to YouTube Transcript or Frameskim and the agent reads or watches the videos it found.
Track new videos on a topic
Sort by date and keep only today's, this week's or this month's uploads, in the language and country you set.
Input and output
{
"queries": ["lofi hip hop", "Artemis launch"],
"maxResults": 20,
"sort": "date",
"uploadDate": "week"
}queries takes your searches; a repeated one runs once. sort is relevance, date or views, and uploadDate is any, today, week or month.
{
"query": "qzxv lorem nothing here",
"error": "YouTube found no videos for this search; try other words or a wider uploadDate. Nothing was charged."
}A search that found no videos, or that YouTube did not answer, comes back with the reason and is not charged.
Pricing
$0.003 per search with results
Pay per event on Apify, no subscription: one search event per search delivered with at least one video, up to 20 videos. Searches without videos, or that YouTube did not answer or refused, are not charged, and a run never charges more than the maximum you set.
Limits
queriestakes 1 to 50 searches per run, each of up to 200 characters.- Up to 20 videos per search, with at most 3 requests to YouTube per search, retries included.
- 4 s per request to YouTube; 2 searches at a time.
- Videos only: no Shorts shelves, channels, playlists or ads. No login, cookies or proxy, and no video, image or transcript is downloaded.
Use it by API or from Claude
curl -X POST "https://api.apify.com/v2/acts/emttn~youtube-search/run-sync-get-dataset-items" \
-H "Authorization: Bearer $APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{"queries": ["Artemis launch"], "sort": "date", "uploadDate": "week"}'{ "mcpServers": { "apify": {
"url": "https://mcp.apify.com/?actors=emttn/youtube-search"
} } }Then ask: "Find this week's videos about the Artemis launch and tell me which channels covered it."
Use it as an MCP server or HTTP API
Its server answers at once, the videos of one YouTube search per call: $0.003 per search with videos, nothing for a search without videos or that YouTube does not answer. No run starts in your Apify account, and requests are not stored.
curl -G "https://emttn--youtube-search.apify.actor/search" \
--data-urlencode "query=NASA Perseverance landing" \
-H "Authorization: Bearer $APIFY_TOKEN"One search per call, up to 10 seconds. Several searches at once need a run (above).
{ "mcpServers": { "youtube-search": {
"url": "https://emttn--youtube-search.apify.actor/mcp",
"headers": { "Authorization": "Bearer <APIFY_TOKEN>" }
} } }The bearer is your Apify API token. MCP tool: youtube_search.
FAQ
What is charged and what is not?
One search event per search delivered with at least one video. A search without videos, one YouTube did not answer or refused, or one the run did not start is not charged. Set a maximum charge per run and it stops before a search that would pass it.
Why is publishedAt sometimes null?
publishedAt is the date YouTube shows next to the video, such as "3 days ago", in the language you ask for. YouTube shows no date for about 1% of videos, mostly official music videos, and for live videos; there it is null.
Does it include Shorts, channels or playlists?
No. It asks YouTube's search for videos only, so Shorts shelves, channels, playlists and ads are left out of the results.
Can I get the transcripts of the videos it finds?
Not from this actor: it returns what YouTube's search shows, without downloading videos, images or transcripts. Pass the url of each video to YouTube Transcript for its transcript, or to Frameskim for its frames.
Why is a video I expected missing?
The results are what YouTube's search shows for the language and country you set, so they change with hl and gl. Videos and channels whose rights holders asked Frameskim to stop are also left out, as in the other Frameskim actors.