YouTube Search API & Scraper - Videos, Shorts & Channels
Pricing
from $1.00 / 1,000 results
YouTube Search API & Scraper - Videos, Shorts & Channels
YouTube Search API: returns the results of YouTube searches (rank, title, channel and more) over REST. Filter by type (videos, Shorts, channels, playlists, live), upload date and length, or sort by views, with YouTube's own filters. JSON, CSV or Excel. $1.00 per 1,000 results, no subscription.
Pricing
from $1.00 / 1,000 results
Rating
0.0
(0)
Developer
Rocketyard
Maintained by CommunityActor stats
0
Bookmarked
1
Total users
1
Monthly active users
3 days ago
Last modified
Categories
Features
Share
YouTube Search API & Scraper is a REST API on the Apify platform: one request returns the results of any YouTube search: videos, Shorts, channels and playlists, ranked as YouTube lists them, as JSON, CSV or Excel. You can also run it from a form in the Apify Console, without code.
What does YouTube Search API & Scraper do?
YouTube Search API & Scraper returns the results of YouTube searches: one clean record per search result, with typed values (numbers, booleans, ISO dates) ready for spreadsheets, databases and AI pipelines.
- YouTube's own filters: type (videos, Shorts, channels, playlists, live now), upload date (last hour to this year), length and popularity
- Up to 1,000 results per search, page after page, each with its rank in the search
- Videos, Shorts, channels and playlists in one typed record shape: IDs, URLs, titles, channel with handle and verified badge, views as numbers, length in seconds, live and Shorts flags
- A result listed twice (on two pages, or in a Shorts shelf) is stored and charged once
- An error item with a clear code for every search that yields nothing, never charged
- Plain HTTP, no browser, no login, no API key or quota. Pay only per result: no monthly rental, no minimums
Use cases
- Track where your videos and your competitors' videos rank for the keywords you care about
- Research a topic: what gets made, by whom, how long it runs and how many views it gets
- Find creators and channels for a niche or a campaign by keyword
- Collect fresh videos on a topic every hour or every day for monitoring, dashboards or an LLM
How it compares
| YouTube search result scraper | Users (last 30 days) | Successful runs (last 30 days) | Price per 1,000 results |
|---|---|---|---|
| Youtube Search Api | 963 | 99.4% | $1.00 |
| YouTube Search Scraper ($0.5/1000 results) | 927 | 99.9% | $5.00 |
| YouTube Search Scraper - Videos & Shorts by Keyword | 856 | 98.6% | $1.20 |
| This Actor | new | every release is tested on live pages first | $1.00 |
Apify Store data from 2026-11-12, free-plan prices. Prices and stats change; check each listing before you compare.
YouTube Search API
Every Apify Actor is also a REST endpoint, so YouTube Search API & Scraper works as a YouTube Search API, a YouTube search results API or a YouTube keyword search API, without a server of your own. One POST starts a run, waits for it and returns the results:
POST https://api.apify.com/v2/acts/rocketyard~youtube-search-scraper/run-sync-get-dataset-items
Send your Apify API token in the Authorization header and the input as the JSON body. Add ?format=csv or ?format=xlsx to get CSV or Excel instead of JSON. The request waits up to 300 seconds; for a longer run, start it with POST /v2/acts/rocketyard~youtube-search-scraper/runs and read the dataset when it finishes.
How it works
A YouTube search page loads its results from YouTube's search endpoint as JSON, 20 or so at a time, and asks for the next ones with a continuation token as you scroll. The Actor sends the same logged-out requests over plain HTTP, with no browser, login or cookies: your query with the params value YouTube's own filter menu builds for the type, upload date, length and sort you pick, then the continuation token of each answer, with a random pause of 300 to 800 ms between requests. The web client version the endpoint expects is read once per run from a 3 KB answer YouTube serves to every logged-out visitor, and checked before use. Each result becomes one typed record: its type and rank, the video, Short, channel or playlist ID and URL, the title, the channel with its handle and verified badge, the view count as a number and as shown, the age, the length in seconds, live and Shorts flags, the thumbnail, the description snippet and the badges. A result listed twice, on two pages or in a shelf, is stored and charged once. It does not check robots.txt, and YouTube's robots.txt disallows the /results and /youtubei/ paths of the search page and its endpoint.
How to use it
- Click Try for free.
- Add what you are looking for to Search queries, or paste YouTube search URLs.
- Pick a Type, Upload date, Length or Sort by if you need them, and set Max results per search (up to 1,000).
- Click Start, then download results as JSON, CSV, Excel or via the API.
Input
| Field | JSON key | What it does |
|---|---|---|
| Search queries | queries | What to search for, as you would type it into YouTube. Each query is one search with the filters below. |
| YouTube search URLs | startUrls | Search pages copied from youtube.com (https://www.youtube.com/results?search_query=...). Each keeps the filters picked on YouTube (the sp= part of the URL); the filter inputs below apply to Search queries only. |
| Max results per search | maxResultsPerQuery | Stop each search after this many results. YouTube lists about 20 per page, so the Actor reads one page per 20 results. A search with fewer results stops at its last page. |
| Type | type | What to search for. Everything: what the search page lists, in its order, including the Shorts shelves it mixes in (shelf names them). Live now: streams that are live at the moment. |
| Upload date | uploadDate | Only results uploaded in this period. YouTube offers it for videos, Shorts and live streams, not for channels and playlists. |
| Length | duration | Only videos of this length. YouTube offers it for videos and live streams, not for Shorts, channels and playlists. |
| Sort by | sortBy | Relevance, or popularity (most viewed first). YouTube no longer sorts search results by upload date or rating; use Upload date to keep recent results only. |
| Max results in total | maxItems | Stop the run after this many results, over all searches. Empty means no limit beyond Max results per search. |
| Max concurrency | maxConcurrency | Searches run in parallel. A pause of 300 to 800 ms between requests to YouTube always applies, over all of them. |
| Proxy configuration | proxyConfiguration | Optional proxy. YouTube ranks results partly by where a request comes from, so a proxy in another country can return other results. |
Input example
{"queries": ["lofi hip hop","how to cook rice"],"type": "video","uploadDate": "year","sortBy": "relevance","maxResultsPerQuery": 300}
Output example
A real record from the latest test run (youtube.com) on 2026-11-12. Fields the page didn't publish are left out here; the Actor returns them as null.
{"url": "https://www.youtube.com/watch?v=CLeZyIID9Bo","type": "video","position": 6,"query": "lofi hip hop","searchUrl": "https://www.youtube.com/results?search_query=lofi+hip+hop&sp=EgIQAQ%253D%253D","videoId": "CLeZyIID9Bo","title": "Chill Lofi Mix [chill lo-fi hip hop beats]","channelId": "UCkKT4qf-TcPFOmpqhTawrGA","channelName": "Settle","channelHandle": "@settlefm","channelUrl": "https://www.youtube.com/@settlefm","channelVerified": false,"viewCount": 35278018,"viewCountText": "35,278,018 views","publishedText": "4 years ago","durationSeconds": 6292,"durationText": "1:44:52","isShort": false,"isLive": false,"isUpcoming": false,"thumbnailUrl": "https://i.ytimg.com/vi/CLeZyIID9Bo/hq720.jpg?sqp=-oaymwExCNAFEJQDSFryq4qpAyMIARUAAIhCGAHwAQH4Af4JgALQBYoCDAgAEAEYQyBkKGUwDw==&rs=AOn4CLAX5tHBXfw7XY8bX2GjPk4Jw9lIEg","descriptionSnippet": "YouTube Playlists: http://listen.settle.fm/youtube Listen on Spotify, Apple Music & more: https://listen.settle.fm/playlists Tracklist ...","badges": ["4K"],"scrapedAt": "2026-11-12T07:02:36.153Z"}
Output fields
| Field | Description |
|---|---|
url | Watch URL of a video, /shorts/ URL of a Short, channel URL or playlist URL |
type | video, short, channel or playlist |
position | Rank in the search, from 1, in the order YouTube lists the results (each result once) |
query | The search query |
searchUrl | The YouTube search page with the same query and filters |
shelf | Shelf the result is listed in ("Shorts", "Latest from BBC News"); null for the main list |
videoId | 11-character video ID of a video or Short |
playlistId | Playlist ID of a playlist or course |
title | Title of the video, Short or playlist, or the channel name |
channelId | Channel ID (UC...) of the channel, or of the channel that published the video or playlist |
channelName | Channel name |
channelHandle | Channel handle (@name), when YouTube shows it |
channelUrl | Channel URL |
channelVerified | true when the channel has a verified or official artist badge |
viewCount | Views as a number: exact for videos, rounded for Shorts |
viewCountText | Views as YouTube shows them ("58,674,451 views", "846K views") |
watchingCount | People watching a stream that is live now (instead of views) |
publishedText | Age as YouTube shows it ("4 years ago", "Streamed 2 years ago") |
durationSeconds | Length in seconds |
durationText | Length as YouTube shows it ("6:10:58") |
isShort | true for Shorts |
isLive | true for a stream that is live now |
isUpcoming | true for a scheduled premiere or stream |
scheduledStartTime | Start of a scheduled premiere or stream (ISO 8601) |
thumbnailUrl | Largest thumbnail (the avatar for a channel) |
descriptionSnippet | Start of the description, as the search shows it |
badges | Badges YouTube shows on the result ("New", "4K", "CC", "LIVE"; "Course" or "Playlist" on playlists) |
subscriberCount | Channel results: subscribers as a number, from the rounded count YouTube shows |
subscriberCountText | Channel results: subscribers as YouTube shows them ("12.5M subscribers") |
videoCount | Playlists, and channels when YouTube shows it: the number of videos (or lessons, episodes) |
videoCountText | The same as YouTube shows it ("54 videos", "124 lessons") |
scrapedAt | ISO timestamp of the extraction |
Error items
When an input produces no data, the dataset gets one error item for it, so nothing is skipped silently. Error items are free: only result records are charged.
{"url": "https://www.youtube.com/results?search_query=xqzvbnmlkjhgfdsa+qpwoeiruty&sp=EgIIAQ%253D%253D","input": "https://www.youtube.com/results?search_query=xqzvbnmlkjhgfdsa+qpwoeiruty&sp=EgIIAQ%253D%253D","error": {"type": "https://rocketyard.dev/errors#empty","title": "Nothing published","detail": "YouTube has no results for \"xqzvbnmlkjhgfdsa qpwoeiruty\" with these filters right now.","instance": "https://www.youtube.com/results?search_query=xqzvbnmlkjhgfdsa+qpwoeiruty&sp=EgIIAQ%253D%253D","code": "EMPTY"}}
The error object follows RFC 9457 (Problem Details). Its type links to the explanation of the code, and status is the site's HTTP status when there was one. Filter on error.code to separate failures from data; it has its own column in CSV and Excel exports.
| Code | Meaning | Retry? |
|---|---|---|
PRIVATE_ADDRESS | The URL, or a redirect from it, points to a private or local network address. Only public websites are fetched. | no |
NOT_FOUND | The page or source does not exist (HTTP 404 or 410). | no |
BLOCKED | The site refused access (HTTP 401, 403 or 429) or answered with a bot-check or consent page instead of the content. | sometimes |
HTTP_ERROR | The site answered with another HTTP error: a server error (5xx) that persisted after retries, or an unexpected 4xx status. | sometimes |
TIMEOUT | The site did not answer in time, even after retries. | yes |
NETWORK_ERROR | The connection failed (DNS, TLS or a reset connection), even after retries. | yes |
WRONG_CONTENT_TYPE | The URL returned something the Actor doesn't read, such as a PDF or image instead of an HTML page, or a web page where an API response was expected. | no |
TOO_LARGE | The response exceeded the size limit (10 MiB for web pages, 48 MiB for API responses). | no |
PARSE_ERROR | The response could not be read (malformed HTML or JSON). | sometimes |
EMPTY | The source has nothing to return right now: a list with no open items, a store or collection with no products, a search with no results, or a web page whose HTML has no readable text (often a page built only by JavaScript in the browser). | no |
Limits
- YouTube decides how deep a search goes: about 20 results per page, until it answers "No more results". In our test on 2026-11-12, a video search for "lofi hip hop" ended after 474 results, a Shorts search for "minecraft" after about 100, and "how to cook rice" uploaded this year after 17. A search that ends before Max results per search stops at its last page, and you pay for the results it had.
- Shorts in a Shorts search or a Shorts shelf come with their title, views and thumbnail only: YouTube lists them without their channel and length, so those fields are empty on them. Other searches often list Shorts as videos, with their channel and length.
- View counts are exact for videos and rounded for Shorts (846K), as YouTube shows them. A stream that is live now has
watchingCountinstead, the people watching it. Channel subscriber counts are rounded (12.5M), and empty for channels that hide them and for Topic channels (40% of 300 channels for "cooking" on 2026-11-12). - Ages are what YouTube shows ("4 years ago"), not dates: the search lists no upload date. For exact dates and likes, give the video IDs to a YouTube video scraper.
- YouTube ranks results partly by where a request comes from (its IP address), so the same search through a proxy in another country can return other results.
- YouTube no longer sorts search results by upload date or rating, so neither is offered. Its filter menu no longer shows Last hour either, but YouTube still honours it (tested 2026-11-12).
- YouTube may answer an IP address with a bot check or a consent page, or refuse it with HTTP 401, 403 or 429. The Actor then stores one free
BLOCKEDerror item and stops the run, keeping the results stored so far. It never tries to get past a block. Run it again later.
Pricing
Pay per result: $1.00 per 1,000 results, plus a tiny per-run start fee. Searches without results produce an error item, which is not charged, and a result listed twice is charged once. There is no monthly rental, and you can cap spend per run with Max results or Maximum cost per run.
Integrations and API
Run it from the Apify API, the JavaScript/Python clients, Make, Zapier, n8n, LangChain or any MCP-compatible AI agent, and send results to Google Sheets, webhooks, S3 and more. Schedule it to track changes over time.
FAQ
Which searches does it run? Any YouTube search a logged-out visitor can run, by keyword, with YouTube's own filters: type, upload date, length and popularity. Search URLs copied from youtube.com work too, with the filters picked there.
Is this the official YouTube Data API? No. It is an independent Actor that reads the public search results YouTube shows logged-out visitors, and is not affiliated with YouTube or Google. It needs no API key and no quota: a search of 1,000 results costs no Data API units.
How many results can one search return? Up to 1,000 with Max results per search, as far as YouTube goes: it lists about 20 results per page, and most searches end after some hundreds. Split a broad topic into several queries or upload-date periods for more.
What does position mean? The rank of the result in its search, from 1, in the order YouTube lists them, counting each result once. With Type set to Everything, the Shorts in a shelf count too; set Type to Videos for a ranking of videos only.
Can I sort by upload date? No: YouTube removed sorting by upload date and by rating from its search. Use Upload date (last hour, today, this week, this month or this year) to keep recent results only, and Sort by Popularity for the most viewed first.
Does it return comments, transcripts or emails? No. It returns what the search results show. It never reads comments, viewers or contact details.
How much does it cost? You pay per result: $1.00 per 1,000 results, plus a start fee of $0.00005 per run, with no subscription. Cap any run with Maximum cost per run.
How do I call it from the API? One request starts a run and returns its results, using your Apify API token:
$curl -X POST "https://api.apify.com/v2/acts/rocketyard~youtube-search-scraper/run-sync-get-dataset-items" -H "Authorization: Bearer $APIFY_TOKEN" -H "Content-Type: application/json" -d '{"queries":["lofi hip hop","how to cook rice"],"type":"video","uploadDate":"year","sortBy":"relevance","maxResultsPerQuery":300}'
How do I use it with AI agents? Connect Apify's MCP server at https://mcp.apify.com?tools=rocketyard/youtube-search-scraper, and the agent can call this Actor as a tool.
Is it legal to scrape YouTube data? The Actor reads the search results YouTube shows any logged-out visitor, without logging in, without cookies and without bypassing consent or bot checks. It does not check robots.txt, and YouTube's robots.txt disallows the /results and /youtubei/ paths of the search page and its endpoint. It returns no comments and no data about commenters or viewers. You are responsible for how you use the data under YouTube's terms and the law (for example copyright and GDPR).
What happens when an input fails? A search that yields nothing gets one error item with a code and the reason, and is not charged, and the other searches still run. A block is different: when YouTube answers with a bot check or a consent page, or refuses the request, the Actor stores one free BLOCKED item and stops the whole run, keeping the results already stored.
I need a field that is not supported. Open an issue on the Actor's Issues tab. Requests are reviewed regularly and drive new features.
You might also like
- YouTube Channel Scraper - Subscribers, Views & Links: returns the public profile of YouTube channels with their latest uploads
- App Store Reviews API & Scraper - Ratings, Text & Versions: returns the public reviews of any App Store app, with star ratings, text, app versions and dates
- Article Scraper - Any Website (Schema.org): article data from any website with schema.org markup
- Ashby Jobs API & Scraper: every open job from Ashby job boards
- Events Scraper - Any Event Site to Structured Data: event data from any website with schema.org markup
Made by Rocketyard
Rocketyard builds pay-per-result scrapers for public web data, and every release is tested on live pages before it ships. Guides for this Actor: overview, REST API, MCP for AI agents and n8n, Make and Zapier.