# YouTube Search Results Scraper (`automationagents/youtube-search`) Actor

Search YouTube and return video IDs, titles, channels, view counts, and thumbnails. Ideal for research and content monitoring.

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

## Pricing

from $20.00 / 1,000 successful api calls

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.

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

### What does YouTube Search do?

**YouTube Search** lets you search YouTube videos programmatically and extract structured data — video IDs, titles, channel names, view counts, publish dates, and thumbnail URLs — without any browser automation or API quota limits. Simply provide a search query and get back a clean JSON dataset ready for analysis, enrichment, or downstream workflows.

Built on the **Apify platform**, this Actor runs in seconds and integrates with Apify's scheduling, monitoring, and webhook features out of the box.

### Why use YouTube Search?

- **Content research** — Find trending videos in your niche for competitive analysis
- **Lead generation** — Discover YouTube creators and channels relevant to your industry
- **Marketing intelligence** — Track how competitors' content performs on YouTube
- **Data pipelines** — Feed YouTube data into your CRM, spreadsheet, or BI tool automatically
- **SEO research** — Understand what video content ranks for specific search terms

### How to use YouTube Search

1. Click **Try for free** on this Actor's page
2. Enter your **search query** (e.g. `"python tutorial"` or `"SaaS marketing"`)
3. Set **max\_results** (default 10, max 50)
4. Click **Start** and wait a few seconds
5. Download your results as JSON, CSV, or Excel from the **Output** tab

### Input

| Field | Type | Required | Description |
|---|---|---|---|
| `query` | string | ✅ | YouTube search query |
| `max_results` | integer | ❌ | Max results to return (default 10, max 50) |
| `cache` | boolean | ❌ | Use cached result if available (default true) |

**Example input:**

```json
{
  "query": "python tutorial for beginners",
  "max_results": 20
}
```

### Output

**Example output:**

```json
{
  "results": [
    {
      "videoId": "rfscVS0vtbw",
      "title": "Learn Python - Full Course for Beginners",
      "channelName": "freeCodeCamp.org",
      "viewCount": 35000000,
      "duration": "PT4H26M52S",
      "publishedAt": "2018-07-11T18:00:02Z",
      "thumbnail": "https://i.ytimg.com/vi/rfscVS0vtbw/hqdefault.jpg"
    }
  ],
  "meta": {
    "cache_hit": false,
    "execution_time_ms": 1200
  }
}
```

You can download the dataset in various formats such as JSON, HTML, CSV, or Excel.

### Data fields

| Field | Type | Description |
|---|---|---|
| `videoId` | string | YouTube video ID |
| `title` | string | Video title |
| `channelName` | string | Name of the channel |
| `viewCount` | integer | Total view count |
| `duration` | string | Duration in ISO 8601 format |
| `publishedAt` | string | Publication date |
| `thumbnail` | string | Thumbnail URL |

### Pricing / Cost estimation

**$0.02 per successful API call** on Apify.

- 1,000 successful Apify runs = $20.00

### FAQ & Support

**Is this legal?** This Actor queries publicly available YouTube search results — the same data visible in any browser without login. No private data is accessed.

**Known limitations:** YouTube may return fewer results than `max_results` for niche queries. Max supported is 50 results per call.

**Need help?** Open an issue in the Issues tab or contact the support team for custom solutions.

# Actor input Schema

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

Search query

## `max_results` (type: `integer`):

Maximum number of results (default 10, max 50)

## `cache` (type: `boolean`):

Use cached result if available

## Actor input object example

```json
{
  "query": "python tutorial",
  "max_results": 10,
  "cache": true
}
```

# 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 = {
    "query": "python tutorial",
    "max_results": 10,
    "cache": true
};

// Run the Actor and wait for it to finish
const run = await client.actor("automationagents/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 = {
    "query": "python tutorial",
    "max_results": 10,
    "cache": True,
}

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

```

## MCP server setup

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

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/nuLSTCuTagWulJR3U/builds/RUgdTaUC9o5vtvMBd/openapi.json
