# YouTube Comments Scraper: Top & Newest, Incremental (`kizukidata/youtube-comments-scraper`) Actor

Pass YouTube video URLs, Shorts, IDs, or channels to extract top or newest comments with likes, replies, author IDs, creator hearts, and timestamps. Enable includeReplies for reply rows, oldestCommentDate, or onlyNewItems. Status rows are free. Unofficial tool, not affiliated with YouTube.

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

## Pricing

from $0.12 / 1,000 comment rows

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: Top & Newest, Incremental

Pass YouTube video URLs, Shorts links, 11-character IDs, or channel URLs to extract **top** or **newest** comments (and optional reply rows) with comment text, like counts, reply counts, creator hearts, author names, author channel IDs, pinned/creator flags, and estimated ISO timestamps.

Filter recent comments with `oldestCommentDate`, or turn on `onlyNewItems` on a schedule to return and pay only for comments that arrived since the previous run. Empty input (`{}`) reads comments from sample video `dQw4w9WgXcQ`. This Actor is an unofficial tool and is not affiliated with, endorsed by, or sponsored by YouTube or Google.

### What goes in and what comes out

| Input | What it returns |
|---|---|
| `videoUrls` (`watch?v=...`, `youtu.be/...`, `/shorts/...`, or 11-char IDs) | One row per comment (`type: "comment"`) up to `maxCommentsPerVideo` and `maxItems` |
| `channels` (`@handle`, `/channel/...`, `/c/...`, `/user/`, or `UC...` ID) | Reads up to `maxVideosPerChannel` recent videos of each channel and extracts their comments |
| `sortBy` (`"top"` or `"newest"`) | `"top"` (default) returns top comments; `"newest"` returns newest comments first |
| `includeReplies: true` | Also extracts comment replies as separate `comment` rows with `parentCommentId` set |
| `oldestCommentDate` (ISO date or `"7 days"`) | Skips comments older than the cutoff date |
| `onlyNewItems: true` | Remembers delivered `commentId`s per input for 90 days and returns only unseen comments |

### Quick start

Extract the top 100 comments (and replies) from a video or Short:

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

Monitor newest comments across a channel's latest videos on a schedule:

```json
{
    "channels": [
        "https://www.youtube.com/@TED"
    ],
    "sortBy": "newest",
    "maxVideosPerChannel": 3,
    "maxCommentsPerVideo": 40,
    "onlyNewItems": true,
    "maxItems": 100
}
```

### Output fields

Every row contains the 26 fields below (`null` when a field does not apply, plus `isNew` when `onlyNewItems` is enabled). When `includeReplies` is `true`, each reply is emitted as its own `comment` row with `parentCommentId` linking to the parent comment.

| Field | Type | Description |
|---|---|---|
| `id` | string | Stable ID: `comment:<commentId>` or `video-comments:<videoId>` on status rows |
| `type` | string | `comment` on delivered comments, `status` on uncharged error rows |
| `source` | string | Always `youtube-comments` |
| `url` | string | null | Direct comment permalink (`watch?v=<id>&lc=<commentId>`) or watch URL |
| `commentId` | string | null | YouTube comment ID (`null` on status rows) |
| `parentCommentId` | string | null | Parent comment ID on reply rows (`null` on top-level comments and status rows) |
| `videoId` | string | 11-character YouTube video ID |
| `videoTitle` | string | null | Title of the video |
| `videoUrl` | string | Canonical video URL (`https://www.youtube.com/watch?v=<videoId>`) |
| `channelId` | string | null | Channel ID (`UC...`) of the video |
| `totalCommentsCount` | integer | null | Total comment count from the comments header when present |
| `author` | string | null | Comment author display name or `@handle` |
| `authorChannelId` | string | null | Public channel ID (`UC...`) of the comment author |
| `authorChannelUrl` | string | null | Public channel URL of the comment author |
| `text` | string | null | Comment body text (up to 5,000 characters) |
| `likeCount` | integer | null | Parsed numeric like count (`"1.2K likes"` -> `1200`) |
| `replyCount` | integer | null | Number of replies to the comment |
| `publishedText` | string | null | Relative time label as shown on YouTube (e.g. `"2 days ago"`) |
| `publishedAt` | string | null | Estimated ISO 8601 UTC timestamp derived from `publishedText` |
| `publishedAtIsEstimate` | boolean | `true` when `publishedAt` was computed from a relative label |
| `isEdited` | boolean | `true` when YouTube marks the comment as `(edited)` |
| `isPinned` | boolean | `true` when the channel owner pinned the comment |
| `isOwner` | boolean | `true` when the channel owner posted the comment |
| `hasCreatorHeart` | boolean | `true` when the video creator hearted this comment |
| `sort` | string | null | Sort order read (`top` or `newest`), `null` on status rows |
| `error` | object | null | `null` on comment rows; `{type, message}` on uncharged status rows |
| `isNew` | boolean | Present only when `onlyNewItems` is `true` |

