# YouTube Comments Scraper - Comments & Replies, No Login (`ragnum/youtube-comments-scraper`) Actor

Scrape comments and replies from any public YouTube video or Short: text, likes as numbers, reply counts, pinned and hearted flags, author channel IDs and handles, Top or Newest. $0.25 per 1,000 comments, platform usage included, no per-video fee, errors and duplicates free.

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

## Pricing

from $0.17 / 1,000 comments

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 — Comments & Replies, No Login

Get the comments and replies of any public **YouTube video or Short** as clean rows: comment text, likes as real numbers, reply counts, pinned and creator-hearted flags, edit status, and the author's channel ID, @handle, name and badges. Choose **Top** or **Newest** order. No login, no API key, no account.

**$0.25 per 1,000 comments (replies included), platform usage included. No per-video fee and no minimum. Failed videos, videos with comments turned off, and duplicates are free.**

### What you can do with it

- **Audience research:** read what viewers say about a product launch, a trailer or a competitor's review video.
- **Sentiment analysis and AI:** feed thousands of comments into an LLM or a sentiment model; every row has the same keys and typed values.
- **Monitor new comments:** schedule a run with `"sort": "newest"` and a small per-video limit to catch fresh comments on your own videos.
- **Find engaged fans and creators:** sort by `likeCount`, filter `isHeartedByCreator`, or group by `author.channelId`.
- **Shorts too:** paste `https://www.youtube.com/shorts/…` URLs like any other video.

### Copy to your AI assistant

```
Use the Apify Actor "ragnum/youtube-comments-scraper" to get YouTube comments.
Minimal input: {"videos": ["https://www.youtube.com/watch?v=dQw4w9WgXcQ"], "maxCommentsPerVideo": 100}
Options: "sort": "top" | "newest"; "includeReplies": true; "maxRepliesPerComment": 20; "maxResults": 1000.
Price: $0.25 per 1,000 comments or replies saved. Error rows (errorCode set) are free.
Docs: https://apify.com/ragnum/youtube-comments-scraper.md
MCP: https://mcp.apify.com?tools=ragnum/youtube-comments-scraper
```

### Quick start

**100 top comments of one video** (the default)

```json
{
    "videos": ["https://www.youtube.com/watch?v=dQw4w9WgXcQ"]
}
```

**Several videos and Shorts, newest comments first**

```json
{
    "videos": [
        "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
        "https://youtu.be/jNQXAC9IVRw",
        "https://www.youtube.com/shorts/ai1gIWacf0I"
    ],
    "sort": "newest",
    "maxCommentsPerVideo": 200
}
```

**Comments with their replies, capped for a predictable cost**

```json
{
    "videos": ["dQw4w9WgXcQ"],
    "maxCommentsPerVideo": 500,
    "includeReplies": true,
    "maxRepliesPerComment": 10,
    "maxResults": 3000
}
```

**Every comment of a video** (can be millions on popular videos; set `maxResults` as a safety cap)

```json
{
    "videos": ["https://www.youtube.com/watch?v=dQw4w9WgXcQ"],
    "maxCommentsPerVideo": 0,
    "maxResults": 50000
}
```

### Input

