# YouTube Video Search Scraper (`codenest/youtube-video-search-scraper`) Actor

Input keywords to search YouTube videos. Outputs matching videos with titles, URLs, CDN stream links, thumbnails, channel details, views, likes, comments, durations, tags, mentions, descriptions, codecs, categories, and upload dates.

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

## Pricing

from $5.00 / 1,000 videos

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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 - Keyword-Based Video Discovery & Extraction

**Effortlessly discover and extract YouTube videos by keyword with our powerful **YouTube Video Search Scraper**! This Apify actor enables keyword-based video discovery, bulk video extraction, and comprehensive metadata collection across multiple search terms.**

***

### 📋 Overview

Need to find YouTube videos by topic, track trending content, or build video databases by keyword? This **YouTube Video Search Scraper** delivers:

- 🔍 **Keyword-Based Discovery** - Search YouTube videos by any keyword or topic
- 📋 **Multi-Keyword Support** - Process multiple search terms in a single run
- 🎬 **Direct CDN Stream URLs** - Extract raw video stream links
- 📊 **Complete Engagement Data** - Views, likes, and comments counts
- 🏷️ **Tags & Mentions Extraction** - Full metadata with channel info
- 📱 **Rich Media Assets** - Thumbnails and video download links

Perfect for content researchers 📈, trend analysts 📊, social media managers 🎭, and marketers 🎯!

***

### ⭐ Core Capabilities of YouTube Video Search Scraper

#### 🔍 Keyword Search Discovery

- **Multi-Keyword Support** - Search multiple terms in one run
- **Source Tracking** - Identifies which keyword found each video
- **SERP Data** - Search result titles preserved
- **Video & Shorts Detection** - Supports both regular videos and Shorts

#### 🎬 Complete Video Data

- **Raw CDN Stream URLs** - Direct video stream links from YouTube servers
- **Thumbnail Extraction** - High-quality preview images
- **Video ID & URL** - Unique identifiers for each video
- **Media Type Detection** - Video and Shorts classification

#### 👤 Channel Information

- **Channel Title** - Creator's display name
- **Channel ID** - Unique YouTube channel identifier
- **Channel URL** - Direct channel link
- **Author Attribution** - Full creator details

#### 📊 Engagement Metrics

- **View Counts** - Total views per video
- **Like Counts** - Total likes per video
- **Comment Counts** - Total comments per video
- **Upload Dates** - Publication timestamps

#### 🏷️ Content Intelligence

- **Tag Extraction** - Video tags array
- **Mention Detection** - Extracted @mentions from descriptions
- **Description Analysis** - Full text descriptions
- **Category Classification** - Video category data

#### ⚙️ Technical Specifications

- **Duration Data** - Raw seconds and formatted timestamps
- **Codec Information** - Audio and video codec details
- **Live Stream Detection** - is_live flag
- **Audio Availability** - has_audio indicator

***

### ⚙️ Input Configuration

Simply enter your keywords and click "Start". Input looks like this:

```json
{
  "keywords": [
    "hindi song",
    "game"
  ]
}
```

#### 📝 Input Specifications

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `keywords` | Array | ✅ Yes | - | Search keywords to find YouTube videos |

***

### 📤 Output Structure

Your **YouTube Video Search Scraper** produces comprehensive video data with engagement metrics and technical details:

```json
[
  {
    "video_id": "_sR-2gXggTY",
    "title": "The Juans - BTNS (Official Music Video)",
    "url": "https://www.youtube.com/watch?v=_sR-2gXggTY",
    "raw_cdn_stream_url": "https://rr3---sn-bvvbaxivnuxqjvhj5nu-2pus.googlevideo.com/...",
    "media_type": "video",
    "source_keyword": "hindi song",
    "channel_title": "The Juans",
    "channel_id": "UCCtXr8HiqtdeJQLfzn4rUVw",
    "channel_url": "https://www.youtube.com/channel/UCCtXr8HiqtdeJQLfzn4rUVw",
    "duration": 386,
    "duration_formatted": "6:26",
    "views_count": 852031,
    "likes_count": 16388,
    "comments_count": 1100,
    "mentions": ["@TheJuans", "@Janine"],
    "tags": ["the juans", "official music video", "BTNS"],
    "upload_date": "2020-09-04",
    "thumbnail_url": "https://i.ytimg.com/vi/_sR-2gXggTY/maxresdefault.jpg",
    "description": "Walang may gusto, pero bakit nagkaganito?...",
    "categories": ["Music"],
    "has_audio": true,
    "audio_codec": "mp4a.40.2",
    "video_codec": "avc1.42001E",
    "is_live": false,
    "scraped_at": "2026-10-06T15:17:08.659123+00:00"
  }
]
```

#### 📖 Output Field Documentation

**🔹 Video Identification**
| Field | Description |
|-------|-------------|
| `video_id` | YouTube video ID (unique) |
| `title` | Video title |
| `url` | Direct YouTube watch URL |
| `media_type` | Media type (video or short) |

**🔹 Search Context**
| Field | Description |
|-------|-------------|
| `source_keyword` | Keyword that found this video |
| `scraped_at` | Scrape timestamp (ISO 8601) |

**🔹 Channel Information**
| Field | Description |
|-------|-------------|
| `channel_title` | Creator's channel name |
| `channel_id` | YouTube channel ID |
| `channel_url` | Direct channel URL |

