# YouTube Search Scraper — All Filters, Numeric Views & Length (`engineertsaistudio/youtube-search-scraper-filters-views-duration`) Actor

Scrape YouTube search results with every filter: sort, upload date, duration, Live, 4K, HD, HDR, subtitles, Creative Commons. Views as integers, duration in seconds. No API key or quota.

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

## Pricing

from $1.50 / 1,000 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.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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 — All Filters, Numeric Views & Length

Scrape **YouTube search results** for any keyword into JSON, CSV or Excel, using the same filters as
YouTube's own filter menu, and get **numbers you can sort and chart right away**: `viewCount` as an
integer, `durationSeconds`, and an approximate publish date.

No YouTube Data API key, no quota.

**Choose this Actor when** you need filtered keyword research at scale — for example "videos uploaded
this week, 4–20 minutes long, with subtitles, sorted by views" — and want clean numeric columns instead of
text like "1.2M views".

**Not the right fit when** you need channel search, playlists, comments or full video details (likes,
tags, full description, transcript): this Actor returns search-result rows only.

### Use cases

- **YouTube SEO and keyword research** — who ranks for a keyword, their views and video length.
- **Trend tracking** — daily runs sorted by upload date to catch new videos on a topic.
- **Influencer discovery** — channels publishing in a niche, with verified badges and view counts.
- **Content gap research** — popular topics with few recent long-form videos.
- **Data and AI pipelines** — feed fresh video URLs into transcript, summarization or sentiment tools.

### Filters

| Input | Values |
|---|---|
| `sortBy` | `relevance`, `upload_date`, `view_count`, `rating` |
| `uploadDate` | `hour`, `today`, `week`, `month`, `year` |
| `duration` | `short` (< 4 min), `medium` (4–20 min), `long` (> 20 min) |
| `features` | `live`, `4k`, `hd`, `hdr`, `subtitles`, `creativeCommons` |
| `includeShorts` | Also return Shorts (ignored when a date, duration or feature filter is set) |
| `country`, `language` | Localize results, e.g. `US` / `en`, `TW` / `zh-TW` |
| `maxResultsPerQuery` | Default 50; YouTube usually serves up to about 500–600 per search |

### Input example

```json
{
  "queries": ["n8n tutorial", "claude code"],
  "maxResultsPerQuery": 100,
  "sortBy": "upload_date",
  "uploadDate": "week",
  "duration": "medium",
  "features": ["subtitles"],
  "country": "US",
  "language": "en"
}
```

### Output example (one video)

```json
{
  "type": "video",
  "title": "n8n Tutorial – Zero to Hero Course",
  "url": "https://www.youtube.com/watch?v=UIf-SlmMays",
  "videoId": "UIf-SlmMays",
  "channelName": "freeCodeCamp.org",
  "channelId": "UC8butISFwT-Wl7EV0hUK0BQ",
  "channelUrl": "https://www.youtube.com/@freecodecamp",
  "channelVerified": true,
  "viewCount": 991118,
  "viewCountText": "991,118 views",
  "durationSeconds": 12908,
  "duration": "3:35:08",
  "publishedDateApprox": "2025-12-16",
  "publishedTimeText": "9 months ago",
  "isLive": false,
  "badges": ["4K", "CC"],
  "descriptionSnippet": "…",
  "thumbnailUrl": "https://i.ytimg.com/…",
  "query": "n8n tutorial",
  "rank": 1,
  "page": 1,
  "fetchedAt": "2026-09-16T15:48:34Z"
}
```

### Pricing

**$1.50 per 1,000 results**.

Queries that fail are never charged. Platform usage is included. Example: 5,000 results = $7.50.
Set a maximum cost per run for a hard cap.

### FAQ

**How many results per query?** YouTube typically serves up to about 500–600 videos per search. Use
filters or several related queries to go deeper.

**Why is the publish date approximate?** Search results only show relative times ("3 weeks ago"). The
Actor converts them to a date — exact for recent videos, approximate for older ones.

**Do I need a YouTube API key?** No, and there is no daily quota.

**Can I get Shorts?** Yes — turn on `includeShorts`; Shorts rows have `type: "short"`.

**Which `language` should I use?** Keep `en` if you rely on `publishedDateApprox` and `viewCount`:
the relative-time and count text is parsed for English.

**Is it legal?** It collects publicly visible search results and no personal data beyond public channel
names. You are responsible for using the data in line with applicable laws and YouTube's terms.

**Need a feature?** Open an issue on the Issues tab — include your run ID.

# Actor input Schema

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

What to search on YouTube. Each query is searched separately.

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

How many videos to return for each query. YouTube usually returns up to about 500-600 results per search.

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

Order of the results.

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

Only return videos uploaded in this period.

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

Only return videos of this length.

## `features` (type: `array`):

Only return videos that have all of these features.

## `includeShorts` (type: `boolean`):

Also return Shorts that appear in the results. Ignored when an upload date, duration or feature filter is set.

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

Two-letter country code that YouTube localizes results for, e.g. US, GB, IN, TW.

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

Interface language code, e.g. en, es, ja, zh-TW. Affects text such as '3 days ago'; dates and counts are still parsed for English.

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

Apify Proxy helps avoid rate limits on large runs.

## Actor input object example

```json
{
  "queries": [
    "n8n tutorial",
    "claude code"
  ],
  "maxResultsPerQuery": 50,
  "sortBy": "relevance",
  "uploadDate": "",
  "duration": "",
  "includeShorts": false,
  "country": "US",
  "language": "en",
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# 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": [
        "n8n tutorial",
        "claude code"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("engineertsaistudio/youtube-search-scraper-filters-views-duration").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": [
        "n8n tutorial",
        "claude code",
    ],
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("engineertsaistudio/youtube-search-scraper-filters-views-duration").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": [
    "n8n tutorial",
    "claude code"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call engineertsaistudio/youtube-search-scraper-filters-views-duration --silent --output-dataset

```

## MCP server setup

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

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/rvNKvIYobeD4XfTFH/builds/ayS4T8OYM6MwlSDc5/openapi.json
