# YouTube Search Results Scraper: Filters, Views, Duration (`skillmerc/youtube-search-scraper`) Actor

Search YouTube by keyword and get one row per result: videos, Shorts, live streams, channels or playlists, with views, duration, date as shown and channel. Filters for upload date, type, duration, 4K, subtitles and popularity. No login, no API key.

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

## Pricing

from $0.40 / 1,000 search results

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

For marketers, researchers and creators who need YouTube search results in a spreadsheet: give keywords, get one row per result (video, Short, live stream, channel or playlist) with views, duration, date as shown and channel, using YouTube's own search filters.

### What it does

- Searches YouTube for each of your keywords, logged out, the way a visitor in the US sees the results.
- One row per result, in YouTube's order, with its position on the results list.
- Uses YouTube's own filters: result type, upload date, duration, popularity and features such as 4K or subtitles.
- Pages through the results until it has as many as you asked for, or YouTube has no more.
- Skips ads and the shelves YouTube mixes in ("Shorts", "People also watched"). They are never charged.
- No login, no YouTube API key, no browser.

It does not fetch transcripts, comments or the video files. To list one channel's uploads, our YouTube Channel Videos Scraper actor on Apify does that; for transcripts, our "YouTube Transcript Scraper: Subtitles & Captions" actor.

### Input

| Field | What it means |
|-|-|
| `searchQueries` | Keywords, one per line, as you would type them into YouTube. Each query is searched on its own. |
| `maxResultsPerQuery` | Most results per query. Default 50. `0` means as many as YouTube shows (capped at 5,000). YouTube often stops after a few hundred. |
| `type` | `video` (default), `short`, `live` (live now), `channel` or `playlist`. |
| `uploadDate` | `any` (default), `hour`, `today`, `week`, `month`, `year`. |
| `duration` | `any` (default), `under3` (under 3 minutes), `3to20`, `over20`. |
| `sortBy` | `relevance` (default) or `popularity`. |
| `features` | Optional: `4k`, `hd`, `subtitles`, `creativeCommons`. A video must have all you pick. |

Example:

```json
{
  "searchQueries": ["home espresso", "rust programming"],
  "maxResultsPerQuery": 100,
  "type": "video",
  "uploadDate": "month",
  "duration": "3to20",
  "sortBy": "relevance"
}
```

### Filters

All filters are YouTube's own: the actor sends the same filter code YouTube's filter menu sends, so you get what YouTube would show you. We checked each one against live searches on 20 Nov 2026:

- Type: video, Shorts, live now, channel and playlist each return only that kind of result. `video` includes past live streams and Shorts that YouTube lists as videos (they come with `type` set to `live` or `short`).
- Upload date: last hour, today, this week, this month and this year. "Last hour" is no longer in YouTube's menu, but YouTube still honours it.
- Duration: under 3 minutes, 3 to 20 minutes, over 20 minutes. These are YouTube's current lengths (it used to offer under 4 and 4 to 20 minutes).
- Sort: relevance or popularity. YouTube's popularity order is its own and is not strictly by view count. YouTube no longer offers sorting by upload date or rating, so neither is offered here; use the Upload date filter for fresh results.
- Features: 4K, HD, subtitles/CC and Creative Commons change the results the way YouTube's menu does. We do not check each video's licence or subtitles ourselves.
- Duration and features apply to videos. YouTube may ignore them for channel and playlist results; the run says so in its warnings.

### Output

One row per result in the default dataset. A video:

```json
{
  "query": "rust programming",
  "position": 1,
  "type": "video",
  "videoId": "flS3cmjcows",
  "channelId": "UCSp-OaMpsO8K0KkOqyBl7_w",
  "channelHandle": "@letsgetrusty",
  "playlistId": null,
  "url": "https://www.youtube.com/watch?v=flS3cmjcows",
  "title": "How to Learn Rust in 2027 (Step by Step Roadmap)",
  "channelTitle": "Let's Get Rusty",
  "publishedText": "2 days ago",
  "publishedAt": "2026-11-18T03:00:00.000Z",
  "publishedAtApproximate": true,
  "durationText": "5:51",
  "durationSeconds": 351,
  "viewCount": 30405,
  "viewCountApproximate": false,
  "viewCountText": "30,405 views",
  "watchingCount": null,
  "subscriberCountText": null,
  "subscriberCount": null,
  "videoCountText": null,
  "descriptionSnippet": "Join the Rust Live Accelerator waitlist: ...",
  "thumbnailUrl": "https://i.ytimg.com/vi/flS3cmjcows/hq720.jpg",
  "badges": ["New", "4K"],
  "isLive": false,
  "isUpcoming": false,
  "isShort": false,
  "upcomingStartTime": null,
  "scrapedAt": "2026-11-20T15:00:00.000Z"
}
```

