# YouTube Comments Scraper — Videos, Playlists & Channels (`jeffev/youtube-comments-pro`) Actor

Extract comments and replies from YouTube videos, whole playlists or channels: text, author, likes, reply count, creator hearts and dates. Top or newest first. Pay only per comment delivered.

- **URL**: https://apify.com/jeffev/youtube-comments-pro.md
- **Developed by:** [Jefferson Valandro](https://apify.com/jeffev) (community)
- **Categories:** Videos, Social media
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.35 / 1,000 comment delivereds

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?

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 Comments Scraper — videos, playlists & whole channels

Extract **comments and replies** from any YouTube video, or from **every video in a playlist or channel**, in one run. Clean, structured data ready for sentiment analysis, community research, lead discovery or training data.

### Why this one

- **Videos, playlists and channels**: paste `youtube.com/@channel` and get the comments of its latest N videos.
- **Replies included** (optional), each linked to its parent with `parentCommentId`.
- **Numbers as numbers**: likes and reply counts come as integers (`4800000`), not text like "4.8M".
- **Top or newest first**, with a per-video limit you control.
- **Creator hearts** flagged, plus author channel ID and avatar.
- **Built-in block handling**: starts direct and switches to Apify Proxy automatically if YouTube blocks the server IP.
- **Pay only per comment delivered.** Videos with comments turned off are listed with the reason, free.

### Input

```json
{
  "urls": ["https://www.youtube.com/watch?v=jNQXAC9IVRw", "https://www.youtube.com/@veritasium"],
  "maxCommentsPerVideo": 200,
  "sortBy": "top",
  "includeReplies": true,
  "maxVideosPerSource": 10
}
```

### Output (one item per comment or reply)

| Field | Description |
|---|---|
| `videoId`, `videoUrl`, `videoTitle` | the video |
| `commentId`, `isReply`, `parentCommentId` | comment identity and thread |
| `text` | comment text |
| `author`, `authorChannelId`, `authorAvatar` | who wrote it |
| `likes`, `replyCount` | integers |
| `heartedByCreator` | true if the creator hearted it |
| `publishedTimeText`, `publishedAtApprox` | "2 weeks ago" and an approximate ISO date |
| `error` | reason when a video had no comments (not charged) |

### Example output

One real item from a test run (long texts and lists shortened):

```json
{
  "videoId": "jNQXAC9IVRw",
  "videoUrl": "https://www.youtube.com/watch?v=jNQXAC9IVRw",
  "videoTitle": "Me at the zoo",
  "commentId": "UgzuC3zzpRZkjc5Qzsd4AaABAg",
  "isReply": false,
  "parentCommentId": null,
  "text": "We're so honored that the first ever YouTube video was filmed here!",
  "author": "@SanDiegoZoo",
  "authorChannelId": "UCC5NfQ6Mf0dq_eEwv4P_hWA",
  "authorAvatar": "https://yt3.ggpht.com/i8RqA9tYqbbnOi4mlnYEY7IR3kXAoDqQbM_5Sfzw7OjTubiGsOaTdlrIZmj-I0q0Vup68eqs=s88-c-k-c0x00ffffff-no-rj",
  "likes": 4800000,
  "replyCount": 985,
  "heartedByCreator": true,
  "publishedTimeText": "6 years ago",
  "publishedAtApprox": "2020-10-07T20:45:41.850170+00:00"
}
```

### How much does it cost?

You pay only for results delivered, at a fixed price per item. **Apify platform usage is included** in that price, so there are no compute costs on top. Errors and items that couldn't be found are free.

| What you get | Price | Example |
|---|---|---|
| Comment delivered | $0.0005 each | 1,000 comment delivereds = $0.50 |

The Apify **Free plan includes $5 of monthly credit**, enough for about **10,000 comment delivereds** per month at no cost. You can also set a maximum spend per run.

On paid Apify plans it gets cheaper automatically: **10% off on Starter, 20% on Scale and 30% on Business**.

### Feedback

Found a bug, a site change, or need an extra field? Open an issue in the **Issues** tab: every issue is read and answered. If this actor saved you time, a **review** helps other people find it.

# Actor input Schema

## `urls` (type: `array`):

One per line: video URL or ID, playlist URL, or channel URL (youtube.com/@name). Playlists and channels expand to their videos.

## `maxCommentsPerVideo` (type: `integer`):

Includes replies when 'Include replies' is on.

## `maxVideosPerSource` (type: `integer`):

Limit of videos taken from each playlist or channel (newest first for channels).

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

Order in which YouTube returns the comments.

## `includeReplies` (type: `boolean`):

Also collect replies to each comment (marked with isReply and parentCommentId).

## `proxy` (type: `object`):

YouTube blocks many server IPs. The Actor starts without a proxy and switches to this one on the first block. Residential is recommended.

## Actor input object example

```json
{
  "urls": [
    "https://www.youtube.com/watch?v=jNQXAC9IVRw"
  ],
  "maxCommentsPerVideo": 100,
  "maxVideosPerSource": 20,
  "sortBy": "top",
  "includeReplies": true,
  "proxy": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

## `comments` (type: `string`):

One item per comment or reply, with author, likes, reply count and date.

# 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 = {
    "urls": [
        "https://www.youtube.com/watch?v=jNQXAC9IVRw"
    ],
    "proxy": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("jeffev/youtube-comments-pro").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 = {
    "urls": ["https://www.youtube.com/watch?v=jNQXAC9IVRw"],
    "proxy": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("jeffev/youtube-comments-pro").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 '{
  "urls": [
    "https://www.youtube.com/watch?v=jNQXAC9IVRw"
  ],
  "proxy": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call jeffev/youtube-comments-pro --silent --output-dataset

```

## MCP server setup

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

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/FbcwWfbVCMJBWHQU5/builds/X6Ac5rphmqSAf7kvB/openapi.json
