# YouTube Search Scraper (bulk keywords, lightweight) (`steadydata/youtube-search`) Actor

Ranked YouTube search results for up to 200 keywords per run: rank, title, video id, duration, view count, publish date and thumbnail. Sort by relevance, date, views or rating. Only delivered results are charged.

- **URL**: https://apify.com/steadydata/youtube-search.md
- **Developed by:** [Steadydata Team](https://apify.com/steadydata) (community)
- **Categories:** Videos, AI, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.40 / 1,000 result listeds

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/actors/running/actors-in-store.md#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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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 (bulk keywords, lightweight)

Run **up to 200 keywords through YouTube search in one go** and get ranked results back
as a table: rank, title, video id, duration, view count, publish date and thumbnail.
Sort by relevance, upload date, view count or rating. **You only pay for results that are
actually delivered.**

### Why this scraper

- **Built for keyword lists, not single searches.** Paste 200 keywords, get one flat
  table with the query and the rank on every row, ready to pivot.
- **Built on a lightweight route.** This actor asks YouTube's own internal API instead
  of loading the results page, and needs roughly 3 KB per result.
- **Only delivered results are charged.** A keyword without results comes back as a
  clear error record at no cost.
- **A hard cost ceiling you control.** `maxResultsPerQuery` is the cap: one delivered
  result is one charged event.
- **Rank is preserved.** Position 1 stays position 1, which is the whole point when you
  are tracking visibility for a keyword.

### Who this is for

Anyone tracking what ranks on YouTube for a set of keywords: content and SEO teams
checking visibility, researchers sampling a topic, and pipelines that need candidate
videos before pulling details or transcripts.

### Who this is not for

If you want to search YouTube once, the website is faster and free. This actor earns its
place from the tenth keyword onwards, and from the moment you want the results in a
spreadsheet instead of on a screen.

It returns public video metadata only. No channel subscriber lists, no comments, no
personal data.

### Input example

```json
{
    "queries": [
        "web scraping tutorial",
        "n8n automation",
        "apify actor"
    ],
    "maxResultsPerQuery": 50,
    "sortBy": "relevance",
    "language": "en",
    "country": "US"
}
```

### Output example

```json
{
    "query": "web scraping tutorial",
    "sortBy": "relevance",
    "rank": 1,
    "videoId": "Od6M0AXpcxQ",
    "url": "https://www.youtube.com/watch?v=Od6M0AXpcxQ",
    "title": "Learn Web Scraping in 5 Minutes",
    "duration": "5:12",
    "durationSeconds": 312,
    "viewCount": 157767,
    "publishedText": "6 months ago",
    "thumbnailUrl": "https://i.ytimg.com/vi/Od6M0AXpcxQ/maxresdefault.jpg",
    "status": "ok"
}
```

A keyword that returns nothing produces an error record instead, and is **not** charged:

```json
{
    "input": "qzxwvutsrponmlkjihgfedcba",
    "status": "error",
    "errorCode": "NO_RESULTS",
    "error": "No videos found for query 'qzxwvutsrponmlkjihgfedcba'"
}
```

Error codes: `INVALID_QUERY`, `INVALID_SORT`, `NO_RESULTS`, `BLOCKED`. `INPUT_TRUNCATED` appears once when your input is longer than this actor accepts.

### Related actors from steadydata

- [youtube-video-details](https://apify.com/steadydata/youtube-video-details): full metadata for the results
- [youtube-channel-search](https://apify.com/steadydata/youtube-channel-search): the same idea, but for channels

### Pricing

Pay per event: one `result-listed` event per delivered result. No charge for keywords
that fail or return nothing, no separate platform-usage surcharge.

### FAQ

**Do results differ per country?**
Yes, and that is deliberate. Set `country` to the market you care about; YouTube ranks
differently per region, so a Dutch ranking check needs `NL`.

**Which sort orders are supported?**
Relevance (the default), upload date, view count and rating.

**Are results stable enough to track over time?**
Search rankings move by the hour, so treat a run as a snapshot with a timestamp, not as
a fixed truth. Running the same keyword list daily is the useful pattern.

**Why do I get fewer results than I asked for?**
YouTube stops offering more at some point, which differs per keyword. You are only
charged for what was actually delivered.

**Is personal data collected?**
No. Public video metadata only.

**What happens when YouTube changes something?**
Internal routes shift from time to time. The actor is monitored daily and fixed fast,
and while it is broken you are not charged, because only delivered results cost anything.

# Actor input Schema

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

Keywords to search YouTube for, up to 200 per run.

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

Stop after this many results per query. This is your cost ceiling: one delivered result is one charged event.

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

How YouTube should order the results.

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

Interface language for the texts YouTube returns, e.g. en, nl, de.

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

ISO country code used for the request. Search results differ per country.

## Actor input object example

```json
{
  "queries": [
    "web scraping tutorial"
  ],
  "maxResultsPerQuery": 50,
  "sortBy": "relevance",
  "language": "en",
  "country": "US"
}
```

# Actor output Schema

## `results` (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 = {
    "queries": [
        "web scraping tutorial"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("steadydata/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 = { "queries": ["web scraping tutorial"] }

# Run the Actor and wait for it to finish
run = client.actor("steadydata/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 '{
  "queries": [
    "web scraping tutorial"
  ]
}' |
apify call steadydata/youtube-search --silent --output-dataset

```

## MCP server setup

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