# YouTube Scraper (`rupom888/youtube-scraper-js`) Actor

Scrape YouTube videos, channels, playlists, Shorts, and comments. Search by keyword, channel URL, playlist URL, or video URL. No API key required — unlimited results.

- **URL**: https://apify.com/rupom888/youtube-scraper-js.md
- **Developed by:** [Syed Rupom](https://apify.com/rupom888) (community)
- **Categories:** Videos, Social media, Lead generation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 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.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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

Extract YouTube videos, channels, playlists, Shorts, comments, and transcripts — no API key, no quotas. Includes **real like counts, subscriber counts, and comment counts** via internal YouTube API enrichment. Priced at **$1 per 1,000 results** (60% cheaper than competitors).

### What it scrapes

- **Search** — find videos by keyword with sort and date filters
- **Channel** — scrape all videos from any YouTube channel
- **Playlist** — extract videos from a playlist URL
- **Video** — get full metadata for a specific video
- **Shorts** — extract Shorts from a channel
- **Comments** — scrape comments from any video
- **Subtitles / Transcripts** — extract auto-generated or manual captions

### Sample output

```json
{
  "video_id": "dQw4w9WgXcQ",
  "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "title": "Rick Astley - Never Gonna Give You Up",
  "description": "The official video...",
  "channel_name": "Rick Astley",
  "channel_id": "UCuAXFkgsw1L7xaCfnd5JJOw",
  "channel_url": "https://www.youtube.com/channel/...",
  "view_count": 1400000000,
  "like_count": 16000000,
  "comment_count": 3200000,
  "subscriber_count": 4100000,
  "subscriber_text": "4.1M subscribers",
  "published_at": "2009-10-25",
  "duration": "3:33",
  "duration_secs": 213,
  "thumbnail": "https://i.ytimg.com/vi/dQw4w9WgXcQ/maxresdefault.jpg",
  "keywords": ["rick astley", "never gonna give you up"],
  "is_short": false,
  "subtitles": null
}
````

### Input

```json
{
  "scrapeType": "search",
  "queries": ["python tutorial for beginners"],
  "resultsPerQuery": 50,
  "sortBy": "relevance",
  "uploadDateFilter": "any",
  "durationFilter": "any",
  "includeSubtitles": false,
  "enrichDetails": true,
  "minViews": 0,
  "minLikes": 0
}
```

### Input fields

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `scrapeType` | string | `search` | Mode: `search`, `channel`, `playlist`, `video`, `shorts`, `comments` |
| `queries` | string\[] | required | Keywords, URLs, or channel handles |
| `resultsPerQuery` | integer | 50 | Max results per query (up to 5,000 for channels/playlists) |
| `sortBy` | string | `relevance` | `relevance`, `upload_date`, `view_count`, `rating` |
| `uploadDateFilter` | string | `any` | `any`, `hour`, `today`, `week`, `month`, `year` |
| `durationFilter` | string | `any` | `any`, `short` (<4 min), `medium` (4–20 min), `long` (>20 min) |
| `enrichDetails` | boolean | true | Fetch real like count, comment count, and subscriber count via internal API |
| `includeSubtitles` | boolean | false | Extract full video transcript/captions |
| `minViews` | integer | 0 | Filter out videos with fewer views |
| `minLikes` | integer | 0 | Filter out videos with fewer likes |

### Scrape type reference

| `scrapeType` | `queries` format | Example |
|---|---|---|
| `search` | Keywords | `"machine learning"` |
| `channel` | Channel URL or handle | `"https://www.youtube.com/@mkbhd"` |
| `playlist` | Playlist URL | `"https://www.youtube.com/playlist?list=..."` |
| `video` | Video URL | `"https://www.youtube.com/watch?v=..."` |
| `shorts` | Channel URL | `"https://www.youtube.com/@channel"` |
| `comments` | Video URL | `"https://www.youtube.com/watch?v=..."` |

### Use cases

- Competitor channel analysis with subscriber and engagement data
- Content research: find top videos by topic with real like/comment counts
- Influencer discovery with subscriber and view metrics
- AI/LLM pipelines: bulk extract transcripts for training or summarization
- Social listening: monitor comments on brand-related videos

### Notes

- No proxy needed — YouTube allows datacenter IPs
- `enrichDetails: true` adds ~150ms per video for real engagement stats
- Channel and playlist scraping supports up to 5,000 results via continuation tokens
- Subtitles available for videos with auto-generated or manual captions

### Pricing

**$1.00 per 1,000 results** — no API key costs, no quota limits. Competitors charge $2.40/1K.

# Actor input Schema

## `scrapeType` (type: `string`):

What to scrape: keyword search, channel videos, playlist, video details, Shorts, or comments.

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

Keywords for search; channel URLs (youtube.com/@channel); playlist URLs; or video URLs for details/comments.

## `resultsPerQuery` (type: `integer`):

Number of videos/comments to extract per query.

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

How to sort keyword search results.

## `uploadDateFilter` (type: `string`):

Filter search results by upload date.

## `durationFilter` (type: `string`):

Filter search results by video duration.

## `minViews` (type: `integer`):

Only return videos with at least this many views. Set 0 to disable.

## `minLikes` (type: `integer`):

Only return videos with at least this many likes. Set 0 to disable.

## `includeSubtitles` (type: `boolean`):

Extract auto-generated subtitles/transcript for each video.

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

YouTube works well without proxy. Proxy optional.

## Actor input object example

```json
{
  "scrapeType": "search",
  "queries": [
    "python programming tutorial"
  ],
  "resultsPerQuery": 50,
  "sortBy": "relevance",
  "uploadDateFilter": "any",
  "durationFilter": "any",
  "minViews": 0,
  "minLikes": 0,
  "includeSubtitles": false,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# 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 programming tutorial"
    ],
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("rupom888/youtube-scraper-js").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 programming tutorial"],
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("rupom888/youtube-scraper-js").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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 programming tutorial"
  ],
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call rupom888/youtube-scraper-js --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=rupom888/youtube-scraper-js",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "YouTube Scraper",
        "description": "Scrape YouTube videos, channels, playlists, Shorts, and comments. Search by keyword, channel URL, playlist URL, or video URL. No API key required — unlimited results.",
        "version": "0.1",
        "x-build-id": "LSrUg166aiiWsSL4s"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/rupom888~youtube-scraper-js/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-rupom888-youtube-scraper-js",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/rupom888~youtube-scraper-js/runs": {
            "post": {
                "operationId": "runs-sync-rupom888-youtube-scraper-js",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/rupom888~youtube-scraper-js/run-sync": {
            "post": {
                "operationId": "run-sync-rupom888-youtube-scraper-js",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "scrapeType",
                    "queries"
                ],
                "properties": {
                    "scrapeType": {
                        "title": "Scrape Type",
                        "enum": [
                            "search",
                            "channel",
                            "playlist",
                            "video",
                            "shorts",
                            "comments"
                        ],
                        "type": "string",
                        "description": "What to scrape: keyword search, channel videos, playlist, video details, Shorts, or comments.",
                        "default": "search"
                    },
                    "queries": {
                        "title": "Search Keywords / Channel URLs / Playlist URLs / Video URLs",
                        "type": "array",
                        "description": "Keywords for search; channel URLs (youtube.com/@channel); playlist URLs; or video URLs for details/comments.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "resultsPerQuery": {
                        "title": "Results Per Query",
                        "minimum": 1,
                        "maximum": 5000,
                        "type": "integer",
                        "description": "Number of videos/comments to extract per query.",
                        "default": 50
                    },
                    "sortBy": {
                        "title": "Sort Search Results By",
                        "enum": [
                            "relevance",
                            "upload_date",
                            "view_count",
                            "rating"
                        ],
                        "type": "string",
                        "description": "How to sort keyword search results.",
                        "default": "relevance"
                    },
                    "uploadDateFilter": {
                        "title": "Upload Date Filter",
                        "enum": [
                            "any",
                            "hour",
                            "today",
                            "week",
                            "month",
                            "year"
                        ],
                        "type": "string",
                        "description": "Filter search results by upload date.",
                        "default": "any"
                    },
                    "durationFilter": {
                        "title": "Duration Filter",
                        "enum": [
                            "any",
                            "short",
                            "medium",
                            "long"
                        ],
                        "type": "string",
                        "description": "Filter search results by video duration.",
                        "default": "any"
                    },
                    "minViews": {
                        "title": "Minimum View Count",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Only return videos with at least this many views. Set 0 to disable.",
                        "default": 0
                    },
                    "minLikes": {
                        "title": "Minimum Like Count",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Only return videos with at least this many likes. Set 0 to disable.",
                        "default": 0
                    },
                    "includeSubtitles": {
                        "title": "Include Subtitles",
                        "type": "boolean",
                        "description": "Extract auto-generated subtitles/transcript for each video.",
                        "default": false
                    },
                    "proxyConfiguration": {
                        "title": "Proxy Configuration",
                        "type": "object",
                        "description": "YouTube works well without proxy. Proxy optional."
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
