# YouTube Comments Scraper (`getdataforu/youtube-comments-scraper`) Actor

Every comment and reply on any YouTube video or Short, with likes, author, creator hearts and pins, sorted by Top or Newest. No API key needed.

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

## Pricing

from $0.30 / 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?

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

Collect every comment — and every reply — on any YouTube video or Short, sorted by **Top** or **Newest**, with likes, reply counts, the author, and whether the creator **hearted** or **pinned** it.

No YouTube API key, no Google account, no quota limits.

### What it's for

- **Audience research** — read what thousands of viewers actually say about a product, a launch or a competitor.
- **Sentiment and AI analysis** — export clean comment text ready for ChatGPT, Claude or a spreadsheet.
- **Creator engagement** — see which comments the creator hearted, pinned or answered.
- **Product feedback** — filter by keywords like "price", "shipping" or "bug" to surface what buyers keep asking.
- **Giveaways** — pull every entry from a comment-to-enter video.

### What you get for each comment

| | |
|---|---|
| **Comment** | Text, likes, reply count, posting time, edited flag |
| **Thread** | Whether it is a reply, and the ID of the comment it answers |
| **Creator signals** | Hearted by the creator, pinned, written by the channel owner |
| **Author** | Handle, channel ID, channel link, avatar, verified badge |
| **Video** | Video ID and link |

Real rows from a test run on a MrBeast video:

| Author | Comment | Likes | Replies | Pinned |
|---|---|---|---|---|
| @MrBeast | For anyone wondering about litter, don't… | 47K | 904 | yes |
| @Dinozavercek | how our parents used to go to school bac… | 52K | 914 | — |
| @NextStopPrevious | The Antarctica team deserves at least a… | 16K | 98 | — |

### Good to know about the numbers

- **Likes** are exact below 1,000 and rounded above it (`47K`), exactly as YouTube shows them; `likesExact` tells you which.
- **Posting time**: YouTube only publishes relative times ("1 month ago"). The actor keeps that text in `publishedTimeText` and adds an estimated calendar date in `publishedAtApprox`.

### Input

```json
{
  "videoUrls": ["https://www.youtube.com/watch?v=gTKS8SAwUzE"],
  "maxCommentsPerVideo": 500,
  "sortBy": "top",
  "includeReplies": true,
  "maxRepliesPerComment": 20,
  "keywords": ["litter", "Antarctica"]
}
```

| Field | Default | Notes |
|---|---|---|
| `videoUrls` | — | **Required.** Watch pages, youtu.be links, Shorts, live streams or bare video IDs. |
| `maxCommentsPerVideo` | `200` | Top-level comments per video. `0` = all. |
| `sortBy` | `top` | `top` or `newest`. A pinned comment always comes first, as on YouTube. |
| `includeReplies` | `false` | Also collect replies. |
| `maxRepliesPerComment` | `20` | Cap per comment thread. |
| `keywords` | — | Keep only comments containing any of these. Whole words; accents ignored when you type without them. |
| `maxConcurrency` | `3` | Videos processed at the same time. |

### Speed

Measured: **900 comments from 3 videos in 99 seconds, with no retries.**

### How you are charged

- **Each saved comment or reply** is one result.
- **When you use keyword filters**, comments that were read but filtered out are charged a small fraction of that price, because reading them costs the same as saving them.
- Videos with comments turned off, deleted videos and mistyped links are never charged; they appear in `RUN_SUMMARY` with the exact reason.

### Limitations

- Comments YouTube holds for review, or hides from logged-out visitors, cannot be collected.
- Age-restricted and members-only videos need a login.

### Legal

Reads only comments YouTube shows any visitor without logging in. Comments belong to the people who wrote them — use them in line with the privacy law that applies to you.

# Actor input Schema

## `videoUrls` (type: `array`):

YouTube links of any kind - watch pages, youtu.be, Shorts, live streams - or bare video IDs, one per line.

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

Top-level comments to collect from each video. 0 collects all of them. Replies are counted separately.

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

The order YouTube serves comments in. Top is YouTube's default.

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

Also collect the replies under each comment.

## `maxRepliesPerComment` (type: `integer`):

Upper limit of replies collected under any one comment.

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

Keep only comments containing at least one of these words. Matching ignores case, and ignores accents when you type the keyword without them.

## `maxConcurrency` (type: `integer`):

Each video's comments are paged in order, so parallelism is per video.

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

Residential proxies are required: YouTube shows server IPs a bot check instead of data.

## Actor input object example

```json
{
  "videoUrls": [
    "https://www.youtube.com/watch?v=gTKS8SAwUzE",
    "https://youtu.be/8WWrNbHvd44"
  ],
  "maxCommentsPerVideo": 200,
  "sortBy": "top",
  "includeReplies": false,
  "maxRepliesPerComment": 20,
  "maxConcurrency": 3,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

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

Every saved comment and reply with its text, likes, reply count, author, creator hearts and pins, and posting time.

## `summary` (type: `string`):

Per video: comments on the video, collected, replies, saved and filtered; plus inputs that failed.

# 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 = {
    "videoUrls": [
        "https://www.youtube.com/watch?v=gTKS8SAwUzE"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("getdataforu/youtube-comments-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 = { "videoUrls": ["https://www.youtube.com/watch?v=gTKS8SAwUzE"] }

# Run the Actor and wait for it to finish
run = client.actor("getdataforu/youtube-comments-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 '{
  "videoUrls": [
    "https://www.youtube.com/watch?v=gTKS8SAwUzE"
  ]
}' |
apify call getdataforu/youtube-comments-scraper --silent --output-dataset

```

## MCP server setup

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