# YouTube Comments Scraper - Replies, Newest First, Shorts (`mochiboo/youtube-comments-scraper`) Actor

Public comments of any YouTube video or Short: top or newest first, replies optional, likes, reply counts, author handle and channel, exact total comment count. No login. $0.50 per 1,000 comments.

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

## Pricing

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

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 and Shorts, newest first, no login

Get the public comments of any YouTube video or Short as structured rows: author handle and channel, text, likes, reply count, how old the comment is, and the exact total comment count of the video. Logged out, no API key, no cookies.

- **Top or newest first.** Pull YouTube's Top comments, or the newest comments with a day cut-off (`newerThanDays`) for daily brand and creator monitoring: the run stops at the first comment older than the cut-off.
- **Replies optional.** Switch `includeReplies` on and each comment's replies follow it, with a per-comment limit. Every common link form is accepted: `watch?v=`, `youtu.be/`, `/shorts/`, `/live/`, `/embed/`, `m.youtube.com`, or the bare 11-character video ID.
- **Honest output.** Videos with comments turned off or no longer available are named in the run summary and cost nothing. E-mail addresses and the phone-number formats the redactor recognises are replaced in comment text (see Privacy).

### Pricing

Pay per result, at the rate shown in the pricing panel of this page, plus a very small per-run start fee. You are charged only for the results delivered.

### What you get

One row per comment (replies included). A top-level comment:

```json
{"videoId":"dQw4w9WgXcQ","videoUrl":"https://www.youtube.com/watch?v=dQw4w9WgXcQ","videoTitle":"Rick Astley - Never Gonna Give You Up (Official Video) (4K Remaster)","channelName":"Rick Astley","channelId":"UCuAXFkgsw1L7xaCfnd5JJOw","totalCommentsOnVideo":2460855,"sortBy":"top","position":1,"replyPosition":null,"commentId":"UgwPwTibxdgqCHZxktd4AaABAg","parentCommentId":null,"isReply":false,"text":"My algebra teacher said that this was a link to the test answers","publishedTimeText":"7 years ago","isEdited":false,"authorHandle":"@bdr8823","authorChannelId":"UCdi6tGxvFvTRGe-7dAn7m7w","authorChannelUrl":"https://www.youtube.com/channel/UCdi6tGxvFvTRGe-7dAn7m7w","authorIsVerified":false,"authorIsChannelOwner":false,"likeCount":70000,"likeCountIsApproximate":true,"replyCount":649,"isHearted":false,"scrapedAt":"2026-10-28T14:34:37.097Z"}
```

and a reply to it:

```json
{"videoId":"dQw4w9WgXcQ","videoUrl":"https://www.youtube.com/watch?v=dQw4w9WgXcQ","videoTitle":"Rick Astley - Never Gonna Give You Up (Official Video) (4K Remaster)","channelName":"Rick Astley","channelId":"UCuAXFkgsw1L7xaCfnd5JJOw","totalCommentsOnVideo":2460855,"sortBy":"top","position":null,"replyPosition":1,"commentId":"UgwPwTibxdgqCHZxktd4AaABAg.8z9UZMV20LP8zH9Ebkoohj","parentCommentId":"UgwPwTibxdgqCHZxktd4AaABAg","isReply":true,"text":"Nice troll 👌","publishedTimeText":"7 years ago","isEdited":false,"authorHandle":"@daikerio6830","authorChannelId":"UCuyLyWFcsnyZF77-W7WFnFg","authorChannelUrl":"https://www.youtube.com/channel/UCuyLyWFcsnyZF77-W7WFnFg","authorIsVerified":false,"authorIsChannelOwner":false,"likeCount":3200,"likeCountIsApproximate":true,"replyCount":0,"isHearted":false,"scrapedAt":"2026-10-28T14:34:37.304Z"}
```

