# YouTube Search Scraper - $2/1000 Results (`scrapeunblocker/youtube-search-scraper`) Actor

Scrape YouTube search results as JSON: for each video the id, title, URL, channel, publish age, view count, duration, thumbnails and description. Filter by type (video / channel / playlist) and sort, with automatic pagination. No API key. Powered by ScrapeUnblocker.

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

## Pricing

from $2.00 / 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/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

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

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## YouTube Search Scraper

Scrape **YouTube search results** as clean, structured JSON - for each video the id, title, URL, channel, publish age, view count, duration, thumbnails, description and badges. Filter by type and sort, with automatic pagination. No YouTube API key.

Powered by [ScrapeUnblocker](https://scrapeunblocker.com)'s anti-bot bypass - no proxies or CAPTCHA setup.

### What you get per result

**Videos**

- **videoId**, **title** and a clean watch **url**
- **channel** - name, id and channel URL
- **publishedText** (e.g. "7 years ago")
- **viewCount** (parsed number) + `viewCountText` / `shortViewCountText`
- **lengthSeconds** (parsed) + `lengthText`
- **thumbnails**, **descriptionSnippet**, **badges**, **verified**, **isLive**

**Channels** carry `channelId`, `title`, `handle`, subscriber text and thumbnail; **playlists** carry `playlistId`, `title`, `videoCount` and owner.

### Features

- **Automatic pagination** - set `max_results` and the scraper pages through YouTube's continuation until it collects that many (~20 per page).
- **Type filter** - `video`, `channel`, `playlist` or `all`.
- **Sorting** - relevance, upload date, view count or rating.
- **Numbers as numbers** - view counts and durations are parsed, not just text.

### Input

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `query` | string | **required** | Search terms. |
| `max_results` | integer | 20 | How many results to collect (~20 per page). |
| `type` | select | Videos | `video`, `channel`, `playlist` or `all`. |
| `sort` | select | Relevance | `relevance`, `date`, `views` or `rating`. |
| `proxy_country` | string | - | Exit-IP country (ISO-2). Blank = a US exit. |

### Example output (one dataset item)

```json
{
  "type": "video",
  "videoId": "_uQrJ0TkZlc",
  "title": "Python Full Course for Beginners",
  "url": "https://www.youtube.com/watch?v=_uQrJ0TkZlc",
  "channel": {
    "name": "Programming with Mosh",
    "id": "UCWv7vMbMWH4-V0ZXdmDpPBA",
    "url": "https://www.youtube.com/@programmingwithmosh"
  },
  "publishedText": "7 years ago",
  "viewCount": 48915303,
  "viewCountText": "48,915,303 views",
  "lengthSeconds": 22447,
  "lengthText": "6:14:07",
  "descriptionSnippet": "Learn Python for AI, machine learning, and web development ...",
  "verified": true,
  "isLive": false
}
```

### Use cases

- **Monitoring** - track which videos rank for your brand, product or keyword over time.
- **Competitor & market research** - pull a channel's or topic's top videos with view counts.
- **Trend tracking** - sort by upload date or views to catch what's rising in a niche.
- **Content sourcing** - build watchlists, feeds and datasets from any query.

### Pricing

$2 per 1,000 results - one result = one video, channel or playlist item.

***

Built on [ScrapeUnblocker](https://scrapeunblocker.com). Questions? [docs.scrapeunblocker.com](https://docs.scrapeunblocker.com)

# Actor input Schema

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

What to search for on YouTube.

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

How many results to collect across pages (~20 per page).

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

Which kind of results to return.

## `sort` (type: `string`):

Ordering of the results.

## `proxy_country` (type: `string`):

Exit-IP country (ISO-2). Leave blank for a US exit (recommended for YouTube).

## Actor input object example

```json
{
  "query": "python tutorial",
  "max_results": 20,
  "type": "video",
  "sort": "relevance"
}
```

# Actor output Schema

## `results` (type: `string`):

Collected search results

# 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"
};

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

# Run the Actor and wait for it to finish
run = client.actor("scrapeunblocker/youtube-search-scraper").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 tutorial"
}' |
apify call scrapeunblocker/youtube-search-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,scrapeunblocker/youtube-search-scraper"
        }
    }
}
```

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/zQfOdG1betKjKvlbc/builds/HKNmGGia92VcmQOpD/openapi.json
