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

YouTube search scraper: videos or Shorts for your keywords as JSON, with no Data API key or quota. Title, URL, views, publish date, duration, channel and thumbnail. Filter by sort, upload date and type. Pay per video. ScrapeMole is the maker.

- **URL**: https://apify.com/scrapemole/youtube-search-scraper.md
- **Developed by:** [ScrapeMole](https://apify.com/scrapemole) (community)
- **Categories:** Videos, Social media
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.50 / 1,000 video (search 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/actors/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: videos and Shorts by keyword, as JSON

Need YouTube search results as structured data, with no Data API key and no quota? **ScrapeMole** takes one or more **keywords** and returns the **videos or Shorts** YouTube shows for that search, in result order: title, URL, views, publish date, duration, channel and thumbnail. Filter by sort, upload date and type (videos or Shorts). ScrapeMole is the maker of this Actor.

- **Keyword in, results out:** one clean JSON row per video or Short, with the search term and position.
- **The same filters as YouTube:** sort by relevance, upload date, view count or rating; last hour through this year; videos or Shorts only.
- **No API key, no quota.** Works from servers and agents. Failed items and duplicates are never charged.
- **Switch without rewriting input:** accepts `search_keywords`, `max_results`, `sort_by`, `upload_date` and other common field names (see below).

**You only pay for videos delivered.** Error rows are free.

### One-command quickstart (for agents)

Set `APIFY_TOKEN` to your Apify API token. This one request runs the Actor and returns the rows.

```bash
curl -sS -X POST \
  "https://api.apify.com/v2/acts/scrapemole~youtube-search-scraper/run-sync-get-dataset-items?token=$APIFY_TOKEN&memory=256&timeout=180" \
  -H "Content-Type: application/json" \
  -d '{"searchQueries":["espresso machine review"],"maxResultsPerSource":10}'
```

Expect a JSON array of objects like this (titles and views change; shape verified against live YouTube search):

```json
[
  {
    "status": "ok",
    "sourceType": "search",
    "searchQuery": "espresso machine review",
    "position": 1,
    "videoId": "mAYbmcqPphc",
    "url": "https://www.youtube.com/watch?v=mAYbmcqPphc",
    "title": "The Fellow ES1 Espresso Machine Review",
    "channelName": "James Hoffmann",
    "channelHandle": "@jameshoffmann",
    "channelId": "UCDaoN6x8FhYkIaEdsLcfmCQ",
    "channelUrl": "https://www.youtube.com/channel/UCDaoN6x8FhYkIaEdsLcfmCQ",
    "viewCount": 804647,
    "viewCountText": "804K views",
    "publishedText": "3 months ago",
    "publishedAtApprox": "2026-08-13",
    "durationSeconds": 2056,
    "durationText": "34:16",
    "isShort": false,
    "thumbnailUrl": "https://i.ytimg.com/vi/mAYbmcqPphc/hqdefault.jpg"
  }
]
```

For Shorts only, add `"searchType": "shorts"` (or `"type": "shorts"`). Each Short gets a `/shorts/` URL.

### What you get

| Field | Description |
|---|---|
| `title`, `url`, `videoId` | The video, with a ready-to-open link (Shorts get a `/shorts/` link) |
| `channelName`, `channelHandle`, `channelId`, `channelUrl` | Who published it |
| `viewCount`, `viewCountText` | Views as a number and as YouTube shows them |
| `publishedText`, `publishedAtApprox` | Upload time as YouTube shows it, plus an approximate date |
| `durationSeconds`, `durationText`, `isShort`, `isLive` | Length and format |
| `thumbnailUrl` | Preview image |
| `position`, `searchQuery` | Where the video ranked for which keyword |
| `likeCount`, `commentCount`, `publishDate`, `category`, `description`, `keywords` | Full details mode only |
| `status`, `errorCode`, `errorMessage` | `ok`, or a free `error` row |

A `RUN_SUMMARY` record in the key-value store has the counts, the events charged and HTTP stats.

### How to scrape YouTube search

1. Add one or more **search keywords**.
2. Set **Max results per keyword** (default 50).
3. Optional: set **Type** to Shorts, sort and filter by upload date or duration, pick a country, or turn on **Full video details**.
4. Click **Start** and download JSON, CSV or Excel, or use the API.

#### Input example

```json
{
  "searchQueries": ["espresso machine review", "best budget espresso machine"],
  "maxResultsPerSource": 50,
  "sortBy": "relevance",
  "uploadDate": "year",
  "searchType": "video"
}
```

### Switching from another YouTube search Actor

Already calling **delicious_zebu/youtube-video-scraper-by-keyword**, **streamers/youtube-scraper** or a similar search Actor from code, a schedule or Make/Zapier? Change the Actor ID and keep your input JSON: this Actor accepts the same field names.

| Their input | Here |
|---|---|
| `search_keywords`, `searchKeywords`, `searchQuery`, `keywords`, `query` | Same as `searchQueries` |
| `max_results`, `maxResults`, `maxItems`, `limit` | Same as `maxResultsPerSource` |
| `type` / `searchType` (`videos`, `shorts`) | Same (`searchType`: `video` or `shorts`) |
| `sort_by` / `sortingOrder` (`relevance`, `popularity`, `views`, `date`, `rating`) | Same values (`sortBy`; popularity and views map to view count, date to upload date) |
| `upload_date` / `dateFilter` (`today`, `this_week`, `week`, `this_month`, `month`, `this_year`, `year`, `hour`) | Same values (`uploadDate`) |
| `duration` / `lengthFilter` (`under_3`, `under4`, `3_to_20`, `between420`, `over_20`, `plus20`) | Same values (`duration`: short / medium / long) |
| `fetch_video_details`, `fetchVideoDetails` | Same as `scrapeVideoDetails` |
| `country`, `regionCode`, `gl` | Same (`country`) |
| A `youtube.com/results?search_query=` URL | Treated as a keyword |
| Transcripts, subtitles, AI summaries, feature flags (`4k`, `hd`, …) | Ignored; use the [ScrapeMole YouTube Transcript Scraper](https://apify.com/scrapemole/youtube-transcript-scraper) for transcripts |

Need channel uploads, playlists or a single video by URL? Use the [YouTube Scraper](https://apify.com/scrapemole/youtube-video-channel-scraper). For every Short from a channel or hashtag, use the [YouTube Shorts Scraper](https://apify.com/scrapemole/youtube-shorts-scraper).

### Pricing

Pay per event, no start fee beyond Apify's standard $0.00005 run start:

| Event | Free | Starter (Bronze) | Scale (Silver) | Business (Gold) |
|---|---|---|---|---|
| `video`: one search result | $0.001 | $0.0008 | $0.0006 | $0.0005 |
| `video-details`: search result with full details | $0.003 | $0.002 | $0.0016 | $0.0012 |

1,000 videos cost $1.00 on the Free plan, under the $1.20 charged by the leading keyword-search Actor. Errors and duplicates are free. Set a maximum cost per run and the Actor stops cleanly at that budget.

### Use cases

- **YouTube keyword research:** what ranks for a phrase, who publishes it, and how it performs (views, date, duration).
- **Competitor and trend monitoring:** daily or weekly searches for your terms, newest or most-viewed first.
- **Shorts discovery:** the same keywords, with Type set to Shorts, for short-form ideas and creators.
- **Datasets for AI agents:** titles, channels, dates and thumbnails as flat JSON, ready for a prompt or a spreadsheet. Pair with the ScrapeMole YouTube Transcript Scraper for the spoken text.

### API, Python and AI agents

```python
from apify_client import ApifyClient
client = ApifyClient("<APIFY_TOKEN>")
run = client.actor("scrapemole/youtube-search-scraper").call(run_input={
    "searchQueries": ["espresso machine review"],
    "maxResultsPerSource": 50,
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["title"], item.get("viewCount"), item.get("url"))
```

You can also run it from n8n, Make, Zapier, or the [Apify MCP server](https://mcp.apify.com?tools=scrapemole/youtube-search-scraper). Agents without an Apify account can pay per use via [Apify AGI](https://agi.apify.com).

The same YouTube search data is also sold per call over [x402](https://www.x402.org) (USDC on Base or Solana, no account): [YouTube search](https://scrapemole.com/tools/youtube-search/).

### FAQ

**Do I need a YouTube API key?** No. There is no Data API quota to manage.

**Is this personal data?** No. The Actor returns public video metadata (title, URL, views, date, duration, channel, thumbnail). It does not collect viewer identities or private accounts.

**Can I get Shorts only?** Yes. Set `searchType` to `shorts` (or `type` to `shorts`). The Actor uses YouTube's own Shorts search filter, not "videos that happen to be short". Shorts cards on the search page often omit channel, date and duration; turn on **Full video details** to fill those fields.

**Why are some dates approximate?** Search results show relative times ("3 days ago"). Turn on **Full video details** for an exact `publishDate` (charged as `video-details`).

**How is this different from the ScrapeMole YouTube Scraper?** This listing is search-only: keyword in, videos or Shorts out. The [YouTube Scraper](https://apify.com/scrapemole/youtube-video-channel-scraper) also does channels, playlists and individual video URLs.

**Do I need a paid proxy?** No. Apify's datacenter proxy is enough. This Actor does not switch to paid residential IPs.

### More from ScrapeMole

ScrapeMole builds focused, reliable scrapers for public data: pay per result, no start fees, clear error rows that are never charged, and a `RUN_SUMMARY` on every run.

- [YouTube Transcript Scraper](https://apify.com/scrapemole/youtube-transcript-scraper)
- [YouTube Scraper](https://apify.com/scrapemole/youtube-video-channel-scraper)
- [YouTube Shorts Scraper](https://apify.com/scrapemole/youtube-shorts-scraper)
- [YouTube Channel Scraper](https://apify.com/scrapemole/youtube-channel-scraper)
- [YouTube Comments Scraper](https://apify.com/scrapemole/youtube-comments-scraper)
- [Keyword Autocomplete Scraper](https://apify.com/scrapemole/keyword-autocomplete-scraper)
- [Google Trends Scraper](https://apify.com/scrapemole/google-trends-scraper)
- [Amazon Product Scraper](https://apify.com/scrapemole/amazon-product-scraper)
- [App Store & Google Play Reviews Scraper](https://apify.com/scrapemole/app-reviews-scraper)
- [Telegram Channel Scraper](https://apify.com/scrapemole/telegram-channel-scraper)
- [ATS Jobs Scraper](https://apify.com/scrapemole/ats-jobs-scraper)
- [Google Jobs Scraper](https://apify.com/scrapemole/google-jobs-scraper)
- [US Federal Contracts Scraper](https://apify.com/scrapemole/us-gov-contracts-scraper)

Building an AI agent with its own wallet? The YouTube and Google Trends data is also sold per call over [x402](https://www.x402.org) (USDC on Base, no account): see [scrapemole.com](https://scrapemole.com) or [all ScrapeMole scrapers](https://scrapemole.com/scrapers/). Questions or a missing field? Open an issue on this Actor. ScrapeMole is the maker of this Actor.

# Actor input Schema

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

Keywords or phrases, one per line, just as you would type them in the YouTube search box. Each keyword is searched separately, and every result says which keyword it came from. Also accepts search_keywords, searchQuery, keywords or a youtube.com/results?search_query= URL.

## `maxResultsPerSource` (type: `integer`):

Stop after this many videos or Shorts for each keyword. YouTube search usually stops around 500–600 results. Also accepts max_results, maxResults, maxItems or limit.

## `maxTotalResults` (type: `integer`):

Optional cap on videos delivered across all keywords in this run. Leave empty for no total cap.

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

Regular videos, or YouTube Shorts only (uses YouTube's own Shorts search filter). Also accepts type: videos or shorts.

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

Order of search results. Also accepts sort_by or sortingOrder; popularity and views map to View count.

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

Only return results uploaded in this period, using YouTube's own search filter. Results are also checked against the shown upload time, so older videos never slip in. Also accepts upload_date or dateFilter (this_week, this_month, this_year).

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

Short = under 4 minutes, medium = 4–20 minutes, long = over 20 minutes. Also accepts lengthFilter values (under4, between420, plus20) and under_3 / 3_to_20 / over_20.

## `scrapeVideoDetails` (type: `boolean`):

Also open each video to add exact views, likes, comment count, exact publish date, category, full description and tags. Charged as a 'video with details' instead of a 'video'. Also accepts fetch_video_details.

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

Language code for YouTube texts such as '3 days ago' (e.g. en, de, es). Keep 'en' if you use the parsed numbers and dates. Also accepts hl or contentLanguage.

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

Two-letter country code. Affects search ranking and which videos are available. Also accepts regionCode or gl.

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

How many keywords or video-detail requests to scrape at once.

## `maxRetries` (type: `integer`):

Retries for rate limits, timeouts and server errors, each with a fresh proxy IP.

## `proxyConfiguration` (type: `object`):

Apify Proxy (datacenter) is enough for YouTube search. This Actor does not switch to paid residential IPs.

## Actor input object example

```json
{
  "searchQueries": [
    "espresso machine review"
  ],
  "maxResultsPerSource": 50,
  "searchType": "video",
  "sortBy": "relevance",
  "uploadDate": "any",
  "duration": "any",
  "scrapeVideoDetails": false,
  "language": "en",
  "country": "US",
  "maxConcurrency": 4,
  "maxRetries": 5,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

All dataset rows (status ok or error).

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

JSON summary: processed/ok/failed counts, error codes, events charged, HTTP stats.

# 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": [
        "espresso machine review"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapemole/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": ["espresso machine review"],
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("scrapemole/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 '{
  "searchQueries": [
    "espresso machine review"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call scrapemole/youtube-search-scraper --silent --output-dataset

```

## MCP server setup

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