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

🎥 Extract YouTube search results with full video and channel metadata, including views, likes, subscribers, URLs, thumbnails, and more. 🚀 Fast, reliable, and scalable.

- **URL**: https://apify.com/apt\_marble/youtube-search-scraper.md
- **Developed by:** [Hamza](https://apify.com/apt_marble) (community)
- **Categories:** Videos, Social media, Automation
- **Stats:** 4 total users, 2 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.90 / 1,000 result (full details)s

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

## YouTube Search Scraper 🔍

Search YouTube by keyword with **every filter the platform offers** — and get back videos, Shorts and live streams enriched with exact publish dates, likes, comments, durations and channel stats. Clean structured JSON, ready for analysis.

### ✨ What you get

One record per result:

| Field | Description |
|---|---|
| `videoId` / `url` / `title` / `thumbnail` | The result itself |
| `type` | `video`, `short` or `stream` |
| `description` / `hashtags` | Full description + extracted hashtags |
| `publishedAt` / `publishedTimeText` | Exact ISO timestamp + YouTube's "3 days ago" |
| `views` / `likes` / `commentsCount` | Engagement as real numbers |
| `duration` / `durationSeconds` | `00:22:51` and `1371` |
| `isLive` / `streamType` | `live`, `ended`, `upcoming` or `null` |
| `category` / `badges` / `isFamilySafe` / `commentsTurnedOff` | Content flags |
| `channelName` / `channelId` / `channelUrl` / `channelHandle` / `channelAvatar` / `channelSubscribers` | Full channel info |
| `position` / `searchTerm` / `searchUrl` / `scrapedAt` | Provenance |

### ⚙️ Options

- **Search terms** — any number of keywords; each gets its own result quota.
- **Per-type limits** — separate maximums for videos, Shorts and live streams.
- **Filters** — exactly like youtube.com's filter panel: sorting order (Relevance / Rating / Upload date / View count), date filter (last hour → this year), type (video / channel / playlist / movie), length (under 4 / 4–20 / over 20 minutes) and feature toggles (HD, Subtitles/CC, Creative Commons, 3D, Live, Purchased, 4K, 360°, Location, HDR, VR180).
- **Localization** — country and language codes for region-specific results.

### 🚀 Example

Input:

```json
{
    "searchTerms": ["world cup 2026"],
    "maxVideosPerTerm": 5,
    "maxShortsPerTerm": 5,
    "maxStreamsPerTerm": 5,
    "addFilters": true,
    "sortingOrder": "viewCount",
    "dateFilter": "week"
}
````

One record from the output:

```json
{
    "videoId": "J5UtYIOm4Xg",
    "type": "video",
    "title": "2026 FIFA World Cup Group Stage Preview: Predictions + Picks to Advance 🏆",
    "url": "https://www.youtube.com/watch?v=J5UtYIOm4Xg",
    "publishedAt": "2026-06-09T17:20:56.000Z",
    "publishedTimeText": "21 hours ago",
    "views": 19763,
    "likes": 239,
    "duration": "00:22:51",
    "durationSeconds": 1371,
    "channelName": "CBS Sports",
    "channelHandle": "@CBSSports",
    "channelSubscribers": 1200000,
    "position": 1,
    "searchTerm": "world cup 2026",
    "scrapedAt": "2026-06-10T02:45:04.000Z"
}
```

### 💡 Use cases

- **Market research** — map who ranks for the keywords in your niche.
- **Trend monitoring** — track fresh uploads on any topic with date filters.
- **SEO for video** — analyze titles, lengths and engagement of top-ranking content.
- **Live coverage** — find active streams for any event, as it happens.

### 💳 Pricing

You pay per result scraped — no subscriptions, no hidden compute costs.

### ❓ FAQ

**Why did I get 0 streams?** Streams are only returned while something is actually live for your query — 0 is a correct answer, not an error.

**Are the dates exact?** Yes — every result is enriched to the exact second of publication, not just "3 weeks ago".

**Do filters combine?** Yes, exactly like on youtube.com — e.g. "this week" + "under 4 minutes" + 4K all at once.

# Actor input Schema

## `searchTerms` (type: `array`):

One or more keywords to search YouTube for.

## `maxVideosPerTerm` (type: `integer`):

How many regular videos to scrape for each search term.

## `maxShortsPerTerm` (type: `integer`):

How many Shorts to scrape for each search term.

## `maxStreamsPerTerm` (type: `integer`):

How many live streams to scrape for each search term. ⚠️ A dedicated live-search pass runs when above 0; if nothing is live for the query, you get 0 streams (that's correct, not an error).

## `addFilters` (type: `boolean`):

Enable the search filters below (date, type, length, features). When off, the filter fields are ignored.

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

How YouTube ranks the results.

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

Only include results uploaded within this window.

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

Restrict results to one content type.

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

Restrict results by duration.

## `featureHD` (type: `boolean`):

Only HD videos.

## `featureSubtitles` (type: `boolean`):

Only videos with subtitles or closed captions.

## `featureCC` (type: `boolean`):

Only Creative Commons licensed videos.

## `feature3D` (type: `boolean`):

Only 3D videos.

## `featureLive` (type: `boolean`):

Only live broadcasts.

## `featurePurchased` (type: `boolean`):

Only purchased content.

## `feature4K` (type: `boolean`):

Only 4K videos.

## `feature360` (type: `boolean`):

Only 360° videos.

## `featureLocation` (type: `boolean`):

Only videos with location data.

## `featureHDR` (type: `boolean`):

Only HDR videos.

## `featureVR180` (type: `boolean`):

Only VR180 videos.

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

Two-letter country code for region-specific results (gl).

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

Two-letter language code for the results (hl).

## `maxConcurrency` (type: `integer`):

How many search terms to process in parallel.

## Actor input object example

```json
{
  "searchTerms": [
    "world cup 2026"
  ],
  "maxVideosPerTerm": 10,
  "maxShortsPerTerm": 5,
  "maxStreamsPerTerm": 0,
  "addFilters": false,
  "sortingOrder": "relevance",
  "dateFilter": "",
  "videoTypeFilter": "",
  "lengthFilter": "",
  "featureHD": false,
  "featureSubtitles": false,
  "featureCC": false,
  "feature3D": false,
  "featureLive": false,
  "featurePurchased": false,
  "feature4K": false,
  "feature360": false,
  "featureLocation": false,
  "featureHDR": false,
  "featureVR180": false,
  "country": "us",
  "language": "en",
  "maxConcurrency": 3
}
```

# Actor output Schema

## `dataset` (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 = {
    "searchTerms": [
        "world cup 2026"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("apt_marble/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 = { "searchTerms": ["world cup 2026"] }

# Run the Actor and wait for it to finish
run = client.actor("apt_marble/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 '{
  "searchTerms": [
    "world cup 2026"
  ]
}' |
apify call apt_marble/youtube-search-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "YouTube Search Scraper",
        "description": "🎥 Extract YouTube search results with full video and channel metadata, including views, likes, subscribers, URLs, thumbnails, and more. 🚀 Fast, reliable, and scalable.",
        "version": "0.0",
        "x-build-id": "IrkeJ0FrI9Jcsd6W5"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/apt_marble~youtube-search-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-apt_marble-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/apt_marble~youtube-search-scraper/runs": {
            "post": {
                "operationId": "runs-sync-apt_marble-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/apt_marble~youtube-search-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-apt_marble-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": [
                    "searchTerms"
                ],
                "properties": {
                    "searchTerms": {
                        "title": "Search terms",
                        "type": "array",
                        "description": "One or more keywords to search YouTube for.",
                        "default": [
                            "world cup 2026"
                        ],
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxVideosPerTerm": {
                        "title": "Maximum videos per search term",
                        "minimum": 0,
                        "type": "integer",
                        "description": "How many regular videos to scrape for each search term.",
                        "default": 10
                    },
                    "maxShortsPerTerm": {
                        "title": "Maximum shorts per search term",
                        "minimum": 0,
                        "type": "integer",
                        "description": "How many Shorts to scrape for each search term.",
                        "default": 5
                    },
                    "maxStreamsPerTerm": {
                        "title": "Maximum streams per search term",
                        "minimum": 0,
                        "type": "integer",
                        "description": "How many live streams to scrape for each search term. ⚠️ A dedicated live-search pass runs when above 0; if nothing is live for the query, you get 0 streams (that's correct, not an error).",
                        "default": 0
                    },
                    "addFilters": {
                        "title": "Add filters",
                        "type": "boolean",
                        "description": "Enable the search filters below (date, type, length, features). When off, the filter fields are ignored.",
                        "default": false
                    },
                    "sortingOrder": {
                        "title": "Sorting order",
                        "enum": [
                            "relevance",
                            "rating",
                            "uploadDate",
                            "viewCount"
                        ],
                        "type": "string",
                        "description": "How YouTube ranks the results.",
                        "default": "relevance"
                    },
                    "dateFilter": {
                        "title": "Date filter",
                        "enum": [
                            "",
                            "hour",
                            "today",
                            "week",
                            "month",
                            "year"
                        ],
                        "type": "string",
                        "description": "Only include results uploaded within this window.",
                        "default": ""
                    },
                    "videoTypeFilter": {
                        "title": "Video type filter",
                        "enum": [
                            "",
                            "video",
                            "channel",
                            "playlist",
                            "movie"
                        ],
                        "type": "string",
                        "description": "Restrict results to one content type.",
                        "default": ""
                    },
                    "lengthFilter": {
                        "title": "Length filter",
                        "enum": [
                            "",
                            "short",
                            "medium",
                            "long"
                        ],
                        "type": "string",
                        "description": "Restrict results by duration.",
                        "default": ""
                    },
                    "featureHD": {
                        "title": "HD",
                        "type": "boolean",
                        "description": "Only HD videos.",
                        "default": false
                    },
                    "featureSubtitles": {
                        "title": "Subtitles/CC",
                        "type": "boolean",
                        "description": "Only videos with subtitles or closed captions.",
                        "default": false
                    },
                    "featureCC": {
                        "title": "Creative Commons",
                        "type": "boolean",
                        "description": "Only Creative Commons licensed videos.",
                        "default": false
                    },
                    "feature3D": {
                        "title": "3D",
                        "type": "boolean",
                        "description": "Only 3D videos.",
                        "default": false
                    },
                    "featureLive": {
                        "title": "Live",
                        "type": "boolean",
                        "description": "Only live broadcasts.",
                        "default": false
                    },
                    "featurePurchased": {
                        "title": "Purchased",
                        "type": "boolean",
                        "description": "Only purchased content.",
                        "default": false
                    },
                    "feature4K": {
                        "title": "4K",
                        "type": "boolean",
                        "description": "Only 4K videos.",
                        "default": false
                    },
                    "feature360": {
                        "title": "360 degrees",
                        "type": "boolean",
                        "description": "Only 360° videos.",
                        "default": false
                    },
                    "featureLocation": {
                        "title": "Location",
                        "type": "boolean",
                        "description": "Only videos with location data.",
                        "default": false
                    },
                    "featureHDR": {
                        "title": "HDR",
                        "type": "boolean",
                        "description": "Only HDR videos.",
                        "default": false
                    },
                    "featureVR180": {
                        "title": "VR180",
                        "type": "boolean",
                        "description": "Only VR180 videos.",
                        "default": false
                    },
                    "country": {
                        "title": "Country (advanced)",
                        "type": "string",
                        "description": "Two-letter country code for region-specific results (gl).",
                        "default": "us"
                    },
                    "language": {
                        "title": "Language (advanced)",
                        "type": "string",
                        "description": "Two-letter language code for the results (hl).",
                        "default": "en"
                    },
                    "maxConcurrency": {
                        "title": "Concurrency",
                        "minimum": 1,
                        "maximum": 10,
                        "type": "integer",
                        "description": "How many search terms to process in parallel.",
                        "default": 3
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
