# YouTube Search Scraper - Keyword to Videos & Shorts (`tidytools/youtube-search-scraper`) Actor

Search YouTube by keyword and get videos and Shorts as rows: title, channel, URL, views, publish date, duration, search term. Sort by relevance or views, or filter by upload date. No login. $1 per 1,000 results; no results and blocked searches are free.

- **URL**: https://apify.com/tidytools/youtube-search-scraper.md
- **Developed by:** [Yukai Lin](https://apify.com/tidytools) (community)
- **Categories:** Videos, SEO tools, Marketing
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.80 / 1,000 videos

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

### What does YouTube Search Scraper do?

**Type keywords, get YouTube's results as rows: title, channel, URL, views, publish date, duration and the search term, for $1 per 1,000 results, with no start fee.** Keywords with no results, searches YouTube refuses and duplicates are free.

- 🔎 **Several keywords in one run**, in any language, each with its own cap (up to 500 results per keyword).
- 🎬 **Videos and Shorts** in YouTube's order, with `isShort` on every row. Choose Videos only or Shorts only.
- ↕️ **Sort** by relevance or view count, or **filter by upload date**: last hour, today, this week, this month or this year.
- 🗓️ **Date filter and monitoring**: only videos after a date, or only results your earlier scheduled runs have not returned.
- 💸 **$1 per 1,000 results.** No login, no cookies, no browser, no proxy needed.

### Use cases

- **Content and SEO research**: which titles and channels rank for your keywords, and how many views they have.
- **Trend and competitor watch**: schedule a run with Upload date "This week" and monitoring on, and get only the new videos for a topic.
- **Creator discovery**: find the channels that publish on a topic, then read them with YouTube Channel Scraper.
- **Data for AI agents and dashboards**: one clean JSON row per video, ready for Sheets, BigQuery or an LLM.

### How much does it cost?

It uses the same events and prices as YouTube Channel Scraper:

| Event | Price | When |
|---|---|---|
| Video | **$1.00 / 1,000 results** ($0.001 each) | one result video or Short from the results page |
| Video with full details | **$2.00 / 1,000 results** ($0.002 each) | charged instead of "Video" when "Full video details" is on and the video's page was read |

**Free:** keywords with no results, searches YouTube refuses, a video already returned for another keyword in the same run, videos older than your date filter or upload date, results returned by an earlier run in monitoring mode, and invalid inputs. **No start fee.** Larger Apify plans get the usual volume discount (Silver 10%, Gold and above 20%).

**Example:** 5 keywords with 100 results each: 500 x $0.001 = **$0.50**.

You stay in control: `maxResultsPerKeyword` caps each keyword and `maxResults` the run. Before reading, the run logs its worst-case plan; when the next row could pass your **maximum charge per run**, it stops with `SUMMARY.status` `LIMIT_REACHED`.

### How to use it

1. **Search keywords**: one search per line, as you would type it in YouTube's search box.
2. **Results per keyword**: 20 by default, up to 500.
3. Optional: **Sort by**, **Upload date**, **Results to return**, **Full video details**, **Only videos published after**, **monitoring**.
4. Click **Start**. The **Search results** view shows the key columns, **All fields** everything (CSV, Excel, JSON).

#### Input example

```json
{
    "keywords": ["n8n tutorial", "教學 n8n"],
    "maxResultsPerKeyword": 20,
    "searchSort": "relevance",
    "searchUploadDate": "any",
    "searchType": "all"
}
```

#### Output example

One row, shortened. The values show the shape of a row and are not from a live run:

```json
{
    "type": "video",
    "detailLevel": "list",
    "searchQuery": "n8n tutorial",
    "position": 1,
    "videoId": "a0000000001",
    "url": "https://www.youtube.com/watch?v=a0000000001",
    "title": "Example video title",
    "channel": "Example Channel",
    "publishedAt": "2026-10-11T08:00:00.000Z",
    "publishedText": "3 weeks ago",
    "duration": "10:47",
    "durationSeconds": 647,
    "viewCount": 1234,
    "viewCountText": "1,234 views",
    "isShort": false,
    "contentType": "video",
    "channelId": "UC0000000000000000000000",
    "channelHandle": "@example",
    "thumbnailUrl": "https://i.ytimg.com/vi/a0000000001/hqdefault.jpg",
    "source": "search",
    "input": "n8n tutorial",
    "success": true,
    "charged": true
}
```

A keyword without results:

```json
{ "type": "search", "input": "zzz nothing", "searchQuery": "zzz nothing", "success": false, "charged": false, "errorType": "no_results", "error": "YouTube has no results for \"zzz nothing\" (not charged)" }
```

#### What the fields mean

- **searchQuery**: the keyword that found this row. A video found by two keywords is returned once, under the first.
- **position**: the result's rank for that keyword, counting videos and Shorts. Parallel reading can change the order of rows in the Dataset, so sort by this field.
- **channel**: the channel's name (the same value as `channelName`).
- **publishedAt**: an **estimate** from the age YouTube shows ("3 weeks ago") on `detailLevel: "list"` rows, the same value as `publishedAtApprox`. It is exact on Shorts and other results whose page was read, and with full details on.
- **duration**: `10:47` or `1:02:03`; `durationSeconds` is the same in seconds.
- **isShort**: `true` for a YouTube Short (`contentType: "short"`). `contentType` can also be `video` or `live`.
- **viewCount**: from the results page; `viewCountIsApproximate` is `true` when it comes from a rounded label like "5.1K views".
- **errorType** on free rows: `no_results`, `blocked` (YouTube refused the page, or a further result page), `invalid_input`, `parse_error`, `http_error`, `network`, and `charge_limit` or `max_results` for a keyword the run did not reach because it stopped at your maximum charge or `maxResults`.
- **SUMMARY** (key-value store): `search.perKeyword` gives rows, Shorts and result pages read per keyword.

### Next step: the spoken words

Send the `url` values to **YouTube Transcript Scraper** by TidyTools (`tidytools/youtube-transcript`) to get captions with timestamps for the videos you found. Full channel statistics come from **YouTube Channel Scraper** (`tidytools/youtube-channel-scraper`), comments from **YouTube Comments Scraper** (`tidytools/youtube-comments`).

### Use it from code

```bash
curl -X POST "https://api.apify.com/v2/acts/tidytools~youtube-search-scraper/run-sync-get-dataset-items?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"keywords":["n8n tutorial"],"maxResultsPerKeyword":20}'
```

### Limitations

- **No "newest first" order.** YouTube ignores that sort (tested 1 November 2026), so we do not offer it: use **Upload date** for recent videos. YouTube does not combine an upload date with the view-count sort either: the upload date is used and `SUMMARY.inputNotes` says so; sort the rows by `viewCount` yourself.
- **Not guaranteed to return every result.** YouTube decides how many results a search has and may end the list early, so a keyword can return fewer rows than your cap (this is not an error).
- **Further result pages need Apify's network or your proxy.** If YouTube refuses them, you keep and pay for the rows so far and get one free `blocked` row for that keyword. With `httpVia: "backend"` only the first result page of each keyword is read (about 20 results).
- **Three refused searches in a row pause the run's other keywords**: they get free `blocked` rows, so try them again later, or add a proxy.
- **Dates and views on list rows are what YouTube shows.** Turn on full details for exact values. A Short whose page cannot be read keeps its row at the list price, with an empty channel, date or duration.
- Members-only, private and age-restricted videos are not read (no login).

### Responsible use

The Actor reads only public pages, with an honest user agent (`TidyToolsYouTube`). It does not log in, use cookies, solve CAPTCHAs or bypass bot checks: a page YouTube refuses is reported, not forced. Note that youtube.com/robots.txt disallows search pages for crawlers: this Actor reads them anyway, so decide whether that fits your own policy. Follow YouTube's Terms of Service and the laws that apply to you.

### FAQ

**Why did I get fewer rows than my cap?** YouTube's results for that keyword ended, some results were duplicates of an earlier keyword, older than your date filter or returned by an earlier monitoring run. `SUMMARY.search.perKeyword` shows the count per keyword; only delivered rows are charged.

**Can I search and read channels in one run?** This form is for keywords. `urls` from YouTube Channel Scraper is also accepted through the API.

**What happens with a mistake in the input?** A value that is not text, a search link without search words or more than 200 characters gives a free `invalid_input` row and the run ends normally. An unknown sort or type value falls back to the default and is listed in `SUMMARY.inputNotes`.

**Does the Actor collect usage data?** The Actor sends one anonymous usage counter per run (input type, item count range, outcome) to improve the tool; no URLs, content or account data.

### Support

Open an issue in the **Issues** tab with your input and the run link. Issues are checked regularly.

# Actor input Schema

## `keywords` (type: `array`):

What you would type in YouTube's search box: one search per line, in any language (n8n tutorial, 教學 n8n). A pasted youtube.com/results link also works. Each result video or Short is one row. Up to 200 characters per search.

## `maxResultsPerKeyword` (type: `integer`):

Stop each keyword after this many rows (at most 500). The whole run also stops at "Max videos per run".

## `searchSort` (type: `string`):

The order YouTube returns the results in. Not used with an upload date below: YouTube does not combine them.

## `searchUploadDate` (type: `string`):

Only results uploaded in about this period (ages on YouTube are rounded); much older videos YouTube lists anyway are skipped and free. YouTube no longer offers a newest-first order, so this is how to get recent videos.

## `searchType` (type: `string`):

Which results to return. Channels, playlists and ads in the results are never returned.

## `videoDetails` (type: `boolean`):

Off: each row comes from the results page ($1 per 1,000). On: each video's page is read too, adding exact views, likes, exact publish date and time, category, tags, hashtags, chapters, full description, caption languages and live status ($2 per 1,000, charged instead).

## `publishedAfter` (type: `string`):

A date (2026-09-01) or a period (7 days, 2 weeks, 3 months). The results page shows only an age such as "2 weeks ago", so the cut-off is approximate unless full details are on. Older videos are skipped and free.

## `onlyNewVideos` (type: `boolean`):

For scheduled runs: return (and charge) only results that earlier runs with the same monitor name did not return. Best with Upload date: This week.

## `monitorName` (type: `string`):

Separate monitors keep separate memories (letters, digits and dashes). Only used with monitoring on.

## `maxResults` (type: `integer`):

The run stops after this many rows, whatever the number of keywords. A cost cap on top of Apify's maximum charge per run.

## `httpVia` (type: `string`):

Every request uses our own user agent, with no cookies, login or browser. If YouTube refuses one network (consent page, bot check, HTTP 429), Auto retries the first result page from our servers. Further result pages come from Apify's network only.

## `proxyConfiguration` (type: `object`):

Only used for requests sent from Apify's network. Apify proxy usage is billed to your Apify account.

## `maxConcurrency` (type: `integer`):

How many YouTube pages are read at the same time.

## Actor input object example

```json
{
  "keywords": [
    "n8n tutorial"
  ],
  "maxResultsPerKeyword": 20,
  "searchSort": "relevance",
  "searchUploadDate": "any",
  "searchType": "all",
  "videoDetails": false,
  "onlyNewVideos": false,
  "monitorName": "default",
  "maxResults": 1000,
  "httpVia": "auto",
  "maxConcurrency": 5
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `summary` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "keywords": [
        "n8n tutorial"
    ],
    "maxResultsPerKeyword": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("tidytools/youtube-search-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "keywords": ["n8n tutorial"],
    "maxResultsPerKeyword": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("tidytools/youtube-search-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "keywords": [
    "n8n tutorial"
  ],
  "maxResultsPerKeyword": 20
}' |
apify call tidytools/youtube-search-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,tidytools/youtube-search-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/MVVqYaysgC6OBlYwP/builds/559KOo10xXnx76egd/openapi.json