#### Output example

```json
{
    "id": "comment:UgzKYksqeQ5gA3t0g0F4AaABAg",
    "type": "comment",
    "source": "youtube-comments",
    "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ&lc=UgzKYksqeQ5gA3t0g0F4AaABAg",
    "commentId": "UgzKYksqeQ5gA3t0g0F4AaABAg",
    "parentCommentId": null,
    "videoId": "dQw4w9WgXcQ",
    "videoTitle": "Rick Astley - Never Gonna Give You Up (Official Video) (4K Remaster)",
    "videoUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    "channelId": "UCuAXFkgsw1L7xaCfnd5JJOw",
    "totalCommentsCount": 2462487,
    "author": "@grustache4569",
    "authorChannelId": "UCKrzgYonJnMd0Dk7zQXjYXw",
    "authorChannelUrl": "https://www.youtube.com/channel/UCKrzgYonJnMd0Dk7zQXjYXw",
    "text": "Example comment text.",
    "likeCount": 108000,
    "replyCount": 721,
    "publishedText": "6 years ago (edited)",
    "publishedAt": "2020-11-18T00:00:00.000Z",
    "publishedAtIsEstimate": true,
    "isEdited": true,
    "isPinned": false,
    "isOwner": false,
    "hasCreatorHeart": false,
    "sort": "top",
    "error": null
}
```

### Input parameters

| Field | Default | Description |
|---|---|---|
| `videoUrls` | `[]` | Up to 100 YouTube watch URLs, `youtu.be` links, Shorts URLs, or 11-character IDs (accepts lists or comma/newline-separated text) |
| `channels` | `[]` | Up to 20 YouTube channels (`@handle`, `/channel/`, `/c/`, `/user/`, or `UC...` ID) |
| `sortBy` | `top` | `top` (most relevant/liked) or `newest` (latest first) |
| `maxCommentsPerVideo` | `100` | Maximum comments (and replies when `includeReplies` is `true`) per video (1 to 2,000) |
| `maxVideosPerChannel` | `5` | Recent videos per channel when `channels` is used (1 to 15) |
| `includeReplies` | `false` | Set `true` to also extract reply rows with `parentCommentId` |
| `oldestCommentDate` | `""` | Optional cutoff date (`YYYY-MM-DD`, ISO timestamp, or relative age such as `7 days`) |
| `onlyNewItems` | `false` | Return and charge only comments not delivered in earlier runs with the same input |
| `maxItems` | `20` | Maximum rows per run across all inputs (1 to 5,000) |
| `debugSnapshot` | `false` | Save a diagnostic snapshot in the key-value store if a video fails to parse |
| `proxyConfiguration` | `{"useApifyProxy": false}` | Leave empty or `{}` for direct connection, or configure Apify proxy when needed for regional access |

### Scheduled monitoring with `onlyNewItems`

Enable `onlyNewItems: true` with `sortBy: "newest"` on a scheduled Task to track newly posted comments without paying twice for comments already delivered. Delivered comment IDs are kept per input configuration (`sortBy`, `includeReplies`, `oldestCommentDate`, `channels`, and `videoUrls`) for 90 days. Uncharged status rows are never marked as delivered, so the next run retries those videos. Avoid running the exact same input concurrently, as parallel runs read the same previous state.

### Pricing and free tier

