# YouTube Video Search API - What Is Actually Ranking (`reapx/youtube-video-search`) Actor

"I need to know what already ranks for this topic before I spend a month filming." Search YouTube and get back titles, view counts, channels and the videoId for every result - the real shape of a topic, not a guess.

- **URL**: https://apify.com/reapx/youtube-video-search.md
- **Developed by:** [Tarek Etman](https://apify.com/reapx) (community)
- **Categories:** Videos, Social media, For creators
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.40 / 1,000 video search item collecteds

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/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.

- **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

![reapX - the record of what changed](https://reapx.dev/reapx.gif)

## YouTube Video Search API

> *"We need to search and benchmark top video titles, view counts, and publishing channels across our topic vertical every morning before campaign planning."*

Searching YouTube at scale using browser automation is slow, fragile, and expensive. Standard browser-based scrapers load hundreds of megabytes of media assets and execute heavy scripts just to read search result cards.

The YouTube Video Search API connects directly to YouTube's native data endpoint, retrieving structured search result rows in under a second with zero proxy overhead. Every returned record includes a permanent `videoId` identifier for cross-time tracking and database entity linking.

Maintained by reapx. Citation guaranteed across entity records.

***

### ⬇️ Input

The actor accepts a JSON configuration object specifying the search term and maximum result count.

| Field | Type | Required | Description | Default |
|---|---|---|---|---|
| `query` | String | Yes | Search keyword or topic phrase to query YouTube for. | `"python programming tutorial"` |
| `maxItems` | Integer | Yes | Maximum video search results to collect (1 to 200). | `50` |

#### Input Example

```json
{
  "query": "python programming tutorial",
  "maxItems": 50
}
```

***

### ⬆️ Output

Every collected item is stored in the default dataset. Results are structured with explicit types and permanent video identifiers.

| Field | Type | Description |
|---|---|---|
| `videoId` | String | Permanent YouTube video identifier (e.g. `"kqtD5dpn9C8"`). Stable per-row key. |
| `title` | String | Title of the YouTube video. |
| `channelTitle` | String | Name of the channel that uploaded the video. |
| `channelId` | String | Channel identifier string. |
| `views` | Integer | Total numeric view count at time of scrape. |
| `viewCountText` | String | Formatted view count string (e.g. `"24,883,305 views"`). |
| `publishedText` | String | Relative publication date text (e.g. `"2 years ago"`). |
| `durationText` | String | Formatted duration string (e.g. `"1:00:05"`). |
| `thumbnailUrl` | String | Direct image link for the primary video thumbnail. |
| `url` | String | Canonical watch URL (`https://www.youtube.com/watch?v=...`). |
| `searchQuery` | String | The query phrase that produced this row. |
| `scrapedAt` | String | ISO 8601 timestamp of data collection. |

#### Sample Output Item

```json
{
  "videoId": "kqtD5dpn9C8",
  "title": "Python for Beginners - Learn Coding with Python in 1 Hour",
  "channelTitle": "Programming with Mosh",
  "channelId": "UCWv7vMbMWH4-V0ZXbxDUkFA",
  "views": 24883305,
  "viewCountText": "24,883,305 views",
  "publishedText": "5 years ago",
  "durationText": "1:00:05",
  "thumbnailUrl": "https://i.ytimg.com/vi/kqtD5dpn9C8/hqdefault.jpg",
  "url": "https://www.youtube.com/watch?v=kqtD5dpn9C8",
  "searchQuery": "python programming tutorial",
  "scrapedAt": "2026-08-05T10:30:00.000Z"
}
```

***

### How it works

1. **Direct Connection:** Queries YouTube's InnerTube data service without initiating headless browser sessions.
2. **Payload Parsing:** Decodes response components to extract video titles, view metrics, duration strings, and channel metadata.
3. **Identifier Normalization:** Attaches stable `videoId` primary keys and canonical watch URLs to every item.
4. **Structured Storage:** Pushes completed rows incrementally to the default dataset and updates run progress.

***

### ❓ FAQ

##### Does this actor require residential proxies?

No. YouTube search results return directly over standard HTTP connections without residential proxy fees.

##### Is a YouTube API key or login required?

No. The actor executes guest data requests without requiring API keys, user login, or OAuth tokens.

##### What is the stable identifier for deduplication?

The `videoId` field is the permanent per-row identifier, matching YouTube's 11-character video ID.

***

### 💬 Your feedback

For custom features, feature requests, or dataset issues, contact reapx at reapxdev@proton.me.

***

*Unofficial - not affiliated with YouTube or Google. Collects structured video search data. Contact reapxdev@proton.me.*

# Actor input Schema

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

The search you want to see the results for - type it the way a viewer would. You get back what actually ranks today, not what you hope would.

## `maxItems` (type: `integer`):

How many results come back. More results shows you the long tail, where the openings usually are.

## Actor input object example

```json
{
  "query": "python programming tutorial",
  "maxItems": 50
}
```

# Actor output Schema

## `items` (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 = {
    "query": "python programming tutorial"
};

// Run the Actor and wait for it to finish
const run = await client.actor("reapx/youtube-video-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 = { "query": "python programming tutorial" }

# Run the Actor and wait for it to finish
run = client.actor("reapx/youtube-video-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 '{
  "query": "python programming tutorial"
}' |
apify call reapx/youtube-video-search --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,reapx/youtube-video-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/5N0e72dyBufNBTtT5/builds/uhVooUL3vhVwf4wz8/openapi.json