| Field | What it is |
|---|---|
| `videoId`, `videoUrl`, `videoTitle`, `channelName`, `channelId` | The video and its channel. |
| `totalCommentsOnVideo` | The video's exact comment count (`2460855`, not `2.4M`) when you sort by Top. Empty with Newest first: the actor reads Newest through YouTube's comments-panel link, whose answer carries no count. The count includes replies. |
| `sortBy` | `top` or `newest`, as you asked. |
| `position` | Place of the comment in YouTube's list for this video, from 1. Empty for replies. |
| `replyPosition`, `parentCommentId` | For a reply: its place under the parent comment (from 1) and the parent's `commentId`. Empty for top-level comments. |
| `commentId`, `isReply` | Comment id (a reply's id starts with its parent's id) and whether it is a reply. |
| `text` | The comment text. It can be empty (a comment that is only a sticker). |
| `publishedTimeText`, `isEdited` | How old the comment is, in YouTube's words (`7 years ago`, `3 days ago`, `5 hours ago`); a calendar date is not available. `isEdited` is true when YouTube marks it "(edited)". |
| `authorHandle`, `authorChannelId`, `authorChannelUrl` | The commenter's handle (`@name`) and channel. |
| `authorIsVerified`, `authorIsChannelOwner` | Verified badge; the comment was written by the video's own channel. |
| `likeCount`, `likeCountIsApproximate` | Likes. Below 1,000 the number is exact. From 1,000 up YouTube shows a rounded figure (`70K`, `1.2M`), which is what you get, with `likeCountIsApproximate` true. |
| `replyCount` | Number of replies YouTube reports under the comment. |
| `isHearted` | The video's creator gave the comment a heart. |
| `scrapedAt` | When the row was written. |

### Input

