# YouTube Search Scraper (`cirkit/youtube-search-scraper`) Actor

Fast YouTube search scraper. Pass any query (or list) and extract every matching video with full metadata. Filters: upload date, duration, sort, type, features (HD/4K/CC/Live). Optional channel scoping. Direct InnerTube API, no browser. PPE pricing.

- **URL**: https://apify.com/cirkit/youtube-search-scraper.md
- **Developed by:** [Crikit](https://apify.com/cirkit) (community)
- **Categories:** Social media
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## YouTube Search Scraper

Fast, no-browser YouTube search scraper that turns any free-text query into a flat dataset of video, channel, and playlist results. Direct InnerTube API reads. PPE pricing.

### What you get

For every search query you pass in, the YouTube Search Scraper returns one row per matching video with full metadata. When you allow channels and playlists in the result mix, those also flow into the same dataset, tagged with a clean `type` column so downstream filtering is one keystroke.

Per-video fields include the exact integer view count (not just "6.8M"), an approximate ISO date for the upload (computed from YouTube's "2 years ago" style string), exact duration in seconds, channel name plus channel ID plus channel handle plus verified flag, all thumbnail resolutions, the animated hover preview, the description snippet shown on the results page, and every video-level badge (4K, CC, Live, New, HDR, etc.). Live streams are flagged with an `isLive` boolean.

### When to use this actor

- Content gap analysis for an Airbnb host, brand, or creator: pull every video for a topic, slice by recency, find under-served angles.
- Trend monitoring: dump 1000 results sorted by date for a query, run it daily, diff the result set.
- Competitor video discovery: scope to a single channel ID and search across its uploads.
- Ad campaign research: filter to HD only, sort by views, study the top performers.
- AI training data: bulk extract title, description, view counts, and metadata across thousands of queries.

### Inputs

`searchQueries` is the only required input. Everything else is optional.

- `searchQueries` (array of strings): one or more queries. YouTube search operators work inside the query string, for example `"iphone 15"`, `before:2024`, `-plus`, `channel:mkbhd`.
- `maxResultsPerQuery` (integer, default 100, max 1000): hard cap on rows per query. YouTube itself stops issuing pagination around 600 to 1000 results; values above are silently clipped.
- `sortBy` (relevance / date / views / rating): result order.
- `uploadDate` (any / last_hour / today / week / month / year): restrict to recent videos. Setting this forces type=video.
- `duration` (any / short / medium / long): under 4 min, 4 to 20 min, over 20 min. Setting this forces type=video.
- `type` (any / video / channel / playlist / movie): restrict result type.
- `features` (array): any of `live`, `hd`, `4k`, `subtitles`, `cc_license`, `3d`, `hdr`, `360`, `vr180`, `location`, `purchased`. Setting any forces type=video.
- `channelId`: optional channel scoping. Accepts UC..., a /channel/UC... URL, a /@handle URL, or just an @handle. Free-text filters above are ignored when a channel is set.
- `proxyConfiguration`: Apify proxy options. Datacenter is sufficient for routine volume; switch to Residential at scale.

### Output

One JSON row per result. The dataset has a built-in table view (Overview) with the most useful columns. Every row contains:

- `type` (video / channel / playlist)
- `query`, `resultRank`
- `videoId`, `url`, `title`, `description`
- `channelTitle`, `channelId`, `channelHandle`, `channelUrl`, `channelIsVerified`
- `viewCount` (exact int), `viewCountText`, `shortViewCountText`
- `publishedTimeText` (relative), `publishedDateApprox` (ISO date)
- `lengthText`, `lengthSeconds`
- `isLive`, `badges`
- `thumbnails`, `richThumbnails`
- For channels: `subscriberCount`, `subscriberCountText`, `videoCount`
- For playlists: `playlistId`, `videoCount`, `videoCountText`

### Pricing

Flat $0.002 per result. No actor-start fee. A 1000-result run costs $2.00. The default 100-result run costs $0.20.

This actor undercuts the popular alternatives by 30 to 60 percent for the same query, because the InnerTube API is fast (under 1 second per page of 20 results) and the runtime never spins up a browser.

### How it works

The YouTube Search Scraper bootstraps a session by hitting youtube.com once to pin the current InnerTube client version and visitor data, then issues POST requests to `/youtubei/v1/search` for each query. TLS impersonation (Chrome 131 fingerprint via `curl_cffi`) is used so the requests look identical to real browser traffic. Pagination is via opaque continuation tokens, capped at 60 pages or your `maxResultsPerQuery`, whichever is smaller. No browser is launched. No Selenium. No Puppeteer. No CAPTCHAs.

### Tips

- For the largest result sets (around 1000 per query), expect 30 to 60 seconds per query end-to-end with Apify datacenter proxy.
- Pass many narrow queries instead of one broad one if you want more than 1000 results on a topic. Queries are scraped independently and de-duplication on `videoId` is up to you.
- Combine `sortBy=date` with `uploadDate=week` for a fresh-uploads digest of any topic.
- Combine `sortBy=views` with `duration=long` to find long-form best-performers.

### Limits and notes

- YouTube's pagination ceiling is around 600 to 1000 results per query, regardless of how many estimated matches the response advertises. This is a hard wall on YouTube's side, not in this actor.
- `publishedDateApprox` is computed from the relative time ("2 years ago") and the run timestamp. Day-level precision at best. For the exact upload date, follow up with the per-video player API (out of scope here).
- Live streams and premieres legitimately lack `viewCount`, `lengthText`, and `publishedTimeText`. The actor leaves those fields null.
- Channel scoping uses the channel's "Search" tab, which is search-within-uploads only. Free-text filters above (`uploadDate`, `duration`, `features`, `sortBy`) are ignored when `channelId` is set.

### API and integrations

Every Apify actor exposes a REST API for triggering runs and pulling datasets from any language. Python, Node.js, Go, curl: any client that can speak HTTP can drive the YouTube Search Scraper, schedule it on a cron, and stream the dataset into a database or analytics stack. The dataset can be exported as JSON or CSV directly from the run's Storage tab.

# Actor input Schema

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

One or more free-text search queries. YouTube search operators work in the query itself, for example "iphone 15" -plus or before:2024.
## `maxResultsPerQuery` (type: `integer`):

Hard cap on results returned per query. YouTube itself tops out around 600 to 1000 results per query, so values above 1000 are silently clipped.
## `sortBy` (type: `string`):

Result order. "relevance" is YouTube's default ranking. "date" returns newest first, "views" returns most viewed first, "rating" returns highest rated.
## `uploadDate` (type: `string`):

Restrict to videos uploaded within this window. Ignored unless type is "video" or "any".
## `duration` (type: `string`):

short = under 4 minutes, medium = 4 to 20 minutes, long = over 20 minutes. Ignored unless type is "video" or "any".
## `type` (type: `string`):

Restrict results to a single type. "any" lets YouTube return a mix of videos, channels, and playlists. Note: applying upload date, duration, or feature filters forces type to "video".
## `features` (type: `array`):

Restrict to videos with one or more of these flags. Selecting any flag forces type to "video".
## `channelId` (type: `string`):

Restrict results to a single channel's uploads. Accepts a channel ID (UC...), a /channel/UC... URL, a /@handle URL, or just an @handle. Free-text filters above are ignored when a channel is set.
## `proxyConfiguration` (type: `object`):

Apify datacenter proxy is sufficient for routine search volume. Switch to Residential if you hit throttling at very high volume or from blocked geographies.

## Actor input object example

```json
{
  "searchQueries": [
    "iphone 15 review"
  ],
  "maxResultsPerQuery": 100,
  "sortBy": "relevance",
  "uploadDate": "any",
  "duration": "any",
  "type": "any",
  "features": [],
  "channelId": "",
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
````

# Actor output Schema

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

All search results extracted in the latest run.

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

All search results in CSV format.

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

All search results in JSON format.

## `consoleRun` (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": [
        "iphone 15 review"
    ],
    "maxResultsPerQuery": 100,
    "sortBy": "relevance",
    "uploadDate": "any",
    "duration": "any",
    "type": "any",
    "channelId": "",
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("cirkit/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": ["iphone 15 review"],
    "maxResultsPerQuery": 100,
    "sortBy": "relevance",
    "uploadDate": "any",
    "duration": "any",
    "type": "any",
    "channelId": "",
    "proxyConfiguration": { "useApifyProxy": True },
}

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

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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": [
    "iphone 15 review"
  ],
  "maxResultsPerQuery": 100,
  "sortBy": "relevance",
  "uploadDate": "any",
  "duration": "any",
  "type": "any",
  "channelId": "",
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call cirkit/youtube-search-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=cirkit/youtube-search-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "YouTube Search Scraper",
        "description": "Fast YouTube search scraper. Pass any query (or list) and extract every matching video with full metadata. Filters: upload date, duration, sort, type, features (HD/4K/CC/Live). Optional channel scoping. Direct InnerTube API, no browser. PPE pricing.",
        "version": "0.4",
        "x-build-id": "keBW1E6wn2W3l6WKD"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/cirkit~youtube-search-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-cirkit-youtube-search-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/cirkit~youtube-search-scraper/runs": {
            "post": {
                "operationId": "runs-sync-cirkit-youtube-search-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/cirkit~youtube-search-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-cirkit-youtube-search-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "searchQueries"
                ],
                "properties": {
                    "searchQueries": {
                        "title": "Search queries",
                        "minItems": 1,
                        "uniqueItems": true,
                        "type": "array",
                        "description": "One or more free-text search queries. YouTube search operators work in the query itself, for example \"iphone 15\" -plus or before:2024.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxResultsPerQuery": {
                        "title": "Max results per query",
                        "minimum": 1,
                        "maximum": 1000,
                        "type": "integer",
                        "description": "Hard cap on results returned per query. YouTube itself tops out around 600 to 1000 results per query, so values above 1000 are silently clipped.",
                        "default": 100
                    },
                    "sortBy": {
                        "title": "Sort by",
                        "enum": [
                            "relevance",
                            "date",
                            "views",
                            "rating"
                        ],
                        "type": "string",
                        "description": "Result order. \"relevance\" is YouTube's default ranking. \"date\" returns newest first, \"views\" returns most viewed first, \"rating\" returns highest rated.",
                        "default": "relevance"
                    },
                    "uploadDate": {
                        "title": "Upload date filter",
                        "enum": [
                            "any",
                            "last_hour",
                            "today",
                            "week",
                            "month",
                            "year"
                        ],
                        "type": "string",
                        "description": "Restrict to videos uploaded within this window. Ignored unless type is \"video\" or \"any\".",
                        "default": "any"
                    },
                    "duration": {
                        "title": "Duration filter",
                        "enum": [
                            "any",
                            "short",
                            "medium",
                            "long"
                        ],
                        "type": "string",
                        "description": "short = under 4 minutes, medium = 4 to 20 minutes, long = over 20 minutes. Ignored unless type is \"video\" or \"any\".",
                        "default": "any"
                    },
                    "type": {
                        "title": "Result type",
                        "enum": [
                            "any",
                            "video",
                            "channel",
                            "playlist",
                            "movie"
                        ],
                        "type": "string",
                        "description": "Restrict results to a single type. \"any\" lets YouTube return a mix of videos, channels, and playlists. Note: applying upload date, duration, or feature filters forces type to \"video\".",
                        "default": "any"
                    },
                    "features": {
                        "title": "Feature flags",
                        "uniqueItems": true,
                        "type": "array",
                        "description": "Restrict to videos with one or more of these flags. Selecting any flag forces type to \"video\".",
                        "items": {
                            "type": "string",
                            "enum": [
                                "live",
                                "hd",
                                "4k",
                                "subtitles",
                                "cc_license",
                                "3d",
                                "hdr",
                                "360",
                                "vr180",
                                "location",
                                "purchased"
                            ]
                        },
                        "default": []
                    },
                    "channelId": {
                        "title": "Channel filter (optional)",
                        "type": "string",
                        "description": "Restrict results to a single channel's uploads. Accepts a channel ID (UC...), a /channel/UC... URL, a /@handle URL, or just an @handle. Free-text filters above are ignored when a channel is set.",
                        "default": ""
                    },
                    "proxyConfiguration": {
                        "title": "Proxy configuration",
                        "type": "object",
                        "description": "Apify datacenter proxy is sufficient for routine search volume. Switch to Residential if you hit throttling at very high volume or from blocked geographies.",
                        "default": {
                            "useApifyProxy": true
                        }
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
