# YouTube Scraper (`devil_port369-owner/youtube`) Actor

Scrape YouTube search results, channel metadata, and Shorts in one Actor. Extract clean JSON data for SEO, lead generation, competitor monitoring, and market research with contact enrichment. The ultimate YouTube scraper and channel data extractor.

- **URL**: https://apify.com/devil\_port369-owner/youtube.md
- **Developed by:** [DataFusionX](https://apify.com/devil_port369-owner) (community)
- **Categories:** Videos, Lead generation, SEO tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

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

**Scrape YouTube search results, videos, channels, Shorts, and competitor data** with one powerful Actor. Extract clean structured JSON for SEO, lead generation, market research, and monitoring.

This is a complete **YouTube scraper**, **YouTube search scraper**, **YouTube video scraper**, and **YouTube channel scraper** built for speed, reliability, and production use.

***

### 🚀 Features

- **6 scraper modes** in a single Actor
  - Search Results
  - Video Details
  - Channel Info
  - Shorts
  - Keyword Monitor
  - Competitor Monitor
- Full support for YouTube filters via official `sp` tokens (sort, duration, upload date, 4K/HD/LIVE, result type)
- Clean, flat JSON output – ready for datasets, CRM, or analysis
- Optional **contact enrichment** (email, phone, website, social links + lead score)
- Concurrent processing with bounded workers
- Pagination support
- Language (`hl`) and geography (`gl`) localization
- Desktop / mobile device emulation
- Built for high success rate

***

### 📥 Input

| Field | Type | Required | Description | Default |
|-------|------|----------|-------------|---------|
| `scraperType` | String | Yes | Mode to run | `searchResults` |
| `searchQueries` | Array | No\* | Keywords for search / shorts / monitors | `["python tutorial"]` |
| `videoUrls` | Array | No\* | Video URLs for videoDetails mode | – |
| `channelUrls` | Array | No\* | Channel URLs for channel / competitorMonitor | – |
| `maxPages` | Integer | No | Max pages per query (0 = unlimited) | `3` |
| `maxResults` | Integer | No | Max total results (0 = unlimited, hard cap 10 000) | `200` |
| `sortBy` | String | No | `relevance` / `rating` / `uploadDate` / `viewCount` | `relevance` |
| `resultType` | String | No | `any` / `video` / `channel` / `playlist` | `any` |
| `duration` | String | No | `any` / `short` / `medium` / `long` | `any` |
| `uploadDate` | String | No | `any` / `hour` / `today` / `week` / `month` / `year` | `any` |
| `features` | Array | No | `4k`, `hd`, `live`, `subtitles`, … | `[]` |
| `hl` | String | No | UI language (en, es, de…) | `en` |
| `gl` | String | No | Country code (us, gb, de…) | `us` |
| `device` | String | No | `desktop` or `mobile` | `desktop` |
| `sp` | String | No | Raw YouTube `sp` token (overrides other filters) | – |
| `includeContactEnrichment` | Boolean | No | Extract emails, phones, socials + lead score | `true` |
| `fetchFullDescriptions` | Boolean | No | Open videos to get full description (slower) | `false` |

\* Required depending on the selected `scraperType`.

#### Input Example

```json
{
  "scraperType": "searchResults",
  "searchQueries": ["best laptop 2026", "python tutorial"],
  "maxPages": 3,
  "maxResults": 150,
  "sortBy": "viewCount",
  "duration": "long",
  "includeContactEnrichment": true
}
```

***

### 📤 Output

Every record is a **flat JSON object** pushed to the default dataset.

#### Common Fields

| Field | Description |
|-------|-------------|
| `type` | Record type (`searchResult`, `short`, `videoDetail`, `channelInfo`, `keywordMonitorVideo`…) |
| `query` | Original search query (when applicable) |
| `title` / `video_title` | Video or Short title |
| `link` / `video_url` | Canonical YouTube URL |
| `video_id` | 11-character video ID |
| `views` | View count (integer) |
| `channel_name` | Channel display name |
| `channel_url` | Channel URL |
| `subscriber_count` | Subscriber count (integer when available) |
| `description` / `channel_description` | Text used for enrichment |
| `scraped_at` | ISO timestamp |
| `email`, `phone`, `website`, `social_links`, `lead_score` | Contact enrichment fields |

#### Example – Search Result

```json
{
  "type": "searchResult",
  "query": "python tutorial",
  "position_on_page": 1,
  "title": "Python for Beginners – Full Course",
  "link": "https://www.youtube.com/watch?v=rfscVS0vtbw",
  "video_id": "rfscVS0vtbw",
  "views": 42000000,
  "length": "4:26:52",
  "published_date": "3 years ago",
  "description": "Learn Python ... contact@example.com",
  "channel_name": "freeCodeCamp.org",
  "channel_url": "https://www.youtube.com/@freecodecamp",
  "channel_verified": true,
  "email": "contact@example.com",
  "lead_score": 45,
  "scraped_at": "2026-08-21T07:30:00+00:00"
}
```

#### Example – Channel Info

```json
{
  "type": "channelInfo",
  "channel_name": "Numberphile",
  "channel_url": "https://www.youtube.com/@Numberphile",
  "channel_handle": "@Numberphile",
  "channel_verified": true,
  "subscriber_count": 4500000,
  "channel_description": "Videos about numbers...",
  "thumbnail_url": "https://yt3.ggpht.com/...",
  "scraped_at": "2026-08-21T07:30:00+00:00"
}
```

***

### 🔍 Use Cases

- **SEO & Content Research** – Discover ranking videos and top channels for any keyword
- **Lead Generation** – Extract emails, phones, Discord, Instagram, LinkedIn from descriptions
- **Competitor Monitoring** – Track what competitors publish and how they rank
- **Keyword Monitoring** – Snapshot search rankings over time
- **Market Research** – Analyze trends, view counts, and audience engagement
- **Shorts Discovery** – Find trending short-form content
- **Channel Analysis** – Pull subscriber counts and descriptions at scale

***

### ❓ Frequently Asked Questions

#### How to scrape YouTube search results?

Set `scraperType` to `searchResults`, provide one or more `searchQueries`, choose sorting and filters, then run the Actor.

#### Can I scrape only channels or only videos?

Yes. Use the `resultType` field (`video`, `channel`, or `playlist`) or pass a custom `sp` token.

#### Does this work as a YouTube Shorts scraper?

Yes. Choose `scraperType: "shorts"` or filter search results for Shorts.

#### How does contact enrichment work?

When enabled, the Actor analyzes description text and extracts emails, phone numbers, websites, and social profiles (Instagram, X, LinkedIn, Discord, Telegram, etc.) plus a lead score (0–100).

#### Can I monitor keywords or competitors over time?

Yes. Use `keywordMonitor` or `competitorMonitor` modes. Each run produces a snapshot + ranked video records that you can store and compare.

#### Is this a YouTube video scraper and channel scraper?

Yes. The Actor supports dedicated modes for video details and channel information in addition to search.

#### Will I get blocked?

The Actor routes all requests through premium inbuilt residential infrastructure, which significantly reduces blocking compared with direct requests.

#### How many results can I get?

Up to 10 000 results per run (hard limit). Use `maxResults` and `maxPages` to control volume and cost.

#### Can I export the data?

Yes. Download the dataset as JSON, CSV, Excel, XML, or HTML from the Apify platform, or access it via API.

***

### 📌 Notes & Limitations

- Only public data is scraped
- Very deep pagination may return fewer results as YouTube exhausts the feed
- Contact enrichment quality depends on what creators write in descriptions
- `fetchFullDescriptions` increases runtime and credit usage
- Respect YouTube’s Terms of Service and applicable laws

***

### 🏷️ Keywords

youtube scraper • youtube search scraper • youtube video scraper • youtube channel scraper • youtube shorts scraper • scrape youtube • yt scraper • youtube data extractor • youtube comment scraper • youtube lead generation • youtube competitor monitoring • youtube keyword monitor

***

### 📄 License

This Actor is provided for legitimate research, analysis, and business use. Users are responsible for complying with YouTube’s Terms of Service and all applicable laws.

````

---

# Actor input Schema

## `scraperType` (type: `string`):

Choose what data to extract from YouTube.
## `searchQueries` (type: `array`):

Search keywords (used by searchResults, shorts, keywordMonitor, competitorMonitor).
## `videoUrls` (type: `array`):

YouTube video URLs (for videoDetails mode).
## `channelUrls` (type: `array`):

YouTube channel URLs (for channel and competitorMonitor modes).
## `maxPages` (type: `integer`):

Maximum pages per query (0 = unlimited, still bounded by maxResults).
## `maxResults` (type: `integer`):

Maximum total results to return (0 = unlimited, hard cap 10000).
## `sortBy` (type: `string`):

Sort order (maps to YouTube sp tokens).
## `resultType` (type: `string`):

Restrict results to videos, channels, or playlists only.
## `duration` (type: `string`):

Filter by video length.
## `uploadDate` (type: `string`):

Filter by when the video was uploaded.
## `features` (type: `array`):

Extra video features to require (4K, HD, LIVE, subtitles…). Only first value is applied (YouTube limitation).
## `hl` (type: `string`):

YouTube UI language (en, es, de, fr, ja…). Affects date/view strings.
## `gl` (type: `string`):

Country code that influences ranking (us, gb, de, in…).
## `device` (type: `string`):

Desktop or mobile layout.
## `sp` (type: `string`):

Raw YouTube sp token. Overrides sortBy / resultType / duration / uploadDate / features when set.
## `includeContactEnrichment` (type: `boolean`):

Extract email, phone, website and social links from descriptions + lead score.
## `fetchFullDescriptions` (type: `boolean`):

For search results, optionally open each video to get the complete description (slower, more credits).

## Actor input object example

```json
{
  "scraperType": "searchResults",
  "searchQueries": [
    "python tutorial"
  ],
  "videoUrls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "channelUrls": [
    "https://www.youtube.com/@Numberphile"
  ],
  "maxPages": 3,
  "maxResults": 200,
  "sortBy": "relevance",
  "resultType": "any",
  "duration": "any",
  "uploadDate": "any",
  "features": [],
  "hl": "en",
  "gl": "us",
  "device": "desktop",
  "includeContactEnrichment": true
}
````

# Actor output Schema

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

Extracted YouTube search results, video details, comments, channel info, Shorts, and contact enrichment data stored in the default dataset.

# 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 = {
    "scraperType": "searchResults",
    "searchQueries": [
        "python tutorial"
    ],
    "videoUrls": [
        "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    ],
    "channelUrls": [
        "https://www.youtube.com/@Numberphile"
    ],
    "maxPages": 3,
    "maxResults": 200,
    "sortBy": "relevance",
    "resultType": "any",
    "duration": "any",
    "uploadDate": "any",
    "features": [],
    "hl": "en",
    "gl": "us",
    "device": "desktop",
    "sp": "",
    "includeContactEnrichment": true,
    "fetchFullDescriptions": false
};

// Run the Actor and wait for it to finish
const run = await client.actor("devil_port369-owner/youtube").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 = {
    "scraperType": "searchResults",
    "searchQueries": ["python tutorial"],
    "videoUrls": ["https://www.youtube.com/watch?v=dQw4w9WgXcQ"],
    "channelUrls": ["https://www.youtube.com/@Numberphile"],
    "maxPages": 3,
    "maxResults": 200,
    "sortBy": "relevance",
    "resultType": "any",
    "duration": "any",
    "uploadDate": "any",
    "features": [],
    "hl": "en",
    "gl": "us",
    "device": "desktop",
    "sp": "",
    "includeContactEnrichment": True,
    "fetchFullDescriptions": False,
}

# Run the Actor and wait for it to finish
run = client.actor("devil_port369-owner/youtube").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 '{
  "scraperType": "searchResults",
  "searchQueries": [
    "python tutorial"
  ],
  "videoUrls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "channelUrls": [
    "https://www.youtube.com/@Numberphile"
  ],
  "maxPages": 3,
  "maxResults": 200,
  "sortBy": "relevance",
  "resultType": "any",
  "duration": "any",
  "uploadDate": "any",
  "features": [],
  "hl": "en",
  "gl": "us",
  "device": "desktop",
  "sp": "",
  "includeContactEnrichment": true,
  "fetchFullDescriptions": false
}' |
apify call devil_port369-owner/youtube --silent --output-dataset

```

## MCP server setup

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

```

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/W2IcH4FZMKNocDvpo/builds/BbN3Em1xNawUffGni/openapi.json