Launch pricing. YouTube Comments Scraper uses **pay-per-event** pricing (`comment`): you pay only for comment or reply rows returned (`type: "comment"` and `error: null`).

| Apify plan (discount tier) | Price per 1,000 comments | Price per comment |
|---|---:|---:|
| **Free** | $0.20 | $0.00020 |
| **Starter (Bronze)** | $0.16 | $0.00016 |
| **Scale (Silver)** | $0.14 | $0.00014 |
| **Business (Gold)** | $0.12 | $0.00012 |

Apify's Free plan includes USD 5 of monthly usage, which covers about 25,000 comments at the Free tier price, run start fees aside.

- **Run start fee**: platform default (`$0.00005` per GB of memory per run; default memory is 256 MB).
- **What is not charged**: status rows (`comments-disabled`, `video-unavailable`, `comments-unavailable`, `bot-check`, `consent`), comments skipped because they were already delivered in earlier `onlyNewItems` runs or older than `oldestCommentDate`, invalid inputs, and rows beyond `maxItems` or `maxCommentsPerVideo`.

### Use with AI agents (MCP)

Connect this Actor to Claude, Cursor, or n8n agents through the Apify MCP server:

```text
https://mcp.apify.com?tools=fetch-actor-details,kizukidata/youtube-comments-scraper
```

- **Claude Code**: `claude mcp add --transport http apify "https://mcp.apify.com?tools=fetch-actor-details,kizukidata/youtube-comments-scraper"`
- **Claude Desktop / claude.ai**: open **Customize → Connectors**, choose **Add custom connector**, and paste the URL above.
- **Cursor** (`~/.cursor/mcp.json`):

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

- **n8n**: add an **MCP Client Tool** node to an AI Agent, set the endpoint to the URL above, and pass your Apify API token as Bearer auth (or use the `@apify/n8n-nodes-apify` community node).

Keep `maxItems` small (default `20`) in interactive agent calls so runs return inside the MCP timeout.

### API examples

#### cURL

```bash
curl -X POST "https://api.apify.com/v2/acts/kizukidata~youtube-comments-scraper/runs" \
  -H "Authorization: Bearer <APIFY_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"videoUrls":["https://www.youtube.com/watch?v=dQw4w9WgXcQ"],"sortBy":"top","maxItems":20}'
```

#### Python

```python
from apify_client import ApifyClient

client = ApifyClient("<APIFY_TOKEN>")
run = client.actor("kizukidata/youtube-comments-scraper").call(run_input={
    "videoUrls": ["https://www.youtube.com/watch?v=dQw4w9WgXcQ"],
    "sortBy": "newest",
    "maxCommentsPerVideo": 100,
    "maxItems": 100,
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    if item["type"] == "comment":
        print(item["author"], item["likeCount"], item["text"])
```

#### JavaScript

```js
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: '<APIFY_TOKEN>' });
const run = await client.actor('kizukidata/youtube-comments-scraper').call({
    videoUrls: ['https://www.youtube.com/watch?v=dQw4w9WgXcQ'],
    sortBy: 'top',
    maxItems: 50,
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items.filter((row) => row.type === 'comment'));
```

### Limitations

- **Replies are optional**: set `includeReplies: true` to fetch reply rows with `parentCommentId`; by default only top-level comments and `replyCount` are returned.
- **Estimated timestamps**: YouTube shows relative comment ages (`"2 days ago"`), so `publishedAt` is computed from the run timestamp and flagged with `publishedAtIsEstimate: true`. Use `sortBy: "newest"` when pairing with `oldestCommentDate` to stop scanning older pages automatically.
- **No login or private videos**: only publicly visible comments on public videos and Shorts are extracted; no API key is required.
- **Status rows**: if a video has comments turned off or cannot be read, a `status` row with `error.type` is written to the dataset and is not charged.

### Related Kizuki Actors

