# YouTube Search Scraper - Videos by Keyword (`coder2077/youtube-search-scraper`) Actor

Scrape YouTube search results by keyword: video ID, URL, title, duration and thumbnails as JSON. Multiple queries and pages in one run. Fast, no API quota, no proxies. $0.13 per 1,000 result pages.

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

## Pricing

Pay per event

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 - Videos by Keyword

Scrape **YouTube search results** by keyword. For every query you get **video ID, URL, title, duration and thumbnail** as clean JSON, page by page. No YouTube Data API key, no quota limits, no proxies.

### What does YouTube Search Scraper do?

- Search YouTube by **any keyword or phrase**
- **Multiple queries** in one run, **up to 50 pages** per query
- Video ID, watch URL, title, duration and thumbnail
- Rank `position` of every video for each query

### Why use it?

- **Fast and stable** - runs on the same infrastructure as [fastsaver.io](https://fastsaver.io) and [@fastsaver_bot](https://t.me/fastsaver_bot), serving **millions of requests a day**. When a platform changes, it gets fixed here first.
- **No proxies, cookies or logins** - blocks and bot checks are our problem, not yours.
- **Bulk** - paste hundreds of links, processed in parallel.
- **Cheap and predictable** - pay only for successful results. Failed links are free.
- **Developer-friendly** - clean JSON, same shape for every platform, ready for the Apify API, webhooks, Make, Zapier and n8n.

### Use cases

- Track YouTube rankings for keywords (YouTube SEO and rank tracking)
- Find videos for content curation, music apps and Telegram bots
- Research competitors, trends and niches on YouTube
- Pair with YouTube Video Downloader or YouTube Video Info Scraper for a full pipeline

### How to use it

1. Click **Try for free**.
2. Paste your links (search queries) into the input.
3. Click **Start** and wait a few seconds.
4. Download results as **JSON, CSV, Excel** or get them through the **Apify API**.

### Input

```json
{
  "queries": [
    "the weeknd",
    "lofi hip hop"
  ],
  "maxPages": 2
}
```

### Output

```json
{
  "query": "the weeknd",
  "page": 1,
  "position": 1,
  "url": "https://www.youtube.com/watch?v=HgLfYfJtc8M",
  "video_id": "HgLfYfJtc8M",
  "title": "The Weeknd - One Of The Girls",
  "duration": "4:05",
  "thumbnail_url": "https://i.ytimg.com/vi/HgLfYfJtc8M/mqdefault.jpg"
}
```

Each video is a separate dataset row. You are billed per result page (about 20 videos), not per video.

Failed links do not stop the run - they appear as `{ "ok": false, "inputUrl": "...", "error": "..." }` and are **not billed**.

### Pricing

Pay per result. You only pay for successful results.

| Result | Price per 1,000 |
|---|---|
| YouTube search results page | $0.13 |

Plus $0.00005 per run start. Apify's free plan includes $5 of monthly credit, enough for tens of thousands of results.

### Use it as an API

Run the actor and get results in one HTTP call:

```bash
curl -X POST "https://api.apify.com/v2/acts/coder2077~youtube-search-scraper/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"queries":["the weeknd","lofi hip hop"],"maxPages":2}'
```

Works the same from Python (`apify-client`), Node.js (`apify-client`), Make, Zapier, n8n and any HTTP client.

### FAQ

#### Do I need a YouTube Data API key?

No. There is no API key and no daily quota.

#### How many results per page?

About 20 videos per page. Set `maxPages` to go deeper.

#### How is it billed?

Once per search results page, so 1,000 pages (about 20,000 videos) cost the price shown in Pricing.

#### Is it legal to download content from social media?

The actor only accesses publicly available content. Respect copyright and each platform's terms: download content you own, have permission to use, or use under fair use. Do not redistribute other people's content without permission.

#### Something does not work?

Open an issue in the **Issues** tab with the link that failed - we usually fix it the same day.

### More downloaders by the same developer

- [Instagram Downloader - Reels, Video, Photo & Stories](https://apify.com/coder2077/instagram-downloader)
- [TikTok Downloader - No Watermark Video & Music](https://apify.com/coder2077/tiktok-downloader)
- [YouTube Video Downloader - MP4 up to 4K & MP3](https://apify.com/coder2077/youtube-video-downloader)
- [YouTube Video Info Scraper - Formats, Sizes & Metadata](https://apify.com/coder2077/youtube-video-info)
- [Pinterest, Facebook & X (Twitter) Video Downloader](https://apify.com/coder2077/pinterest-facebook-x-downloader)
- [All-in-One Social Media Downloader - Instagram, TikTok, YouTube](https://apify.com/coder2077/social-media-downloader)

Need a plain REST API instead? See [FastSaverAPI](https://api.fastsaver.io).

# Actor input Schema

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

What to search on YouTube. One query per line.

## `maxPages` (type: `integer`):

How many result pages to scrape for each query (about 20 videos per page). Each page is billed once.

## Actor input object example

```json
{
  "queries": [
    "the weeknd",
    "lofi hip hop"
  ],
  "maxPages": 1
}
```

# Actor output Schema

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

All results as a dataset (JSON, CSV, Excel).

# 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": [
        "the weeknd"
    ],
    "maxPages": 1
};

// Run the Actor and wait for it to finish
const run = await client.actor("coder2077/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": ["the weeknd"],
    "maxPages": 1,
}

# Run the Actor and wait for it to finish
run = client.actor("coder2077/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": [
    "the weeknd"
  ],
  "maxPages": 1
}' |
apify call coder2077/youtube-search-scraper --silent --output-dataset

```

## MCP server setup

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