# YouTube Search Scraper (`receptional_blender/youtube-search-results`) Actor

Type a keyword, get structured YouTube video results — videoId, title, URL, channel name and ID, view count, published time, duration, description and thumbnail — straight from YouTube's InnerTube API. No API key, no browser, no cookies.

- **URL**: https://apify.com/receptional\_blender/youtube-search-results.md
- **Developed by:** [Assia Fadli](https://apify.com/receptional_blender) (community)
- **Categories:** Videos
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.01 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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/docs.md):

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

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python/docs.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/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

Turn any keyword into a tidy list of YouTube videos — no API key, no browser, no cookies.

Give this actor one or more search terms and it returns clean, flat rows: the video's ID, title and URL, the channel name and ID, view count, published time, duration, an optional description snippet, and the best available thumbnail. Perfect for topic research, competitor tracking, content ideation, or feeding a downstream pipeline.

### How it works

The actor talks directly to YouTube's internal **InnerTube** API using the **ANDROID** client — the same endpoint YouTube's own mobile app uses. That client still returns full search data from `youtubei/v1/search` without a Proof-of-Origin (PoToken) token, consent cookies, or a headless browser, which keeps every run fast and cheap.

1. A `POST` to `https://www.youtube.com/youtubei/v1/search` with the ANDROID client context and your `{ query }` returns the first page of `compactVideoRenderer` items.
2. Each subsequent page is fetched with the `nextContinuationData.continuation` token from the previous response.
3. Results are de-duplicated by `videoId`, and paging stops once `maxResults` is reached, a token repeats, or YouTube stops returning a next token.

### Features

- Search one keyword or many in a single run — each query is scraped independently.
- Pages through results with continuation tokens up to your `maxResults` limit.
- Returns clean, flat rows (one per video) ready for spreadsheets, databases or downstream actors.
- Routes requests through Apify residential proxies, with an automatic fallback to a direct request if the proxy fails.
- Resilient: a query that returns nothing or errors is written as a `{ query, error }` row instead of crashing the run.

### Pricing — pay per result

This actor uses Apify's **pay-per-event** model with a single event, **`result-scraped`**. You are charged once for each video result that is actually delivered to your dataset. Rows that carry no video (empty-result or error rows) are never charged, and once your run's charge limit is reached the actor stops early so you are never billed beyond your budget.

### Input

| Field | Type | Description |
| --- | --- | --- |
| `queries` | array (required) | One or more keywords. Each is searched independently. Aliases: `keywords`. |
| `query` | string | Optional single keyword, merged with `queries`. Alias: `search`. |
| `maxResults` | integer | Max results per query. Default `30`. Alias: `maxItems`. |
| `proxyCountryCode` | string | Two-letter country code for the residential proxy exit IP. Default `US`. Alias: `proxyCountry`. |
| `language` | string | Language code (`hl`) for localized fields such as view counts and publish times. Default `en`. Alias: `hl`. |

#### Example input

```json
{
    "queries": ["apify web scraping", "playwright tutorial"],
    "maxResults": 30,
    "proxyCountryCode": "US"
}
````

### Output

One dataset row per video result:

```json
{
    "query": "apify web scraping",
    "videoId": "5kcaHAuGxmY",
    "title": "How to scrape ANY website with Apify's Web Scraper API",
    "url": "https://www.youtube.com/watch?v=5kcaHAuGxmY",
    "channelName": "Apify",
    "channelId": "UCTgwcoeGGKmZ3zzCXN2qo_A",
    "views": "39,802 views",
    "published": "1 year ago",
    "duration": "5:30",
    "description": null,
    "thumbnail": "https://i.ytimg.com/vi_webp/5kcaHAuGxmY/sddefault.webp"
}
```

> Note: the ANDROID search client does not always include a `description` snippet, so that field may be absent for some videos.

### Running locally

```bash
npm install
npm run build
## create storage/key_value_stores/default/INPUT.json with your input, then:
apify run
```

### Disclaimer

This actor scrapes publicly available search results. Use it responsibly and in line with YouTube's Terms of Service and applicable laws.

# Actor input Schema

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

One or more keywords to search on YouTube. Each query runs independently and its videos are added to the dataset.

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

Optional single keyword. Merged with the `queries` list — handy when you only need one search.

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

Maximum number of videos to collect for each query. Results are paged in batches of roughly 18-20.

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

Two-letter country code for the Apify residential proxy exit IP (e.g. "US", "GB", "DE"). Defaults to US.

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

Language code (hl) used for localized fields such as relative publish times and view counts, e.g. "en", "es", "fr".

## Actor input object example

```json
{
  "queries": [
    "apify web scraping"
  ],
  "maxResults": 30,
  "proxyCountryCode": "US",
  "language": "en"
}
```

# 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 = {
    "queries": [
        "apify web scraping"
    ],
    "maxResults": 30,
    "proxyCountryCode": "US",
    "language": "en"
};

// Run the Actor and wait for it to finish
const run = await client.actor("receptional_blender/youtube-search-results").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 = {
    "queries": ["apify web scraping"],
    "maxResults": 30,
    "proxyCountryCode": "US",
    "language": "en",
}

# Run the Actor and wait for it to finish
run = client.actor("receptional_blender/youtube-search-results").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 '{
  "queries": [
    "apify web scraping"
  ],
  "maxResults": 30,
  "proxyCountryCode": "US",
  "language": "en"
}' |
apify call receptional_blender/youtube-search-results --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "YouTube Search Scraper",
        "description": "Type a keyword, get structured YouTube video results — videoId, title, URL, channel name and ID, view count, published time, duration, description and thumbnail — straight from YouTube's InnerTube API. No API key, no browser, no cookies.",
        "version": "1.0",
        "x-build-id": "BqjJy6QxhqPw5GHsZ"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/receptional_blender~youtube-search-results/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-receptional_blender-youtube-search-results",
                "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/receptional_blender~youtube-search-results/runs": {
            "post": {
                "operationId": "runs-sync-receptional_blender-youtube-search-results",
                "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/receptional_blender~youtube-search-results/run-sync": {
            "post": {
                "operationId": "run-sync-receptional_blender-youtube-search-results",
                "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": [
                    "queries"
                ],
                "properties": {
                    "queries": {
                        "title": "Search queries",
                        "type": "array",
                        "description": "One or more keywords to search on YouTube. Each query runs independently and its videos are added to the dataset.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "query": {
                        "title": "Single search query",
                        "type": "string",
                        "description": "Optional single keyword. Merged with the `queries` list — handy when you only need one search."
                    },
                    "maxResults": {
                        "title": "Maximum results per query",
                        "minimum": 1,
                        "type": "integer",
                        "description": "Maximum number of videos to collect for each query. Results are paged in batches of roughly 18-20.",
                        "default": 30
                    },
                    "proxyCountryCode": {
                        "title": "Proxy country code",
                        "type": "string",
                        "description": "Two-letter country code for the Apify residential proxy exit IP (e.g. \"US\", \"GB\", \"DE\"). Defaults to US.",
                        "default": "US"
                    },
                    "language": {
                        "title": "Language",
                        "type": "string",
                        "description": "Language code (hl) used for localized fields such as relative publish times and view counts, e.g. \"en\", \"es\", \"fr\".",
                        "default": "en"
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