- [YouTube Channel Scraper & Monitor](https://apify.com/kizukidata/youtube-channel-monitor) — monitor channel uploads, About facts, video stats, and newest comments together.
- [YouTube Transcript Scraper](https://apify.com/kizukidata/youtube-transcripts) — extract video subtitles, chapters, and Most Replayed segments as Markdown and RAG chunks.
- [Reddit Comments Scraper](https://apify.com/kizukidata/reddit-comments-scraper) — extract nested Reddit comment trees and LLM-ready Markdown threads with `onlyNewItems`.
- [Google News Scraper](https://apify.com/kizukidata/google-news-feed) — monitor Google News articles and resolved publisher URLs by keyword or topic.
- [YouTube Playlist Scraper](https://apify.com/kizukidata/youtube-playlist-chapters-scraper) — one row per playlist video with chapters, most replayed moments and an optional transcript.
- [YouTube Shorts Scraper](https://apify.com/kizukidata/youtube-shorts-search) — Shorts by keyword, channel or URL, with view counts, hashtags and optional transcripts.

# Actor input Schema

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

Up to 100 YouTube watch URLs, youtu.be links, Shorts URLs, or 11-character video IDs. Leave both videoUrls and channels empty ({}) to read 1 sample video.

## `channels` (type: `array`):

Up to 20 YouTube channels (@handle, /channel/, /c/, /user/, or UC... ID). Fetches comments from each channel's recent videos (up to maxVideosPerChannel).

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

"top" (default) returns top-liked comments as YouTube orders them. "newest" returns newest comments first (recommended with onlyNewItems or oldestCommentDate).

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

Maximum comments (including replies when includeReplies is true) to extract per video (1 to 2,000, default 100). Bounded by maxItems across the whole run.

## `maxVideosPerChannel` (type: `integer`):

Recent videos to read per channel when channels are provided (1 to 15, default 5). Ignored when only videoUrls are set.

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

false (default) extracts top-level comments with replyCount only. true also extracts replies as separate comment rows with parentCommentId set.

## `oldestCommentDate` (type: `string`):

Skip comments older than this cutoff. Accepts an ISO date (e.g. 2026-11-01) or a relative age (e.g. 7 days, 24 hours). Leave empty for no date limit.

## `onlyNewItems` (type: `boolean`):

true skips comments already returned by prior runs with the same input (90-day state); false (default) returns all comments. Status rows retry on the next run.

## `maxItems` (type: `integer`):

Maximum rows written per run (1 to 5,000, default 20). Comment and free status rows share this cap; only comment rows are charged.

## `debugSnapshot` (type: `boolean`):

false (default). true saves a diagnostic snapshot in the key-value store when a video's comments fail to parse; snapshots are not in the dataset and not charged.

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

Leave empty or {} for direct connection. Set {"useApifyProxy": true} for Apify datacenter proxy when needed for regional access.

## Actor input object example

```json
{
  "videoUrls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "channels": [
    "https://www.youtube.com/@TED"
  ],
  "sortBy": "top",
  "maxCommentsPerVideo": 100,
  "maxVideosPerChannel": 5,
  "includeReplies": false,
  "oldestCommentDate": "",
  "onlyNewItems": false,
  "maxItems": 20,
  "debugSnapshot": false,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

Comment rows and uncharged status rows returned by this run.

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

Status code, counters and skipped input entries of this run.

# 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": [],
    "channels": [],
    "sortBy": "top",
    "maxCommentsPerVideo": 100,
    "maxVideosPerChannel": 5,
    "includeReplies": false,
    "oldestCommentDate": "",
    "onlyNewItems": false,
    "maxItems": 20,
    "debugSnapshot": false,
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("kizukidata/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": [],
    "channels": [],
    "sortBy": "top",
    "maxCommentsPerVideo": 100,
    "maxVideosPerChannel": 5,
    "includeReplies": False,
    "oldestCommentDate": "",
    "onlyNewItems": False,
    "maxItems": 20,
    "debugSnapshot": False,
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("kizukidata/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": [],
  "channels": [],
  "sortBy": "top",
  "maxCommentsPerVideo": 100,
  "maxVideosPerChannel": 5,
  "includeReplies": false,
  "oldestCommentDate": "",
  "onlyNewItems": false,
  "maxItems": 20,
  "debugSnapshot": false,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call kizukidata/youtube-comments-scraper --silent --output-dataset

```

## MCP server setup

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