# 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:** 4 total users, 2 monthly users, 100.0% runs succeeded, 0 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/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

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 as plain text with timestamps.

## `channelSocialLinks` (type: `boolean`):

When scraping a channel, also fetch the About tab to extract linked social profiles (Facebook, Instagram, Twitter/X, TikTok, LinkedIn, etc.).

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

YouTube works well without proxy. Proxy optional.

## Actor input object example

```json
{
  "scrapeType": "search",
  "queries": [
    "python programming tutorial"
  ],
  "resultsPerQuery": 10,
  "sortBy": "relevance",
  "uploadDateFilter": "any",
  "durationFilter": "any",
  "minViews": 0,
  "minLikes": 0,
  "includeSubtitles": false,
  "channelSocialLinks": 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"
    ],
    "resultsPerQuery": 10,
    "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"],
    "resultsPerQuery": 10,
    "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(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 programming tutorial"
  ],
  "resultsPerQuery": 10,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call rupom888/youtube-scraper-js --silent --output-dataset

```

## MCP server setup

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

```

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/gyl66g5i0elPkr4E8/builds/dKcKLhHXJfygrekLD/openapi.json
