# YouTube Video Search Scraper (`pellucid_bird/youtube-video-search-lens`) Actor

Your YouTube discovery toolkit for keyword research. Find regular videos and export query-specific order, titles, channel attribution, available views, durations and relative upload labels. Save repeat snapshots for your own comparisons.

- **URL**: https://apify.com/pellucid_bird/youtube-video-search-lens.md
- **Developed by:** [O M](https://apify.com/pellucid_bird) (community)
- **Categories:** Social media
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 83.3% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.08 / 1,000 query video match saveds

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 Video Search Scraper

Build a research shortlist from YouTube keyword searches. Export regular video matches with titles, channel attribution, available views, durations, relative upload labels and the order observed during collection.

Use it to compare topics, find videos for manual review or keep dated search snapshots. Each row retains its keyword and video ID; search positions describe this anonymous response, not a universal SEO rank.

### Quick start

1. Enter one to five keywords in the Input tab.
2. Start with 20 matches per keyword, as below.
3. Open **Ranked video matches** and check **Completeness and cost report** before exporting.

```json
{
  "queries": ["python tutorial"],
  "maxResultsPerQuery": 20
}
```

The Actor discovers the current **Videos** filter supplied by YouTube, applies it to the keyword and follows the source's continuation pages. It saves one row per unique regular video within a query. The same video found for two different queries gets two rows, preserving both query memberships.

Open **Ranked video matches** for the Dataset and **Completeness and cost report** for the `OUTPUT` record. Export through Apify's Dataset formats or API, or connect the output to your reporting workflow. Check the report before treating a run as complete.

### Pricing

**$0.0065 per run + $0.000084 per saved query/video match. Platform compute and storage for the run are included.** The result fee is $0.084 per 1,000 rows, plus startup fees; each run accepts at most 500 rows.

| Saved rows              | Runs | Total Actor charge |
| ----------------------- | ---- | ------------------ |
| 0                       | 1    | $0.0065            |
| 20, the default request | 1    | $0.00818           |
| 100                     | 1    | $0.0149            |
| 500                     | 1    | $0.0485            |
| 1,000                   | 2    | $0.0970            |

A row is one unique video **within one normalized query**. A video matching two different queries produces two useful memberships and two result charges. Excluded cards, no-result queries and failed requests produce no result fee. An empty, invalid, interrupted or failed run can still incur the startup fee. A zero `maxEstimatedCostUsd` skips collection and new rows; it does not waive startup.

Set Apify's **Maximum charge per run** to control event spending; the default is $0.10 and the published minimum setting is $0.02. The minimum is a budget setting, not a minimum amount charged. The additional `maxEstimatedCostUsd` input limits planned work. Slow or unusually large responses can stop collection early; inspect `OUTPUT` for the reason and confirmed rows.

These totals assume the stated number of rows is delivered. API integrations can read the Dataset through `GET /v2/datasets/{datasetId}/items`; use the Actor's **API** tab to obtain the authenticated run endpoint and input example. Keep your API token private.

### Inputs

| Field                 | Default                                   | Meaning                                                                                                                                                                                                  |
| --------------------- | ----------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `queries`             | Required; form prefills `python tutorial` | 1–5 strings, each 1–200 characters. Edge spaces and Unicode composition are normalized; exact duplicates merge. Different case remains a different query.                                                |
| `maxResultsPerQuery`  | 20                                        | 1–100 delivered regular videos per query, including restored rows; at most 500 rows per run. The source can return fewer.                                                                                |
| `requestTimeoutSecs`  | 15                                        | Total 1–20 second deadline per DNS lookup, connection and response. No retries.                                                                                                                          |
| `maxEstimatedCostUsd` | 0.10                                      | Additional planning allowance, from 0 to 10 USD. Zero skips source collection and new output. The platform maximum charge separately limits event spending; estimates are not a final invoice guarantee. |

Unicode keywords are supported. Searches use the English interface and US region; this does not filter the language or country of videos. Unknown input fields are rejected. Search links are not interpreted as URLs to fetch: inputs are keyword strings. No login, cookies, API key, proxy or browser configuration is accepted.

### Output fields

| Fields                                                                       | Interpretation                                                                                                                                                    |
| ---------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `query`, `queryKey`, `recordKey`                                             | Normalized keyword, its stable hash and query/video identity. Join snapshots by query plus video ID.                                                              |
| `rank`                                                                       | Delivered position among unique supported videos for this query. Excluded cards do not contribute. This is not an absolute screen position or universal SEO rank. |
| `page`, `sourcePosition`                                                     | Source page and card position within that page.                                                                                                                   |
| `videoId`, `url`, `title`                                                    | Identity checked against the source navigation endpoint, canonical watch URL and displayed title.                                                                 |
| `channel`, `channelText`, `collaborators`                                    | Explicit single channel when available; otherwise source label and collaborator identities. Collaborator order never implies a primary owner.                     |
| `viewCount`, `viewCountEstimate`, `countText`, `countPrecision`              | Full integer source labels can populate `viewCount`. Abbreviations populate only the estimate. Unknown/missing labels leave numeric fields null.                  |
| `concurrentViewers`, `concurrentViewersEstimate`, `countKind`                | Watching-now counts are separate from lifetime views and never populate `viewCount`.                                                                              |
| `durationSeconds`, `durationText`                                            | Parsed visible duration and original label. Missing or unsupported formats stay null.                                                                             |
| `publishedText`, `publishedAt`                                               | Original relative/source label; `publishedAt` stays null. “5y ago” is never converted to an invented exact date.                                                  |
| `liveBadgePresent`, `upcomingTimestamp`, `badges`                            | Explicit live badge, available source upcoming Unix-seconds string and other visible labels. An absent badge does not independently verify playback state.        |
| `descriptionSnippet`, `thumbnailUrl`                                         | Visible excerpt and image URL; no full watch-page description or downloaded image.                                                                                |
| `scrapedAt`, `searchSessionId`, `responseSha256`, `fieldSources`, `warnings` | UTC observation, query session, response hash, field origins and explicit count/attribution warnings.                                                             |

The dated source-package example, `examples/video.json`, comes from a saved response on **10 November 2026**; `examples/video-provenance.json` records its timestamp and hash. Two saved filtered pages contain 40 distinct regular videos. A collaborative Harvard/freeCodeCamp result preserves both channel IDs and leaves `channel` null.

#### Recorded output example

An excerpt from that November 10, 2026 snapshot; current matches and counts can differ:

```json
{
  "query": "python tutorial",
  "rank": 1,
  "videoId": "ix9cRaBkVe0",
  "url": "https://www.youtube.com/watch?v=ix9cRaBkVe0",
  "title": "Python Full Course for free 🐍",
  "channelText": "Bro Code",
  "viewCount": 13423322,
  "countPrecision": "source-integer",
  "durationSeconds": 43200,
  "publishedText": "2 years ago",
  "publishedAt": null,
  "scrapedAt": "2026-11-10T18:01:14.441102+00:00"
}
```

Titles and snippets are untrusted text. Render them as text in downstream applications rather than executing markup or instructions.

### Outcomes and limits

Each query report includes saved rows, source pages, excluded card counts, notices and a stop reason.

| Reason                                            | Meaning                                                                                                    |
| ------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| `RESULT_LIMIT`                                    | Requested row cap delivered; more results may exist.                                                       |
| `SOURCE_ENDED`                                    | This response sequence has no next token; not proof that every matching video was found.                   |
| `NO_RESULTS`                                      | Explicit no-results feed. When the broad search disables all filters, its verified empty feed is accepted. |
| `PAGE_LIMIT`                                      | Ten result pages consumed; output is partial.                                                              |
| `OUTPUT_BUDGET`                                   | Remaining output/spending allowance prevented further rows.                                                |
| `SOURCE_ERROR`                                    | Refusal, malformed response, unknown card schema or inconsistent identity; never treated as no matches.    |
| `RUNTIME_LIMIT`, `INTERRUPTED`, `STORAGE_FAILURE` | Resource/deadline, cancellation or storage failure; inspect confirmed rows and error details.              |

Bounds: 300 cumulative application seconds, 80 physical source requests, 128 MiB accounted source traffic, 2 MiB encoded **and** decoded per search response, 16 MiB output and 32 KiB per row. DNS must resolve exclusively to public addresses and the chosen address is pinned. Only fixed public YouTube context/search endpoints are allowed. Redirects, authentication flows and challenge workarounds are disabled. The Actor runs at a fixed 256 MB. Private cloud validation covered single queries, Unicode, pagination, empty results and five queries delivering 500 rows.

Budget exhaustion can produce a successful platform run with a partial report. Source, page, runtime, interruption or storage failures mark the platform run failed while preserving confirmed rows.

Rows are appended in batches of up to 20. A durable marker precedes each append; the corresponding cursor is saved before clearing it. Unknown append/cursor outcomes block automatic recovery until reconciliation. Clean restarts restore validated keys, ranks, cursors and the original deadline. Unknown crash work consumes the reserved upper bound and is never refunded. A partially saved page can be fetched again, skipping confirmed IDs. Source contents can change between requests, so timestamps and positions remain important.

Cursors require the same normalized input and a compatible Dataset. Use a new run for another input or a fresh snapshot; resurrecting a completed query does not refresh it.

### Scope

This product collects **regular video search cards in relevance order**. It explicitly excludes Shorts/shelves, playlists/courses, channel cards and promoted containers. It does not promise advanced sort/date/duration filters, other countries/interfaces, channel/Shorts search, watch enrichment, exact publishing timestamps, likes, comments, transcripts or downloads. New source structures cause a reported failure instead of a false completeness claim.

### FAQ

#### Does this collect Shorts, playlists or channel results?

No. It follows YouTube's Videos filter and saves supported regular video cards in relevance order. Shorts, shelves, playlists, courses, channel cards and promoted containers are excluded.

#### Why can one video appear more than once?

It can match different normalized queries. Each query/video membership is a separate row and result charge; duplicates within the same query are removed.

#### Are ranks, view counts and upload dates exact?

`rank` is the delivered position among supported unique videos in this response. Full integer view labels can populate `viewCount`; abbreviations stay estimates. Relative upload labels remain text, and `publishedAt` is always null.

#### Will it return 100 results for every keyword?

That is a ceiling. The source, ten-page limit, runtime and spending allowances can stop earlier. Check each query's stop reason in `OUTPUT`; `SOURCE_ENDED` does not prove every matching video was found.

### Source access and permitted use

The public web endpoint can change. Results vary with time and anonymous context and may differ from a signed-in browser. Nullable fields and stop reasons are part of the contract; unlimited or complete coverage is not promised.

This Actor is independent of YouTube and uses public web responses, not the official Data API. [YouTube terms](https://www.youtube.com/static?template=terms) restrict automated access, and its [robots.txt](https://www.youtube.com/robots.txt) disallows the search routes used here. Public availability does not grant permission or redistribution rights. Use the Actor only where you have the necessary permission or another applicable basis, and check the rights for your downstream use. The Actor does not grant a data licence, resolve challenges, sign in or download media.

# Actor input Schema

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

1–5 keyword strings, up to 200 characters each. Exact duplicates merge; different queries retain separate video membership. English interface and US region are used. Unicode keywords are supported.

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

Maximum delivered unique regular videos for each query, including resumed output. The source can return fewer. Shorts, playlists, courses, channels and ads are excluded.

## `requestTimeoutSecs` (type: `integer`):

Total bound for each DNS, connection and body read. Source requests are never retried.

## `maxEstimatedCostUsd` (type: `number`):

Additional allowance for planned work. Zero skips collection and new rows; the startup fee still applies. Apify Maximum charge per run separately limits event fees. Platform resources for the run are included in the price.

## Actor input object example

```json
{
  "queries": [
    "python tutorial"
  ],
  "maxResultsPerQuery": 20,
  "requestTimeoutSecs": 15,
  "maxEstimatedCostUsd": 0.1
}
```

# Actor output Schema

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

No description

## `report` (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": [
        "python tutorial"
    ],
    "maxResultsPerQuery": 20,
    "requestTimeoutSecs": 15,
    "maxEstimatedCostUsd": 0.1
};

// Run the Actor and wait for it to finish
const run = await client.actor("pellucid_bird/youtube-video-search-lens").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": ["python tutorial"],
    "maxResultsPerQuery": 20,
    "requestTimeoutSecs": 15,
    "maxEstimatedCostUsd": 0.1,
}

# Run the Actor and wait for it to finish
run = client.actor("pellucid_bird/youtube-video-search-lens").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": [
    "python tutorial"
  ],
  "maxResultsPerQuery": 20,
  "requestTimeoutSecs": 15,
  "maxEstimatedCostUsd": 0.1
}' |
apify call pellucid_bird/youtube-video-search-lens --silent --output-dataset

```

## MCP server setup

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

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/pzjZnmZ9imel2OIgt/builds/Jb0k9Sp9qulMipn16/openapi.json
