# YouTube Search Scraper - Keyword Results, Views, 4K, Filters (`ai-lead-gen-tools/youtube-search`) Actor

\[💰$0.10/1K] Scrape YouTube search results for any keyword: one row per video, Short, channel or playlist with title, URL, views, duration, upload age, channel link and rank. Upload date, length, 4K, HD, subtitles and live are sent as native YouTube filters. Export to CSV or Excel. No API key.

- **URL**: https://apify.com/ai-lead-gen-tools/youtube-search.md
- **Developed by:** [Vladimir Che](https://apify.com/ai-lead-gen-tools) (community)
- **Categories:** Social media, Marketing, Videos
- **Features:** Limited permissions
- **Stats:** 3 total users, 2 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.10 / 1,000 search result scrapeds

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

## YouTube Search Scraper - Keyword Results, Views, 4K, Filters

Search YouTube by keyword and export the results as a dataset. No login, no YouTube API key.

The source is YouTube's own search page read as a logged-out visitor. Filters are encoded into YouTube's native search parameters, so YouTube returns a narrower list instead of this actor dropping rows it already fetched.

### What you get

One row per result. Channels, playlists, videos and Shorts share the same field set, so the column layout is stable between runs and between result kinds.

| Group | Fields |
|---|---|
| Identity | `resultId`, `kind`, `videoId`, `playlistId`, `channelId`, `title`, `url` |
| Placement | `query`, `queryIndex`, `page`, `rank` |
| Channel | `channelName`, `channelHandle`, `channelUrl`, `channelAvatarUrl` |
| Video | `description`, `durationSecs`, `durationText`, `views`, `viewsText`, `shortViewCountText`, `isLive` |
| Channel row | `subscribers`, `subscribersText`, `verified` |
| Playlist row | `videoCount`, `videoCountText` |
| Date | `publishedText`, `publishedAgeSecs`, `publishedAtFrom`, `publishedAtTo`, `publishedPrecision` |
| Media | `thumbnailUrl` |
| Meta | `status`, `filterReason`, `scrapedAt` |

`kind` is one of `video`, `live`, `short`, `channel`, `playlist`. Every field is always present, `null` when the result kind does not carry it.

A real row, taken from `test/output-sample.json` and produced by a real run:

```json
{
  "resultId": "video:iVLr-PKuSd0",
  "kind": "video",
  "query": "test",
  "queryIndex": 0,
  "page": 1,
  "rank": 1,
  "title": "Ultimate 4K OLED Test Experience: Incredible 16K HDR 60fps Dolby Vision Visuals (8K Video Ultra HD)",
  "url": "https://www.youtube.com/watch?v=iVLr-PKuSd0",
  "videoId": "iVLr-PKuSd0",
  "playlistId": null,
  "channelId": "UChB3UnDddahXU7FKZXmpzMA",
  "channelHandle": "@8kEarth",
  "channelName": "8K Earth",
  "channelUrl": "https://www.youtube.com/@8kEarth",
  "channelAvatarUrl": "https://yt3.ggpht.com/I2tG3EKGxL0uvDi_eNr8bfD1IAgWj4eMpdqgHyc77qphTTCr3vvNCIM8LTkmEOJl27Bk9AlH=s68-c...",
  "description": "Ultimate OLED Display Test in 16K HDR 60fps with Dolby Vision visuals. Built for 4K OLED and 8K Vide...",
  "durationSecs": 4820,
  "durationText": "1:20:20",
  "views": 565904,
  "viewsText": "565,904 views",
  "shortViewCountText": "565K views",
  "subscribers": null,
  "subscribersText": null,
  "videoCount": null,
  "videoCountText": null,
  "publishedText": "7 days ago",
  "publishedAgeSecs": 604800,
  "publishedAtFrom": "2026-11-02T08:05:16.474Z",
  "publishedAtTo": "2026-11-03T08:05:16.474Z",
  "publishedPrecision": "text-interval",
  "isLive": false,
  "verified": null,
  "thumbnailUrl": "https://i.ytimg.com/vi/iVLr-PKuSd0/hq720.jpg?sqp=-oaymwEcCNAFEJQDSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs...",
  "status": "ok",
  "filterReason": null,
  "scrapedAt": "2026-11-10T08:05:16.474Z"
}
```

Long fields are truncated with `...` in this sample. Output is available as JSON, CSV or Excel from the dataset tab.

### How to use it

1. Open this actor in the Apify Console.
2. Put one keyword into **Search query**, or many into **Queries**. Both are read when both are set, up to 100 keywords.
3. Pick what comes back with **Result type**: videos, Shorts, channels or playlists. Leave it empty to take whatever YouTube ranks first.
4. Click Start, then export the dataset as CSV, Excel or JSON, or read it through the Apify API.

A run that covers most use cases:

```json
{
  "searchQuery": "tech review",
  "type": "video",
  "maxResults": 50,
  "uploadDate": "month",
  "duration": "medium",
  "sortBy": "popularity"
}
```

Parameters, one to one with the input schema.

| Input | Default | Notes |
|---|---|---|
| `searchQuery` | empty | one keyword as a single line, for API runs |
| `queries` | `[]` | several keywords in one run, up to 100 |
| `type` | empty | `video`, `shorts`, `channel`, `playlist`, `movie`; empty takes every kind |
| `maxResults` | `50` | cap on the whole dataset |
| `maxResultsPerQuery` | `50` | cap on one keyword |
| `maxPagesPerQuery` | `10` | pagination depth, about 20 results per page |
| `sortBy` | `relevance` | `relevance` or `popularity` |
| `uploadDate` | empty | `today`, `week`, `month`, `year`, a rolling window from now |
| `duration` | empty | `short` under 4 minutes, `medium` 4 to 20, `long` over 20 |
| `features` | `[]` | `hd`, `uhd4k`, `subtitles`, `live`, `creativeCommons`, `deg3d`, `deg360`, `hdr`, `vr180`, `location`, `purchased` |
| `language` | `en` | YouTube `hl`, the interface language the labels are parsed in |
| `region` | `US` | YouTube `gl`, the country the ranking is built for |
| `sameDomainDelaySecs` | `1` | minimum gap between two requests to youtube.com |
| `requestTimeoutSecs` | `30` | per-request timeout before a retry |
| `runBudgetSecs` | the run timeout | leave it empty and the run uses the whole timeout you set |
| `proxyConfiguration` | no proxy | not required, worth enabling on wide sweeps |

`sortBy` has only two values because YouTube search only has two. There is no "sort by upload date" on YouTube search: the results page offers relevance and popularity, and the date chips are filters, not orders. To read the freshest results, set `uploadDate` to `today` or `week`.

The summary records the exact `params` string that was sent, so any run can be reproduced.

#### Ready-made tasks

Four saved inputs, one per question this actor answers. Each one shows only the fields it needs, and each returns data on its first run.

| Task | Input | Question it answers |
|---|---|---|
| [YouTube Video Search: Titles, Views and Channels](https://apify.com/ai-lead-gen-tools/youtube-search/examples/youtube-video-search) | `searchQuery`, `uploadDate` | which videos rank for a keyword, with views, duration and publish date |
| [YouTube Channel Search: Handles, Subs, Country](https://apify.com/ai-lead-gen-tools/youtube-search/examples/youtube-channel-search) | `searchQuery`, `type: channel` | which channels carry a keyword, with handle, subscribers and country |
| [YouTube Keyword Research: Many Queries, One Run](https://apify.com/ai-lead-gen-tools/youtube-search/examples/youtube-keyword-research) | `queries`, `maxResultsPerQuery` | how one shelf compares across several keywords in a single run |
| [YouTube New Videos: Daily Results for a Keyword](https://apify.com/ai-lead-gen-tools/youtube-search/examples/youtube-new-videos-daily) | `searchQuery`, `uploadDate: today` | what was published on this keyword today, ready for a schedule |

### Use cases

- **Content research on a niche.** Pull the top results for a topic with `sortBy: popularity` and see which formats and channels already win the shelf.
- **Competitor monitoring.** Run the same keyword daily on `uploadDate: today` and diff the result ids to see who publishes what.
- **Keyword and title mining.** Export titles of the top 200 results for a topic and reuse the wording that ranks.
- **Influencer and channel sourcing.** Set `type: channel` and collect channels for a keyword, then feed the ids into a channel actor.

### Cost

The price is **$0.10 per 1 000 results**, which is $0.0001 per result. The Store adds its 20 % margin, so a buyer pays $0.12 per 1 000. One `apify-actor-start` charge of $0.00005 applies per run.

You pay for a saved result row with `status: ok` and a `resultId`. Nothing else is charged:

- a keyword that yields nothing still leaves a row, with `no-results` and free;
- a failed request leaves a row with `fetch-failed` and costs nothing;
- `budget-exhausted` and `invalid-input` rows are free;
- every row charges the same, whether it is a video, a channel or a playlist.

### Honest limits

- **View counts are abbreviated on the page.** `views` is exact only below 1 000. `189K` becomes `189000` and `2,8 млн просмотров` becomes `2800000`, so a large count is an approximation of the printed label.
- **There is no absolute upload date.** The page renders age as text, so `publishedAtFrom` and `publishedAtTo` bound the real timestamp and `publishedPrecision` is always `text-interval`. Shorts list rows render no age at all, so their date fields are null rather than guessed.
- **Labels are parsed in 23 European interface languages.** Outside that set you still get `publishedText` and `viewsText` as rendered, but the parsed numbers may stay null.
- **A channel row carries no video counter.** YouTube renders none on the search page, so `videoCount` and `videoCountText` are filled on playlist rows only.
- **`duration: long` cannot filter a livestream.** `durationSecs` is null for livestreams that render no length, and a row with an unknown duration always survives that filter.
- **A busy schedule on one IP can meet HTTP 429.** Raise `sameDomainDelaySecs` or attach a proxy, both are input fields.

### FAQ

**Do I need a YouTube API key?**
No. The actor reads the public search page. There is no key and no quota to manage.

**Why are `subscribers` null on video rows?**
YouTube renders a subscriber counter only on channel rows of a search page. The field is null where the page shows no counter, it is not zero.

**How do I get the newest videos only?**
Set `uploadDate` to `today` or `week`. It is a rolling window measured from the moment of the run, not a calendar date.

**Can one run cover several keywords?**
Yes. Put them in `queries`, up to 100. Each row carries `query` and `queryIndex`, so results from different keywords never get mixed up.

**Why does the same Short appear twice on the page?**
A Shorts shelf is repeated across result pages and can list the same Short more than once. Rows are deduplicated by id across the whole run, so one video is written once.

**Is `sortBy: popularity` the same as most viewed?**
No. YouTube ranks popularity by its own signal, not by the view column. Sort the dataset by `views` yourself if you need a strict order.

**What happens when a keyword returns nothing?**
The run still succeeds and writes one row with `status: no-results`. It is free and visible in the dataset instead of the run log.

**Can I limit the cost of a run?**
Set `maxResults` and `maxResultsPerQuery`. Paging deeper costs more rows, and rows are what you pay for.

### Related actors

Other actors in the YouTube group, each with its own dataset and price:

- [YouTube Comments Scraper](https://apify.com/ai-lead-gen-tools/youtube-comments) - comments and replies on a video, a channel or a keyword.
- [YouTube Channel Contacts](https://apify.com/ai-lead-gen-tools/youtube-channel-contacts) - emails and social profiles of channels, with subscriber metrics.
- [YouTube Channel Discovery](https://apify.com/ai-lead-gen-tools/youtube-channel-discovery) - channels by keyword, with filters by size, country and verification.
- [YouTube Similar Channels](https://apify.com/ai-lead-gen-tools/youtube-similar-channels) - channels close to a seed channel, for lookalike prospecting.

### Changelog

- 2026-11-12: published in the Store, pay per result with a free run start.
- 2026-11-10: first build on the platform.

# Actor input Schema

## `searchQuery` (type: `string`):

Single keyword or phrase to search YouTube for.

## `queries` (type: `array`):

Several keywords in one run. Every keyword is searched separately and its results carry the keyword in the `query` field. Combined with `searchQuery`, both are used. Up to 100 values.

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

What to return. `video` returns videos and livestreams, `shorts` returns Shorts, `channel` returns channels, `playlist` returns playlists. Leave empty to get whatever YouTube ranks first, all types mixed.

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

Hard cap on rows in the dataset across all keywords. Set 0 for no global cap.

## `maxResultsPerQuery` (type: `integer`):

Hard cap on rows taken from one keyword.

## `maxPagesPerQuery` (type: `integer`):

Upper bound of result pages requested for one keyword. One page holds about 20 results.

## `sortBy` (type: `string`):

YouTube search offers only two orders: relevance and popularity. There is no sort by upload date on YouTube search, use `uploadDate` to narrow the age window instead.

## `uploadDate` (type: `string`):

Keep only results published inside this window. Applied by YouTube itself.

## `duration` (type: `string`):

Keep only results inside this length bucket. The boundary is 4 minutes and 20 minutes.

## `features` (type: `array`):

Extra YouTube search filters. Every listed feature must be present. `hd` is high definition, `uhd4k` is 4K, `subtitles` is closed captions, `live` is a livestream, `creativeCommons` is a CC licence, `deg3d` is 3D, `deg360` is 360 degrees, `hdr` is HDR, `vr180` is VR180, `location` is geotagged, `purchased` is a purchased title.

## `language` (type: `string`):

Language of the results page, as a two letter code. Affects the language YouTube prefers and the wording of age, view and duration labels. Rendered labels are parsed in 23 European languages.

## `region` (type: `string`):

Country of the results page, as a two letter code, e.g. US, DE, JP. Changes which results YouTube ranks first.

## `sameDomainDelaySecs` (type: `number`):

Pause in seconds before each request to youtube.com. Raising it lowers the chance of an HTTP 429.

## `requestTimeoutSecs` (type: `integer`):

Timeout of one HTTP request in seconds.

## `runBudgetSecs` (type: `integer`):

Soft time budget for the whole run, in seconds. The run stops paginating before the platform timeout and marks the summary as budget exhausted.

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

Proxy for the requests to youtube.com. Optional: the actor works without a proxy, but a proxy lowers the risk of a temporary block on a busy schedule.

## Actor input object example

```json
{
  "searchQuery": "test",
  "queries": [],
  "maxResults": 3,
  "maxResultsPerQuery": 3,
  "maxPagesPerQuery": 1,
  "sortBy": "relevance",
  "features": [],
  "language": "en",
  "region": "US",
  "sameDomainDelaySecs": 1,
  "requestTimeoutSecs": 30,
  "runBudgetSecs": 60,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `dataset` (type: `string`):

One row per result: kind, title, URL, id, channel name, channel id, handle and avatar, view count, duration, upload age interval and thumbnail. Every field is always present, unknown values are null and never omitted, so the column set is stable between runs and between result kinds.

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

Counters for the run: keywords searched, results collected, pages fetched, duplicates skipped, failures, the filters actually applied, the encoded YouTube search parameters, the budget state and how many events were charged.

# 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 = {
    "searchQuery": "test",
    "maxResults": 3,
    "maxResultsPerQuery": 3,
    "maxPagesPerQuery": 1,
    "runBudgetSecs": 60
};

// Run the Actor and wait for it to finish
const run = await client.actor("ai-lead-gen-tools/youtube-search").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 = {
    "searchQuery": "test",
    "maxResults": 3,
    "maxResultsPerQuery": 3,
    "maxPagesPerQuery": 1,
    "runBudgetSecs": 60,
}

# Run the Actor and wait for it to finish
run = client.actor("ai-lead-gen-tools/youtube-search").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 '{
  "searchQuery": "test",
  "maxResults": 3,
  "maxResultsPerQuery": 3,
  "maxPagesPerQuery": 1,
  "runBudgetSecs": 60
}' |
apify call ai-lead-gen-tools/youtube-search --silent --output-dataset

```

## MCP server setup

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

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/F4VloYZDE5wVHXQI3/builds/5caQ8Pha8YuUpLMXr/openapi.json
