# YouTube Comments Scraper: Replies, Likes, Pinned (`skillmerc/youtube-comments-scraper`) Actor

Read the public comments of YouTube videos, with replies if you want them. Text, handle, time, likes, reply count, pinned and hearted flags. Top or newest order. No login, no API key.

- **URL**: https://apify.com/skillmerc/youtube-comments-scraper.md
- **Developed by:** [SKILLMERC](https://apify.com/skillmerc) (community)
- **Categories:** Videos
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.28 / 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

For marketers, researchers and creators who want to read what viewers say: give public YouTube videos, get one row per comment (and per reply, if you want them) with likes, reply count, time and pinned or hearted flags.

### What it does

- Reads the public comments of any public video, logged out, the way a visitor sees them.
- Top comments (YouTube's own ranking) or newest first, as YouTube offers.
- Replies on request: each reply is its own row, right after its comment, with `parentCommentId` set.
- One row per comment: text, the author's public @handle, time as shown, likes, reply count, pinned, hearted by the creator, edited, and whether the channel owner wrote it.
- Video facts (title, channel, comment count as shown) go into the run summary and a free named dataset `youtube-comments-videos`. They are never charged.
- No login, no YouTube API key, no browser.

It does not download videos, read transcripts or list a channel's videos, and it never visits commenters' channels. For those jobs, see our YouTube Transcript Scraper Pro and YouTube Channel Videos Scraper actors on Apify.

### Input

| Field | What it means |
|-|-|
| `videoUrls` | Watch links (`youtube.com/watch?v=...`), `youtu.be` links, Shorts or live links, or 11-character video ids. |
| `maxCommentsPerVideo` | Most top-level comments per video. Default 100. `0` reads every comment YouTube shows. |
| `includeReplies` | Off by default. On: also reads the replies under each comment. |
| `maxRepliesPerComment` | Most replies per comment when replies are on. Default 20. `0` reads them all. |
| `sortBy` | `top` (default) or `newest`. In both orders YouTube puts a pinned comment first; it is marked `isPinned`. |

Example:

```json
{
  "videoUrls": ["https://www.youtube.com/watch?v=dQw4w9WgXcQ", "https://youtu.be/uXuQF_PPg5U"],
  "maxCommentsPerVideo": 300,
  "includeReplies": true,
  "maxRepliesPerComment": 10,
  "sortBy": "top"
}
```

### Output

One row per comment or reply in the default dataset:

```json
{
  "videoId": "uXuQF_PPg5U",
  "videoUrl": "https://www.youtube.com/watch?v=uXuQF_PPg5U",
  "videoTitle": "Randomness is a lie. Let me explain",
  "commentId": "UgxI0Hz7VFA_L1Kmn4J4AaABAg",
  "parentCommentId": null,
  "isReply": false,
  "text": "Go to http://hostinger.com/veritasium ...",
  "authorHandle": "@veritasium",
  "authorChannelId": "UCHnyfMqiRRG1u-2MsSQLbXA",
  "authorIsChannelOwner": true,
  "publishedText": "1 day ago",
  "publishedAt": "2026-11-19T02:27:24.107Z",
  "publishedAtApproximate": true,
  "isEdited": false,
  "likeCount": 69,
  "likeCountApproximate": false,
  "replyCount": 17,
  "isPinned": true,
  "isHearted": false,
  "position": 1,
  "sortedBy": "top",
  "scrapedAt": "2026-11-20T14:27:24.107Z"
}
```

- `likeCount` is the number YouTube shows. "1.2K" becomes 1200 with `likeCountApproximate: true`.
- YouTube shows comment times only as "2 weeks ago". `publishedText` keeps that text. `publishedAt` is a date in the middle of the window the text allows ("2 weeks ago" means between 2 and 3 weeks ago) and is always flagged `publishedAtApproximate: true`. We never pass it off as exact.
- `position` is the comment's place in the video's list (1, 2, 3 ...). For a reply it is its place under its comment. `replyCount` is empty on replies.
- `authorChannelId` is the channel id the author's name links to on the page. We do not open that channel.
- The `OUTPUT` record in the key-value store holds the run summary: counts, video info, failures and warnings.

### Pricing

Pay per event: you pay for each comment or reply row delivered.

| Apify plan | Price per 1,000 rows |
|---|---|
| Free | USD 0.40 |
| Bronze | USD 0.36 |
| Silver | USD 0.32 |
| Gold and above | USD 0.28 |

Plus USD 0.00005 per run start. Video info rows and failed videos are free. The run stops when it reaches the maximum cost you set.

### When something fails

A video that does not exist, is private or removed, or has comments turned off goes into the free named dataset `youtube-comments-failed` and the `OUTPUT` record, with the reason. Nothing is charged for it and the run still finishes as succeeded. The same video listed twice is read once, and the same comment is never delivered twice.

| Reason | What it means |
|-|-|
| `not_a_video_url` | The entry is not a YouTube video link or id. A channel or playlist link is not a video. |
| `video_unavailable` | YouTube says the video is not available: removed, private, or blocked where we read it from (US). |
| `comments_off` | The creator turned comments off (common on videos made for kids). |
| `no_comments_section` | The watch page shows no comments at all, for example an age-restricted video, which we do not read. |
| `no_data` | YouTube sent no watch page data. Try again later. |
| `error` | The run stopped on this video for another reason, given in the message. |

### Speed and limits

- One request at a time, at least 300 ms apart, with backoff when YouTube asks us to slow down. A comment page holds about 20 comments and a reply page about 10 replies, so 1,000 comments without replies take about 50 requests.
- We read YouTube in English from the US. Counts and texts follow that.
- If YouTube refuses Apify's own IP, the run switches to Apify's datacenter proxy. It never uses residential proxies or logs in.
- Private, members-only and age-restricted videos are not read.

### Is it legal?

This actor reads only public comments that anyone can see without an account. Comments carry people's names and handles, so they are personal data. You need a lawful basis to store or process them (for example under GDPR or POPIA), and you are responsible for how you use the results. The actor does not collect profiles, does not look for emails, phone numbers or contact details, and never visits commenters' channels. Comment text is copied as the commenter wrote it, so it holds whatever they chose to post in public. Respect YouTube's terms and the commenters' rights.

This actor is not made, endorsed or sponsored by YouTube or Google.

# Actor input Schema

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

Public YouTube videos: a watch link (youtube.com/watch?v=...), a youtu.be link, a Shorts or live link, or the 11-character video id. One per line.

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

Most top-level comments to read from each video. Replies are counted separately (see below). 0 reads every comment YouTube shows.

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

Also read the replies under each comment. Each reply is its own row with parentCommentId set, right after its comment. Slower: about one extra request per 10 replies.

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

Most replies to read under each comment when Include replies is on. 0 reads every reply.

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

The order YouTube offers: Top comments (YouTube's own ranking) or Newest first. In both orders YouTube puts a pinned comment first; it is marked isPinned.

## Actor input object example

```json
{
  "videoUrls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "maxCommentsPerVideo": 100,
  "includeReplies": false,
  "maxRepliesPerComment": 20,
  "sortBy": "top"
}
```

# Actor output Schema

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

No description

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

No description

# 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=dQw4w9WgXcQ"
    ],
    "maxCommentsPerVideo": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("skillmerc/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=dQw4w9WgXcQ"],
    "maxCommentsPerVideo": 100,
}

# Run the Actor and wait for it to finish
run = client.actor("skillmerc/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=dQw4w9WgXcQ"
  ],
  "maxCommentsPerVideo": 100
}' |
apify call skillmerc/youtube-comments-scraper --silent --output-dataset

```

## MCP server setup

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