**🔹 Engagement Metrics**
| Field | Description |
|-------|-------------|
| `views_count` | Total view count |
| `likes_count` | Total like count |
| `comments_count` | Total comment count |
| `upload_date` | Publication date (YYYY-MM-DD) |

**🔹 Content Data**
| Field | Description |
|-------|-------------|
| `description` | Full video description |
| `tags` | Video tags array |
| `mentions` | Extracted @mentions |
| `categories` | Video categories |

**🔹 Media Assets**
| Field | Description |
|-------|-------------|
| `raw_cdn_stream_url` | Direct video stream URL from CDN |
| `thumbnail_url` | High-quality thumbnail image |

**🔹 Technical Specifications**
| Field | Description |
|-------|-------------|
| `duration` | Video duration in seconds |
| `duration_formatted` | Formatted duration (HH:MM:SS) |
| `has_audio` | Audio availability flag |
| `audio_codec` | Audio codec (e.g., mp4a.40.2) |
| `video_codec` | Video codec (e.g., avc1.42001E) |
| `is_live` | Live stream status |

***

### 🎨 Key Features of This YouTube Video Search Scraper

#### 🔍 Smart Keyword Search

- **Multi-Term Processing** - Search multiple keywords in one run
- **Source Attribution** - Track which keyword found each video
- **Video & Shorts Support** - Unified results for all video formats
- **Category Detection** - Automatic content classification

#### 📊 Engagement Analytics

- **View Counts** - Video performance metrics
- **Like & Comment Data** - Engagement tracking
- **Cross-Keyword Comparison** - Compare performance by topic
- **Upload Date Analysis** - Temporal content patterns

#### 🏷️ Content Intelligence

- **Tag Extraction** - Topic and trend identification
- **Mention Detection** - Creator attribution tracking
- **Description Analysis** - Full text content
- **Channel Discovery** - Creator identification

#### 🎬 Technical Data

- **Raw CDN Stream URLs** - Direct video download links
- **Codec Information** - Audio and video codec details
- **Thumbnail Images** - High-quality previews
- **Duration Data** - Precise timing information

***

### 💡 Use Cases for YouTube Video Search Scraper

- **📈 Content Research** - Find trending videos by topic
- **📊 Trend Analysis** - Track popular content themes
- **🎭 Social Media Management** - Source content for curation
- **🔬 Market Research** - Study video performance by niche
- **💰 Creator Discovery** - Find channels by content topic
- **📱 Competitor Analysis** - Track competitor videos by keyword
- **🎯 Campaign Planning** - Identify top-performing content themes
- **📋 Database Building** - Create topic-organized video libraries

***

### ✨ Why Choose Our YouTube Video Search Scraper?

- **⚡ Fast & Efficient** - Quick keyword-based discovery
- **🎯 100% Accurate** - Preserves all data without alteration
- **📦 Complete Data** - Everything from engagement to CDN URLs
- **🔄 Regular Updates** - Adapts to YouTube changes
- **🛡️ Production Ready** - Reliable with large keyword sets
- **💰 Cost Efficient** - Optimized for minimal compute time
- **🔒 Privacy Focused** - Only public data extracted

***

### ⚠️ Limitations

- Only works with public YouTube videos
- Raw CDN stream URLs may expire after a certain period
- Some videos may have restricted embed or download access
- Search results depend on YouTube's discoverability
- Rate limits may apply for high-volume scraping

***

### 📧 Need Custom Features for Your YouTube Video Search Scraper?

Want **additional search filters**, **specific engagement thresholds**, **custom output formats**, **advanced analytics**, or **automated reporting**?

✉️ Email **<codenest2.0@gmail.com>** for tailored enterprise solutions!

***

# Actor input Schema

## `keywords` (type: `array`):

List of keywords to search YouTube videos and shorts for (e.g. 'health', 'fitness', 'travel', 'gaming').

## `max_videos_per_keyword` (type: `integer`):

Maximum number of YouTube videos to collect and scrape per keyword (e.g. 20, 50, 100). Free user tier is limited to 3 videos total across the entire run.

## `concurrency` (type: `integer`):

Number of YouTube videos to scrape concurrently in parallel (default: 10). Balances blazing fast speed with complete data extraction accuracy.

## `proxy_serp` (type: `object`):

Apify SERP proxy configuration used to bypass search engine challenges and CAPTCHA during search.

## `proxy_residential` (type: `object`):

Apify Residential proxy configuration used for fetching details without rate limits.

## Actor input object example

```json
{
  "keywords": [
    "health"
  ],
  "max_videos_per_keyword": 20,
  "concurrency": 10,
  "proxy_serp": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "GOOGLE_SERP"
    ]
  },
  "proxy_residential": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

## `overview` (type: `string`):

Tabular overview of scraped YouTube videos with stats, raw CDN stream URLs, and thumbnails.

## `allResults` (type: `string`):

Complete dataset containing all scraped YouTube video items.

## `outputRecord` (type: `string`):

Consolidated JSON array of all scraped YouTube results stored in the default Key-Value Store.

# 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 = {
    "keywords": [
        "health"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("codenest/youtube-video-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 = { "keywords": ["health"] }

# Run the Actor and wait for it to finish
run = client.actor("codenest/youtube-video-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 '{
  "keywords": [
    "health"
  ]
}' |
apify call codenest/youtube-video-search-scraper --silent --output-dataset

```

## MCP server setup

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