| Field | Type | Default | What it does |
|---|---|---|---|
| `videos` | array of strings | sample video | Video or Shorts URLs (`watch?v=`, `youtu.be/`, `/shorts/`, `/live/`, `/embed/`) or 11-character video IDs. The same video given twice is scraped once. Channel, playlist and search links get a free `INVALID_INPUT` error row. |
| `sort` | `top` / `newest` | `top` | Top comments (YouTube's default order) or newest first. |
| `maxCommentsPerVideo` | integer | `100` | Top-level comments per video. `0` = all. Replies are not counted here. |
| `includeReplies` | boolean | `false` | Also save the replies under each comment, one row per reply. |
| `maxRepliesPerComment` | integer | `20` | Replies per comment when `includeReplies` is on. `0` = all. |
| `maxResults` | integer | none | Cap on all rows (comments + replies) for the whole run. |
| `hl` | string | `en` | Interface language for texts like "3 days ago" and "1.2K" (comments stay in their own language). |
| `gl` | string | `US` | Country code for YouTube's regional settings. |
| `maxConcurrency` | integer | `10` | Parallel requests (1–20). Faster for many videos; same price. |

The other advanced settings are managed for you; keep their defaults.

**How the limits work together:** `maxCommentsPerVideo` counts only top-level comments. Each of them can bring up to `maxRepliesPerComment` replies, so one video returns at most `maxCommentsPerVideo × (1 + maxRepliesPerComment)` rows. `maxResults` caps the whole run, replies included. Example: 100 comments × (1 + 20 replies) = up to 2,100 rows per video; set `maxResults` to stay within a budget.

### Output

One row per comment or reply. Every row has every field; values YouTube doesn't show are `null`. Dataset views: **Overview** and **All fields**.

| Field | Type | Description |
|---|---|---|
| `commentId` | string | YouTube comment ID. Replies look like `<parentCommentId>.<replyId>`. |
| `videoId` | string | 11-character video ID. |
| `videoUrl` | string | Video URL (the Shorts URL when you gave a Short). |
| `videoTitle` | string | Video title. |
| `text` | string | Comment text. |
| `likeCount` | number | Likes as a number (`0` when none). |
| `likeCountText` | string | Likes as YouTube shows them, e.g. `"570K"`. |
| `replyCount` | number | Replies to this comment (`0` for replies). |
| `publishedTimeText` | string | Relative time as shown, e.g. `"6 years ago"`. |
| `publishedAtEstimate` | string | **Estimated** posting time, ISO 8601 UTC (scrape time minus the relative time). |
| `isEdited` | boolean | The comment was edited (the "(edited)" marker is removed from `publishedTimeText`). |
| `isPinned` | boolean | Pinned by the creator. |
| `isHeartedByCreator` | boolean | The creator gave it a heart. |
| `isReply` | boolean | `true` for replies. |
| `parentCommentId` | string | For replies: the comment it answers. `null` for top-level comments. |
| `author.channelId` | string | Author's channel ID (`UC…`). |
| `author.handle` | string | Author's @handle. |
| `author.name` | string | Author's display name. |
| `author.avatarUrl` | string | Author's avatar image URL (expires, see Limits). |
| `author.isVerified` | boolean | Verified badge. |
| `author.isCreator` | boolean | The author is the video's creator. |
| `author.isMember` | boolean | Channel membership badge. |
| `source` | string | The input that produced the row. |
| `scrapedAt` | string | When the row was scraped (ISO 8601 UTC). |

**Example row**

```json
{
    "commentId": "UgyEnXfdC-umwvTt8JF4AaABAg",
    "videoId": "dQw4w9WgXcQ",
    "videoUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    "videoTitle": "Rick Astley - Never Gonna Give You Up (Official Video) (4K Remaster)",
    "text": "Gonna flag this for nudity so I can rick roll the YouTube staff",
    "likeCount": 570000,
    "likeCountText": "570K",
    "replyCount": 732,
    "publishedTimeText": "6 years ago",
    "publishedAtEstimate": "2020-11-07T22:00:19.808Z",
    "isEdited": false,
    "isPinned": false,
    "isHeartedByCreator": false,
    "isReply": false,
    "parentCommentId": null,
    "author": {
        "channelId": "UCWf34D_s8K_m2vwBISIDWtg",
        "handle": "@Oatman69",
        "name": "@Oatman69",
        "avatarUrl": "https://yt3.ggpht.com/ghenbV7T5VMOA3iqp3PThC82exqcu7iVng_iWNx1Ujak72Ti4oZZ_XzSVzIrfk9arP1XrFtnZA=s88-c-k-c0x00ffffff-no-rj",
        "isVerified": false,
        "isCreator": false,
        "isMember": false
    },
    "source": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    "scrapedAt": "2026-11-08T10:00:19.808Z"
}
```

#### Error rows (free)

When a video can't give comments, you get one row for it instead of silence, so automations can match every input to an output. Error rows are **never charged**.

```json
{
    "input": "https://www.youtube.com/watch?v=XqZsoesa55w",
    "error": "Comments are turned off for this video.",
    "errorCode": "COMMENTS_DISABLED",
    "retryable": false,
    "videoId": "XqZsoesa55w",
    "videoUrl": "https://www.youtube.com/watch?v=XqZsoesa55w",
    "videoTitle": "Baby Shark Dance | #babyshark Most Viewed Video | Animal Songs | PINKFONG Songs for Children",
    "source": "https://www.youtube.com/watch?v=XqZsoesa55w",
    "scrapedAt": "2026-11-08T10:00:00.000Z"
}
```

| `errorCode` | Meaning | `retryable` |
|---|---|---|
| `COMMENTS_DISABLED` | Comments are turned off for this video. | no |
| `VIDEO_UNAVAILABLE` | Private, removed or otherwise unavailable video. | no |
| `INVALID_INPUT` | Not a video URL or ID (e.g. a channel or playlist link). | no |
| `BLOCKED` | YouTube kept refusing the request after several retries. | yes |
| `HTTP_ERROR` | A request failed after retries. If some comments were already saved, `commentsSaved` says how many. | usually |

To get only comments, filter out rows that have an `errorCode`.

### Pricing

Pay per event, with platform usage **included**:

| Event | Price | When |
|---|---|---|
| `comment` | **$0.00025** ($0.25 per 1,000) | A comment or a reply is saved to the dataset |

| You get | You pay |
|---|---|
| 100 comments | $0.025 |
| 1,000 comments | $0.25 |
| 10,000 comments (e.g. 100 videos × 100) | $2.50 |

- **No per-video fee, no start fee, no minimum.** One video with 5 comments costs $0.00125.
- **Never charged:** error rows (comments off, unavailable videos, invalid inputs, failed requests), duplicates, retries.
- Replies cost the same as comments. Use `maxRepliesPerComment` and `maxResults` to control the total.
- Set a **maximum total charge** for the run in Console; the scraper stops cleanly when it is reached and tells you how many results it saved.

### Run summary (`RUN_SUMMARY`)

Every run writes a `RUN_SUMMARY` record to its key-value store (linked in the run's **Output** tab): per video the comments and replies saved, pages read, the comment count YouTube shows, and why it stopped (`maxCommentsPerVideo`, `endOfComments`, `maxResults`, `chargeLimit`, `COMMENTS_DISABLED`, …); request and failure counts; rows saved, error rows and duplicates skipped; field fill rates; and warnings.

### Limits and known gaps

- **Rounded like counts:** YouTube shows large like counts rounded ("570K"), and `likeCount` is that rounded number (570000). Small counts are exact.
- **Times are estimates:** YouTube only shows relative times ("6 years ago"). `publishedAtEstimate` is computed from that text, so it is only as precise as the unit shown (an "x years ago" comment can be off by months).
- **Avatar URLs expire:** `author.avatarUrl` links to YouTube's image servers and can stop working after some time. Download avatars right away if you need to keep them.
- **Top order is YouTube's:** "Top comments" is YouTube's own ranking and can change between runs. "Newest first" is chronological.
- **Very large videos:** videos with millions of comments take time to read in full. Use `maxCommentsPerVideo` or `maxResults`.
- **Public comments only:** held-for-review, deleted or members-only content that YouTube doesn't show publicly is not returned.
- **Free plan preview:** on Apify's free plan a run is a preview: only the first video in your list and at most 20 rows. Any paid Apify plan removes the limit.

### Use with AI agents (Apify MCP)

Add the scraper to Claude, Cursor or any MCP client:

```
https://mcp.apify.com?tools=ragnum/youtube-comments-scraper
```

Agents can call it with plain inputs (`videos`, `maxCommentsPerVideo`, `sort`) and get typed rows back, for example: "get the 300 newest comments on this video and summarize the main complaints".

### FAQ

**Why did I get fewer comments than `maxCommentsPerVideo`?** The video has fewer comments than the limit, the run-wide `maxResults` or your maximum charge was reached, or a request failed (you then get an error row). `RUN_SUMMARY.inputs[…].stoppedBy` tells you which.

**Why is the number of comments lower than the count on the video page?** The count on YouTube includes replies and comments YouTube no longer shows. Turn on `includeReplies` to get replies too.

**Do replies count toward `maxCommentsPerVideo`?** No. That limit counts top-level comments only; replies have their own `maxRepliesPerComment` limit. Both count toward `maxResults`, and both are charged.

**Can I scrape Shorts?** Yes. Paste Shorts URLs or IDs like any other video.

**Can I get comments from a whole channel or a playlist?** Give the video URLs. Channel and playlist links get a free `INVALID_INPUT` error row.

**Can I get comments in another language?** Comments are always returned as written. `hl` only changes YouTube's interface texts such as "3 days ago".

**Is the same comment ever charged twice?** No. Comments are de-duplicated by `commentId` within a run, and duplicates are free.

### Your responsibilities

This scraper collects only data YouTube shows publicly to logged-out visitors. You are responsible for how you use it: comply with YouTube's Terms of Service and with data-protection law such as the **GDPR** and **CCPA**. Comments, names, handles and avatars are personal data of their authors: have a lawful basis before you store or process them, keep only what you need, and honor deletion requests.

# Actor input Schema

## `videos` (type: `array`):

YouTube videos or Shorts to get comments from, one per line. Accepts watch URLs (https://www.youtube.com/watch?v=dQw4w9WgXcQ), short links (https://youtu.be/dQw4w9WgXcQ), Shorts (https://www.youtube.com/shorts/ID), live and embed URLs, and bare 11-character video IDs. The same video given twice is scraped once. Channel, playlist and search links are not videos: they get an error row (free). There is no per-video fee: you pay only for comments saved.

## `sort` (type: `string`):

Which comments come first, as on YouTube: "Top comments" (most popular first, YouTube's default) or "Newest first" (most recent first, good for monitoring new comments). Together with the per-video limit this decides which comments you get.

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

Stop each video after this many top-level comments. 0 = all comments (a popular video can have millions, and each one is charged). Replies are not counted here; they have their own limit below.

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

Also get the replies under each comment. Each reply is its own row (isReply = true, parentCommentId = the comment it answers) and is charged like a comment. Off: only top-level comments.

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

With "Include replies" on: stop each reply thread after this many replies. 0 = all replies. Replies don't count toward "Max comments per video", only toward "Max results", so one video can return up to comments × (1 + replies) rows.

## `maxResults` (type: `integer`):

Optional cap on the total number of rows (comments + replies) for the whole run, across all videos. The run stops cleanly when it is reached. Leave empty for no cap. Keeps the cost predictable: a run costs at most this number × the price per comment.

## `hl` (type: `string`):

Language code for YouTube's interface texts in the output, e.g. en, de, fr, es, ja. It changes texts like "3 days ago" and "1.2K"; comments themselves stay in the language they were written in.

## `gl` (type: `string`):

Two-letter country code YouTube uses for regional settings, e.g. US, GB, DE, IN.

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

How many requests run in parallel (across videos and reply threads). Higher is faster for many videos; it does not change the price.

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

Managed for you and included in the price. Change it only if you have a specific reason to.

## `residentialFallback` (type: `boolean`):

When YouTube keeps refusing a request, retry it automatically on a different network (included in the price). Keep it on for the most reliable results.

## Actor input object example

```json
{
  "videos": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "sort": "top",
  "maxCommentsPerVideo": 100,
  "includeReplies": false,
  "maxRepliesPerComment": 20,
  "hl": "en",
  "gl": "US",
  "maxConcurrency": 10,
  "proxyConfiguration": {
    "useApifyProxy": true
  },
  "residentialFallback": true
}
```

# Actor output Schema

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

No description

## `runSummary` (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 = {
    "videos": [
        "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    ],
    "maxCommentsPerVideo": 100,
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("ragnum/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 = {
    "videos": ["https://www.youtube.com/watch?v=dQw4w9WgXcQ"],
    "maxCommentsPerVideo": 100,
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("ragnum/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 '{
  "videos": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "maxCommentsPerVideo": 100,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call ragnum/youtube-comments-scraper --silent --output-dataset

```

## MCP server setup

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