| Field | Default | What it does |
|---|---|---|
| `videoUrls` | one example video | Video or Shorts links, or bare video IDs, one per line. Up to 500 per run; the same video twice is read once; anything that is not a YouTube video link or ID is listed in the run summary and costs nothing. |
| `maxCommentsPerVideo` | `100` (max `100000`) | Rows per video, replies included. |
| `sortBy` | `top` | `top` (YouTube's default ranking) or `newest`. |
| `includeReplies` | `false` | Also return the replies under each comment. Replies count towards the per-video maximum. |
| `maxRepliesPerComment` | `10` (max `1000`) | Replies read per comment when replies are on. |
| `newerThanDays` | off | Only with `newest`: stop each video at the first comment older than this many days. YouTube gives the age as text, so the cut-off is approximate (a month counts as 30 days, a year as 365). Ignored with `top`, and the run summary says so. |
| `proxyConfiguration` | Apify datacenter proxy | Proxy used for all requests. |

Rows come in YouTube's order, a page of comments first and then the replies of those comments (when replies are on). Videos are read three at a time, so rows of different videos are mixed in the dataset; within one video they are in order (sort by `videoId` and `position` if you want them apart).

### How deep YouTube lets you go

- **Top comments end after about 1,000 to 1,200 per video**, however many comments the video has. In our runs the Top list of three videos with millions of comments ended at 1,216, 1,002 and 1,219 comments. The video then ends with `stopReason` `last_page`; `totalCommentsOnVideo` still shows the full count.
- **Newest first goes much deeper.** A run of 3,000 newest comments of a video with 4.4 million comments finished in 53 seconds with 3,000 rows.
- **The creator's pinned comment comes first in both orders.** With `newerThanDays`, an old pinned comment is skipped instead of ending the scan; a pinned comment that is inside the time window is delivered at position 1.
- Likes, reply counts and the exact total are as YouTube shows them at the moment of the run and move while you read.

### Measured behaviour

Platform runs on 2026-10-28, default datacenter proxy, 512 MB:

- A video, a Short, a video with comments turned off and an ID that does not exist, 150 comments per video with replies (5 per comment): 300 rows in 11 seconds (150 + 150, of which 200 were replies). `commentId`, `authorHandle`, `authorChannelId` and `publishedTimeText` were filled in 300 of 300 rows, `text` in 299 of 300. No comment id appeared twice, and every reply came after the page of comments it belongs to. The comments-off video and the unknown ID were named in the run summary (`commentsDisabled`, `videoUnavailable`) and produced no rows.
- Newest first with `newerThanDays` 1 on a video with 2.4 million comments: 242 rows in 9 seconds, every one aged 1 day or less, ended with `stopReason` `newer_than_days`.
- Nothing was blocked on the default proxy: the runs logged 701 requests in 10 runs, none blocked, none retried, none answered empty. Peak memory was 45 to 114 MB.

### Stopping early, blocks and the run summary

- The run keeps a time budget. A very large run (hundreds of videos, replies on) may stop early: it starts no new request, writes what it has and ends as succeeded. We checked it with 20 videos at 100,000 comments each and a 45-second timeout: it ended after 36 seconds with 4,823 rows. The `RUN_SUMMARY` record in the key-value store says how it ended: `complete`, `terminationReason` (`finished`, `max_results`, `charge_limit`, `time_budget`, `blocked`, `request_failed`), `rowsPushed`, one entry per video (`state`, `rows`, `stopReason`), `invalidInputs`, `skippedOverLimit` and `warnings`.
- A video's `state` is `ok`, `commentsDisabled`, `videoUnavailable`, `noCommentsSection`, `emptyFirstPage` (no comments yet), `noNewestToken` or `notFetched` (the run stopped before it got there). Its `stopReason` is `max_results`, `last_page`, `newer_than_days`, `time_budget`, `blocked`, `request_failed` or `charge_limit`.
- If YouTube answers with HTTP 403, a consent page or a sign-in page, the actor stops at once with `YouTube blocked the request (HTTP <status>); stopping.` and keeps the rows already written. It never retries a block. Run again later.
- Temporary errors (HTTP 429, 5xx, network, and the empty answers YouTube now and then gives) are retried three times (2, 4, 8 seconds); a page that still fails ends only that video and the summary says `request_failed`.
- If Apify moves a long run to another server, the run continues where it was and does not write a comment twice. We restarted a run on purpose while it was reading three videos: 3,429 rows, no duplicate.
- Rows are billed per result; if you set a maximum charge per run the run stops there.

### Privacy

Only public, logged-out YouTube pages are read: no login, no cookies. Comments are public posts by the people named in the `authorHandle`; use them in line with the rules that apply to you. E-mail addresses inside comment text, video titles and channel names, and phone numbers inside comment text, are replaced with `[email redacted]` and `[phone redacted]`. This is best effort on the formats it recognises: international `+` numbers, US and Canadian numbers and numbers that start with 0 are replaced; a bare 10-digit number, some national formats and phone numbers in video titles or channel names are not, and a long run of digits can be mistaken for a phone number (1 comment in about 4,300 sampled by the builder, 1 in 14,438 in QA).

### Keywords

youtube comments scraper, youtube comment extractor, export youtube comments, youtube shorts comments, youtube comment replies, youtube comments csv, youtube sentiment analysis

# Actor input Schema

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

YouTube video or Shorts links (watch?v=, youtu.be/, /shorts/, /live/, /embed/, m.youtube.com) or bare 11-character video IDs, one per line. Up to 500 per run.

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

Rows per video, replies included (1-100000). You get fewer if the video has fewer comments, or if YouTube stops serving them: its Top list ends after about 1,000-1,200 comments, Newest first goes deeper.

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

Top is YouTube's default ranking. Newest puts the latest comments first.

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

Also return the replies under each comment. Replies count towards the per-video maximum.

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

Only used when replies are included (1-1000).

## `newerThanDays` (type: `integer`):

Only with 'Newest first': stop each video at the first comment older than this many days. YouTube shows comment age as text ("3 days ago"), so the cut-off is approximate (a month counts as 30 days, a year as 365).

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

Apify Proxy is on by default.

## Actor input object example

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

# Actor output Schema

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

One row per comment (or reply): video, author handle and channel, text, likes, reply count, age as YouTube shows it, and the exact total comment count of the video.

## `runSummary` (type: `string`):

What the run wrote and how it ended (the RUN_SUMMARY record in the default key-value store): per-video state and row count, invalid inputs, warnings.

# 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"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("mochiboo/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"],
    "proxyConfiguration": { "useApifyProxy": True },
}

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

```

## MCP server setup

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