- `type` is `video`, `short`, `live`, `channel` or `playlist`. Every row has the same fields; the ones a result card does not show are `null`.
- Videos: views are exact when YouTube shows the full number ("30,405 views"). Rounded numbers ("1.1M views", shown on Shorts) are converted and flagged `viewCountApproximate: true`.
- Live now: `isLive: true`, `watchingCount` as shown, no view count or date. Upcoming streams have `isUpcoming: true` and `upcomingStartTime`.
- Shorts: YouTube's Shorts tiles show only a title and views, so Shorts rows have no channel, date or duration.
- Channels: `title`, `channelHandle`, `subscriberCountText` and `subscriberCount` as shown, `descriptionSnippet` (the short text on the card), avatar in `thumbnailUrl`.
- Playlists: `playlistId`, `title`, the channel, `videoCountText` ("7 videos") and the cover image.
- `descriptionSnippet` is the text YouTube shows under the result, not the full description.
- `badges` are the labels on the card, such as "New", "4K", "CC" or "LIVE".
- The `OUTPUT` record in the key-value store holds the run summary: counts per query, ads and shelves skipped, failures and warnings.

### How dates work

YouTube search shows relative dates such as "2 days ago". We never pass those off as exact.

- `publishedText` holds the text as YouTube showed it.
- `publishedAt` is the middle of the window the text allows, always flagged `publishedAtApproximate: true`. "2 days ago" means between 2 and 3 days ago; "3 years ago" can be a year off.
- Live streams that are on air now have no date.

### Pricing

Pay per event: you pay for each result row delivered.

| Apify plan | Price per 1,000 results |
|---|---|
| Free | USD 0.60 |
| Bronze | USD 0.50 |
| Silver | USD 0.45 |
| Gold and above | USD 0.40 |

Plus USD 0.00005 per run start. Ads, shelves, duplicates and failed queries are free. The run stops when it reaches the maximum cost you set.

### When something fails

A query that is empty, finds no results with your filters, or that YouTube refuses goes into the free named dataset `youtube-search-failed` and the `OUTPUT` record, with the reason. Nothing is charged for it and the run still finishes as succeeded.

| Reason | What it means |
|-|-|
| `empty_query` | The query line was empty. |
| `no_results` | YouTube found nothing for this query with these filters. |
| `blocked` | YouTube refused the request even through a fresh IP. Try again later. |
| `error` | Something else went wrong; the message says what. |

If YouTube corrects the spelling of a query and shows results for another phrase, the results are delivered and the `OUTPUT` warnings name the phrase YouTube used. The same query given twice is searched once. The same result appearing twice in one query's pages is delivered once.

### Speed and limits

- One request at a time, at least 300 ms apart, with backoff when YouTube asks us to slow down. A page holds about 20 results, so 1,000 results take about 50 requests.
- We read YouTube in English from the US. Results, counts and texts follow that.
- If YouTube refuses Apify's own IP, the run switches to Apify's datacenter proxy. It never uses residential proxies or logs in.
- Private, members-only and age-restricted content is not opened. The actor only reads the search results page.

### Is it legal?

This actor reads only YouTube's public search results, which anyone can see without an account. It does not open videos, download them, collect comments or look for emails or phone numbers. Titles, channel names, handles and description snippets are copied as YouTube shows them; channel names and handles can be personal data. You need a lawful basis to collect and use them (for example under GDPR or POPIA), and you are responsible for how you use the results. Respect YouTube's terms and the creators' rights.

This actor is not made, endorsed or sponsored by YouTube or Google.

# Actor input Schema

## `searchQueries` (type: `array`):

What you would type into YouTube's search box. One query per line. Each query is searched on its own with the same filters.

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

Most results to return for each query. 0 means as many as YouTube shows (capped at 5,000). YouTube itself often stops after a few hundred results.

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

Which results to return, using YouTube's own Type filter. Videos includes past live streams and Shorts that YouTube lists as videos. Live returns streams that are live now.

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

YouTube's Upload date filter. Last hour is not in YouTube's menu any more but YouTube still honours it.

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

YouTube's Duration filter for videos, as YouTube offers it today: under 3 minutes, 3 to 20 minutes, over 20 minutes.

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

YouTube's Prioritize setting: relevance or popularity. YouTube no longer offers sorting by upload date or rating; use the Upload date filter for fresh results.

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

Optional. Only videos with all the features you pick: 4K, HD, subtitles/CC, Creative Commons licence.

## Actor input object example

```json
{
  "searchQueries": [
    "home espresso",
    "rust programming"
  ],
  "maxResultsPerQuery": 50,
  "type": "video",
  "uploadDate": "any",
  "duration": "any",
  "sortBy": "relevance",
  "features": []
}
```

# 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 = {
    "searchQueries": [
        "home espresso",
        "rust programming"
    ],
    "maxResultsPerQuery": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("skillmerc/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 = {
    "searchQueries": [
        "home espresso",
        "rust programming",
    ],
    "maxResultsPerQuery": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("skillmerc/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 '{
  "searchQueries": [
    "home espresso",
    "rust programming"
  ],
  "maxResultsPerQuery": 50
}' |
apify call skillmerc/youtube-search-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,skillmerc/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/bCDUx4mArjhVrtMr0/builds/ZxTx0eA9SWR15h9k1/openapi.json
