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

Search YouTube by keyword and get videos with exact view counts, ISO timestamps, tags, categories, and 37 fields per result.

- **URL**: https://apify.com/happy\_b/youtube-search-scraper.md
- **Developed by:** [Happy B](https://apify.com/happy_b) (community)
- **Categories:** Social media, Videos
- **Stats:** 3 total users, 2 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $0.25 / 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.
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 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

### What is YouTube Search Scraper?

YouTube Search Scraper searches YouTube by keyword and returns videos with **exact numbers, ISO 8601 timestamps, and 37 fields per video** — ready for spreadsheets, dashboards, and analysis pipelines.

No API key required. No quota limits.

Every number is an exact integer. Every date is ISO 8601. No "1.2M" guesses, no "10 months ago" approximations.

#### Data points extracted per video

| Field | Description | Example |
|-------|-------------|---------|
| `videoId` | YouTube video ID | `dQw4w9WgXcQ` |
| `title` | Video title | `Best Restaurants in NYC 2026` |
| `publishedAt` | ISO 8601 upload timestamp | `2026-03-15T14:30:00Z` |
| `viewCount` | Exact view count | `2450891` |
| `likeCount` | Exact like count | `89234` |
| `commentCount` | Exact comment count | `4521` |
| `duration` | ISO 8601 duration | `PT12M45S` |
| `durationSeconds` | Duration in seconds | `765` |
| `tags` | Video tags | `nyc,restaurants,food` |
| `categoryId` | YouTube category ID | `19` |
| `categoryName` | Human-readable category | `Travel & Events` |
| `definition` | Video quality | `hd` |
| `type` | Video type | `video` / `shorts` |
| `channelName` | Channel display name | `NYC Foodie` |
| `channelSubscriberCount` | Exact subscriber count | `850000` |
| `channelIsVerified` | Verification badge | `true` |


**37 fields per video. Every number exact. Every date ISO 8601.**

### Why use this scraper?

#### Our Actor vs Top YouTube Search Actors

| Feature | Us | API Ninja | Grow Media |
|---------|:--:|:---------:|:----------:|
| Price per 1,000 results | **$0.50** | $2.50 | $1.00 |
| `viewCount` exact integer | ✅ | ✅ | ✅ |
| `likeCount` exact integer | ✅ | ❌ | ✅ |
| `commentCount` exact integer | ✅ | ❌ | ✅ |
| `subscriberCount` exact integer | ✅ | ❌ abbreviated | ❌ abbreviated |
| `tags` | ✅ | ❌ | ✅ |
| `categoryId` | ✅ | ❌ | ❌ |
| `topicDetails` | ✅ | ❌ | ❌ |
| `definition` (HD/SD) | ✅ | ❌ | ❌ |
| `hasCaptions` | ✅ | ❌ | ❌ |
| `isAgeRestricted` | ✅ | ❌ | ❌ |
| `durationSeconds` integer | ✅ | ❌ | ✅ |
| Sort by relevance/date/views/rating | ✅ | ✅ | ❌ |
| Multiple queries per run | ✅ | ❌ | ❌ |
| Channel info per result | ✅ | ❌ | ❌ |
| No API key required | ✅ | ❌ needs key | ✅ |

- **One row, full picture** — 37 fields per video, flat CSV. No second API call, no post-processing to parse "1.2K" into a number. Download, open in Excel, done.
- **Incremental delivery** — Results appear in your dataset within seconds. Export anytime, don't wait for the run to finish.
- **From $0.50 per 1,000 items** — Volume discounts down to $0.25 on Business plan.

### Use cases

- **Market research** — Search for products, brands, or industries to understand what content exists, what gets views, and what gaps remain. Build datasets for reports with exact numbers.
- **Content discovery** — Find videos on any topic sorted by relevance, upload date, view count, or rating. Discover trending content and emerging creators.
- **Trend analysis** — Track search results over time for specific keywords. Monitor how video performance and content mix change week to week.
- **Competitor monitoring** — Search for competitor brand names, product names, or industry keywords. See who's creating content, what's ranking, and what's getting engagement.
- **Ad targeting** — Find videos by keyword that are monetized, have captions, and match your target audience demographics. Filter by channel size and engagement ratios.
- **ML training data** — Structured JSON with 37 fields per video, ready for recommendation systems, content classification, or search relevance modeling.

### How much does it cost?

Each video in search results counts as one item.

| Plan | Price per 1,000 items |
|------|----------------------|
| Free | $0.50 |
| Starter | $0.45 |
| Scale | $0.40 |
| Business | $0.25 |

| Scenario | Items | Cost |
|----------|-------|------|
| 1 query, 20 results | 20 | $0.01 |
| 5 queries, 50 results each | 250 | $0.13 |
| 20 queries, 100 results each | 2,000 | $1.00 |
| 100 queries, 200 results each | 20,000 | $10.00 |

Apify also charges a small compute cost (CU) for the actor's runtime — typically under $0.01 for most runs.

### Supported sort options

| Sort | Description |
|------|-------------|
| `relevance` | YouTube's default ranking (most relevant first) |
| `date` | Most recently uploaded first |
| `view_count` | Most viewed first |
| `rating` | Highest rated first |

### Input

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `searchQueries` | string[] | *required* | YouTube search terms. Each query runs a separate search. |
| `maxResultsPerQuery` | integer | 20 | Maximum videos to return per search query. |
| `sortBy` | string | `relevance` | `relevance`, `date`, `view_count`, or `rating`. |
| `language` | string | `en` | ISO 639-1 language code for search results. |
| `country` | string | `US` | ISO 3166-1 alpha-2 country code for search results. |

### Output example

Each item in the dataset is a single video:

```json
{
  "videoId": "dQw4w9WgXcQ",
  "title": "Best Restaurants in NYC 2026 — Full Guide",
  "description": "We tried 50 restaurants across all five boroughs to find the best...",
  "descriptionLinks": "https://nycfoodie.com/guide",
  "thumbnailUrl": "https://i.ytimg.com/vi/dQw4w9WgXcQ/maxresdefault.jpg",
  "publishedAt": "2026-03-15T14:30:00Z",
  "duration": "PT12M45S",
  "durationSeconds": 765,
  "viewCount": 2450891,
  "likeCount": 89234,
  "commentCount": 4521,
  "tags": "nyc,restaurants,food,best restaurants",
  "categoryId": 19,
  "categoryName": "Travel & Events",
  "topicDetails": "https://en.wikipedia.org/wiki/Food,https://en.wikipedia.org/wiki/Restaurant",
  "definition": "hd",
  "hasCaptions": true,
  "isAgeRestricted": false,
  "privacyStatus": "public",
  "commentsTurnedOff": false,
  "hashtags": "#nyc #restaurants #foodie",
  "type": "video",
  "searchQuery": "restaurants in NYC",
  "searchRank": 0,
  "order": 0,
  "channelId": "UCabc123def456ghi789jkl",
  "channelName": "NYC Foodie",
  "channelUsername": "@NYCFoodie",
  "channelUrl": "https://www.youtube.com/channel/UCabc123def456ghi789jkl",
  "channelDescription": "Exploring the best food in New York City...",
  "channelCountry": "US",
  "channelJoinedAt": "2019-06-10T12:00:00Z",
  "channelSubscriberCount": 850000,
  "channelTotalViews": 245000000,
  "channelTotalVideos": 312,
  "channelAvatarUrl": "https://yt3.ggpht.com/...",
  "channelBannerUrl": "https://yt3.googleusercontent.com/...",
  "channelIsVerified": true,
  "scrapeTimestamp": "2026-04-02T12:00:00Z"
}
````

Download your results as **JSON**, **CSV**, **Excel**, **XML**, or **HTML** from the dataset tab, or access them via the [Apify API](https://docs.apify.com/api/v2#/reference/datasets).

### Good to know

**No API key required.** Just enter your search terms and get results. No YouTube API key needed, no quota limits, no rate limiting headaches.

**Subscriber counts are exact integers.** Other scrapers return abbreviated text like "1.2M" that you have to parse. We return `1200000` — ready for calculations, sorting, and filtering.

**Channel info is included by default.** Every result row includes full channel metadata (subscribers, description, country, etc.) so your CSV is self-contained. No second API call needed.

**Multiple queries in one run.** Pass an array of search queries and get results for all of them in a single dataset. Each result includes `searchQuery` so you can group and filter.

### Integrations

Connect this actor to your workflow with [Apify integrations](https://docs.apify.com/platform/integrations):

- **Make (Integromat)** — trigger workflows when new data is available
- **Zapier** — push videos to Google Sheets, Slack, or databases
- **GitHub** — store results in repositories
- **Google Drive** — export directly to spreadsheets
- **Webhooks** — notify your API when the run completes
- **Apify API** — programmatic access for custom pipelines

### Legal and personal data

This actor extracts publicly available data from YouTube. You should ensure your use of the extracted data complies with YouTube's [Terms of Service](https://www.youtube.com/t/terms), applicable data protection laws (GDPR, CCPA), and your jurisdiction's regulations regarding web scraping and data processing.

Search results and video information is public content visible to anyone on YouTube.

### Support

Found a bug or have a feature request? Open an issue on the [Issues tab](https://apify.com/happy_b/youtube-search-scraper/issues/open) or contact us through Apify messaging.

# Actor input Schema

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

YouTube search terms. Each query runs a separate search.

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

Maximum number of videos to return per search query.

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

How to sort search results.

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

ISO 639-1 language code for search results.

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

ISO 3166-1 alpha-2 country code for search results.

## Actor input object example

```json
{
  "searchQueries": [
    "restaurants in NYC"
  ],
  "maxResultsPerQuery": 20,
  "sortBy": "relevance",
  "language": "en",
  "country": "US"
}
```

# Actor output Schema

## `videos` (type: `string`):

No description

## `metadata` (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": [
        "restaurants in NYC"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("happy_b/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": ["restaurants in NYC"] }

# Run the Actor and wait for it to finish
run = client.actor("happy_b/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": [
    "restaurants in NYC"
  ]
}' |
apify call happy_b/youtube-search-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "YouTube Search Scraper",
        "description": "Search YouTube by keyword and get videos with exact view counts, ISO timestamps, tags, categories, and 37 fields per result.",
        "version": "0.1",
        "x-build-id": "9TroYbXglQVXAmfN7"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/happy_b~youtube-search-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-happy_b-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/happy_b~youtube-search-scraper/runs": {
            "post": {
                "operationId": "runs-sync-happy_b-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/happy_b~youtube-search-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-happy_b-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",
                        "type": "array",
                        "description": "YouTube search terms. Each query runs a separate search.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxResultsPerQuery": {
                        "title": "Max Results Per Query",
                        "minimum": 1,
                        "type": "integer",
                        "description": "Maximum number of videos to return per search query.",
                        "default": 20
                    },
                    "sortBy": {
                        "title": "Sort By",
                        "enum": [
                            "relevance",
                            "date",
                            "view_count",
                            "rating"
                        ],
                        "type": "string",
                        "description": "How to sort search results.",
                        "default": "relevance"
                    },
                    "language": {
                        "title": "Language",
                        "type": "string",
                        "description": "ISO 639-1 language code for search results.",
                        "default": "en"
                    },
                    "country": {
                        "title": "Country",
                        "type": "string",
                        "description": "ISO 3166-1 alpha-2 country code for search results.",
                        "default": "US"
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
