# YouTube Comments & Replies Scraper (`leopoldsaint/youtube-comments-scraper`) Actor

Fast direct YouTube comments & reply threads scraper. Extract top or newest comments from video URLs, IDs, or search queries with likes, author handles, pinned/hearted status, and keyword filters.

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

## Pricing

from $1.25 / 1,000 youtube 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

### What does YouTube Comments & Replies Scraper do?

**YouTube Comments & Replies Scraper** is a fast, lightweight Apify Actor that extracts **top or newest comments and nested reply threads** from any public [YouTube](https://www.youtube.com/) video, Short, or search query — using direct InnerTube JSON requests with **no headless browser overhead** and **no YouTube API key required**.

Extract clean comment text, parsed numeric like counts, reply counts, author handles and channel URLs, pinned/creator-hearted flags, timestamps, and optional keyword/like-threshold filtering for audience research, sentiment analysis, LLM/RAG datasets, and lead discovery.

With Apify, you get REST API access, scheduled monitoring, webhooks, Make/Zapier/n8n integrations, MCP server support for AI agents, and strict pay-per-event budget controls.

### Why use YouTube Comments & Replies Scraper?

- **Product & Customer Pain-Point Mining:** Filter comments with `containsKeywords` (e.g. `"pricing"`, `"alternative"`, `"bug"`, `"wish"`) across competitor tutorials and product reviews to uncover real buyer objections and feature requests.
- **Sentiment Analysis & Voice-of-Customer Datasets:** Feed clean JSON/CSV comment corpora directly into LLMs, BI dashboards, or brand-monitoring pipelines.
- **Reply Threads & Creator Engagement Signals:** Optionally expand reply threads (`includeReplies: true`) and filter by `isPinned`, `isHeartedByCreator`, `authorIsCreator`, and `minLikes`.
- **No Browser Bloat:** Runs on 256 MB memory directly against YouTube's web JSON endpoints — fast, cheap, and reliable.

### How to scrape YouTube comments

1. Open **YouTube Comments & Replies Scraper** in Apify Console.
2. Paste one or more **YouTube video URLs, Shorts URLs, or video IDs** — or supply **YouTube search queries** to auto-discover top videos.
3. Choose **Sort order** (`top` or `newest`), set **Max comments per video**, and toggle **Include reply threads** if you want nested replies.
4. Optionally add **Minimum likes** or **Keyword filters** so you only pay for relevant comments.
5. Click **Start** and export your results as JSON, CSV, Excel, or HTML.

### Input

Configure fields in the Input tab or send JSON via the Apify API:

```json
{
    "videoUrls": ["https://www.youtube.com/watch?v=jNQXAC9IVRw"],
    "sortBy": "top",
    "maxCommentsPerVideo": 50,
    "maxTotalComments": 100,
    "includeReplies": true,
    "maxRepliesPerComment": 5,
    "minLikes": 0
}
```

### Output

Each dataset item is one deduplicated comment or reply. You can download the dataset in various formats such as JSON, HTML, CSV, or Excel.

```json
{
    "commentId": "UgzuC3zzpRZkjc5Qzsd4AaABAg",
    "videoId": "jNQXAC9IVRw",
    "videoTitle": "Me at the zoo",
    "videoUrl": "https://www.youtube.com/watch?v=jNQXAC9IVRw",
    "channelName": "jawed",
    "channelUrl": "https://www.youtube.com/@jawed",
    "videoTotalCommentsText": "10,643,418 Comments",
    "authorDisplayName": "@SanDiegoZoo",
    "authorHandle": "@SanDiegoZoo",
    "authorChannelId": "UC7kB1z9v3u",
    "authorChannelUrl": "https://www.youtube.com/@SanDiegoZoo",
    "authorAvatarUrl": "https://yt3.ggpht.com/...",
    "authorIsCreator": false,
    "authorIsVerified": true,
    "isPinned": true,
    "isHeartedByCreator": true,
    "isReply": false,
    "parentCommentId": null,
    "text": "We're so honored that the first ever YouTube video was filmed here!",
    "publishedTimeText": "6 years ago",
    "likeCount": 4800000,
    "likeCountText": "4.8M",
    "replyCount": 986,
    "sortBy": "top",
    "scrapedAt": "2026-11-23T15:30:00.000Z"
}
```

### Data table

| Field | Type | Description |
| --- | --- | --- |
| `commentId` | string | Unique YouTube comment ID |
| `videoId` | string | 11-character YouTube video ID |
| `videoTitle` | string | Video title |
| `authorDisplayName` | string | Comment author display name / handle |
| `authorChannelUrl` | string | Direct URL to the commenter's YouTube channel |
| `text` | string | Full comment text |
| `likeCount` | number | Parsed numeric like count (e.g. `4.8M` → `4800000`) |
| `replyCount` | number | Total replies on top-level comments |
| `isReply` | boolean | `true` when the row is a reply inside a thread |
| `parentCommentId` | string | Parent comment ID when `isReply` is `true` |
| `isPinned` | boolean | Whether the creator pinned the comment |
| `isHeartedByCreator` | boolean | Whether the channel creator hearted the comment |
| `publishedTimeText` | string | Relative publish time reported by YouTube |

### How much does it cost to scrape YouTube comments?

This Actor uses **Pay-Per-Event (PPE)** pricing with **platform usage included**:

- **Free tier:** `$2.00` per 1,000 comments (`$0.002` / comment)
- **Bronze tier:** `$1.75` per 1,000 comments (`$0.00175` / comment)
- **Silver tier:** `$1.50` per 1,000 comments (`$0.0015` / comment)
- **Gold / Platinum / Diamond tier:** `$1.25` per 1,000 comments (`$0.00125` / comment)
- **Actor start:** `$0.00005` per run

Comments filtered out by `minLikes` or `containsKeywords` are **never charged** — you only pay for rows actually written to your dataset.

### API, n8n, Make & AI Agent (MCP) integration

#### JavaScript / TypeScript (`apify-client`)

```typescript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('leopoldsaint/youtube-comments-scraper').call({
    videoUrls: ['https://www.youtube.com/watch?v=jNQXAC9IVRw'],
    sortBy: 'top',
    includeReplies: true,
    maxTotalComments: 100,
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

#### Python (`apify-client`)

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("leopoldsaint/youtube-comments-scraper").call(run_input={
    "videoUrls": ["https://www.youtube.com/watch?v=jNQXAC9IVRw"],
    "sortBy": "newest",
    "containsKeywords": ["pricing", "alternative"],
    "maxTotalComments": 100,
})
for c in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(c["authorHandle"], c["likeCount"], c["text"][:120])
```

#### n8n, Make & Zapier (1-request HTTP API)

```text
POST https://api.apify.com/v2/acts/leopoldsaint~youtube-comments-scraper/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN
Content-Type: application/json
```

#### AI Agents & MCP Server (Claude, Cursor, OpenAI)

Enable `leopoldsaint/youtube-comments-scraper` on Apify MCP (`https://mcp.apify.com`) so AI agents can extract audience objections, product feedback, and top questions directly from any YouTube video.

### Tips & related Actors

- **Full YouTube research stack:** Pair with [YouTube Video, Channel & Search Scraper](https://apify.com/leopoldsaint/youtube-video-channel-scraper), [YouTube Transcript & Subtitles Scraper](https://apify.com/leopoldsaint/youtube-transcript-scraper), and [YouTube Channel & Creator Business Email Scraper](https://apify.com/leopoldsaint/youtube-channel-email-scraper).
- **Keep runs fast on viral videos:** Set `includeReplies: false` when scraping thousands of top-level comments across many videos, or enable `includeReplies: true` with `maxRepliesPerComment: 5` to capture the best conversation threads without bloating volume.

### FAQ, disclaimers, and support

- **What if comments are disabled on a video?** The Actor logs a warning, skips that video cleanly, and charges nothing for it.
- **Legality & compliance:** Only public YouTube comments are collected. Ensure your usage complies with applicable data privacy laws and platform terms.
- **Questions or feature requests?** Open an issue in the **Issues** tab on Apify Store.

# Actor input Schema

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

One or more YouTube watch URLs, Shorts URLs, youtu.be links, or 11-character video IDs.

## `searchQueries` (type: `array`):

Optional search keywords to discover top YouTube videos automatically and scrape comments from them.

## `maxVideosPerQuery` (type: `integer`):

How many top search-result videos to scrape for each search query.

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

Sort comments by Top comments or Newest first.

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

Maximum comments (including replies when enabled) to extract per video.

## `maxTotalComments` (type: `integer`):

Hard cap on total comments returned across the entire run.

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

Also expand and scrape replies nested under top-level comments.

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

Maximum replies to fetch for each parent comment when includeReplies is enabled.

## `minLikes` (type: `integer`):

Only output comments with at least this many likes (0 = keep all comments).

## `containsKeywords` (type: `array`):

Only output comments containing at least one of these case-insensitive words or phrases (great for pain-point or lead discovery).

## `demoMode` (type: `boolean`):

Return deterministic sample comments without making live requests.

## Actor input object example

```json
{
  "videoUrls": [
    "https://www.youtube.com/watch?v=jNQXAC9IVRw"
  ],
  "searchQueries": [],
  "maxVideosPerQuery": 3,
  "sortBy": "top",
  "maxCommentsPerVideo": 15,
  "maxTotalComments": 15,
  "includeReplies": false,
  "maxRepliesPerComment": 10,
  "minLikes": 0,
  "containsKeywords": [],
  "demoMode": false
}
```

# Actor output Schema

## `comments` (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=jNQXAC9IVRw"
    ],
    "maxCommentsPerVideo": 15,
    "maxTotalComments": 15
};

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

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

```

## MCP server setup

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