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

Scrape YouTube search results for any keyword: video title, URL, views, duration, upload time, description snippet and channel (name, handle, ID, verified). Filter by upload date and length, sort by relevance or views, many keywords per run. Export to JSON, CSV or Excel.

- **URL**: https://apify.com/piotrv1001/youtube-search-scraper.md
- **Developed by:** [FalconScrape](https://apify.com/piotrv1001) (community)
- **Categories:** Social media, Videos, SEO tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.50 / 1,000 videos

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 for any keyword**. The **YouTube Search Scraper** returns each video's title, URL, exact view count, duration, upload time and description snippet, plus the channel's name, @handle, ID and verified badge. Filter by upload date and length, sort by relevance or views, and run many keywords at once. Use it for keyword and content research, competitor and trend tracking, influencer discovery or to collect video URLs for transcripts and comments.

### ✨ Features

- 🔍 **Many Keywords per Run**: Each keyword gets its own result limit.
- 📅 **Upload Date Filter**: Last hour, today, this week, this month or this year.
- ⏱️ **Duration Filter**: Short (under 4 minutes), medium (4–20 minutes) or long (over 20 minutes).
- 📈 **Sort by Relevance or Views**: YouTube's own ranking or most viewed first.
- 👁️ **Exact View Counts**: Full numbers such as 1,826,858, not rounded.
- 📺 **Channel Info**: Name, @handle, channel ID, URL and verified badge.

### 🛠️ How It Works

1. **Enter search keywords** – one per line.
2. **Set filters and how many videos per keyword** – the default is 50.
3. **Run the Scraper** – download the results as JSON, CSV or Excel or pull them through the API.

### ⚙️ Input

| Field                    | What it does                                                             |
| ------------------------ | ------------------------------------------------------------------------ |
| **Search queries**       | Keywords to search, one per line.                                        |
| **Sort by**              | `relevance` or `views`.                                                  |
| **Upload date**          | `any`, `hour`, `today`, `week`, `month` or `year`.                       |
| **Duration**             | `any`, `short` (<4 min), `medium` (4–20 min) or `long` (>20 min).        |
| **Max videos per query** | Stop after this many videos for each keyword. Default 50.                |

```json
{
    "queries": ["python tutorial", "web scraping"],
    "uploadDate": "week",
    "duration": "long",
    "maxItems": 200
}
```

A video that matches two of your keywords is saved once, under the first keyword that found it.

### 💰 Pricing

Pay only for the videos you get. No monthly rental.

| Event           | Price                                  | What you get                             |
| --------------- | -------------------------------------- | ---------------------------------------- |
| **Video**       | $0.0005 per video ($0.50 per 1,000)    | One search result with the fields below  |
| **Actor start** | $0.00005 per run                       | Charged once when the run starts.        |

Examples: 50 videos for 10 keywords = $0.25 · 10,000 videos = $5.00.

### 📊 Sample Output Data

```json
{
    "videoId": "hHQlcnubuFI",
    "url": "https://www.youtube.com/watch?v=hHQlcnubuFI",
    "title": "Learn Web Scraping in 5 Minutes (NO PRIOR KNOWLEDGE)",
    "description": "Get Rid of IP Blocking for just $1 with DataImpulse: ...",
    "viewCount": 176578,
    "viewCountText": "176,578 views",
    "publishedTimeText": "7 months ago",
    "durationText": "4:53",
    "durationSeconds": 293,
    "isLive": false,
    "isShort": false,
    "channelName": "CodeHead",
    "channelId": "UCFVteOob_YXJHPaGTqlDV2Q",
    "channelHandle": "@codehead01",
    "channelUrl": "https://www.youtube.com/channel/UCFVteOob_YXJHPaGTqlDV2Q",
    "channelIsVerified": true,
    "thumbnailUrl": "https://i.ytimg.com/vi/hHQlcnubuFI/hq720.jpg",
    "query": "web scraping tutorial",
    "scrapedAt": "2026-10-17T05:48:39.685Z"
}
```

### ❓ FAQ

**Do I need a YouTube account or API key?** No.

**Can I sort by upload date?** YouTube no longer orders search results by date. Use the **Upload date** filter (for example `today` or `week`) to get only recent videos.

**How many results can one keyword return?** As many as YouTube's search pages go, typically several hundred per keyword. Narrow filters return fewer.

### 🔗 More YouTube Actors

- [YouTube Transcript Scraper](https://apify.com/piotrv1001/youtube-transcript-scraper): full transcripts with timestamps for any list of videos, in the language you pick.
- [YouTube Comments Scraper](https://apify.com/piotrv1001/youtube-comments-scraper): comments and replies with likes, authors, pinned and hearted flags.
- [YouTube Channel Videos Scraper](https://apify.com/piotrv1001/youtube-channel-videos-scraper): every video, Short or live stream of a channel with views and duration.

# Actor input Schema

## `queries` (type: `array`):

Keywords to search on YouTube, one per line.

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

Result order.

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

Only videos uploaded within this period.

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

Only videos of this length.

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

Stop after this many videos for each search query.

## Actor input object example

```json
{
  "queries": [
    "web scraping tutorial"
  ],
  "sortBy": "relevance",
  "uploadDate": "any",
  "duration": "any",
  "maxItems": 50
}
```

# 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 = {
    "queries": [
        "web scraping tutorial"
    ],
    "maxItems": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("piotrv1001/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 = {
    "queries": ["web scraping tutorial"],
    "maxItems": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("piotrv1001/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 '{
  "queries": [
    "web scraping tutorial"
  ],
  "maxItems": 50
}' |
apify call piotrv1001/youtube-search-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,piotrv1001/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/X8wsbyYK3G5deTkuS/builds/y6kU5eUN0hIM1Wqfo/openapi.json
