# YouTube Comments Scraper - With Replies (`gganbukim/youtube-comments-scraper`) Actor

Scrape YouTube comments and full reply threads in bulk from videos, channels and playlists. Like counts, reply counts, author channel IDs, verified and creator flags, sorted by top or newest. Keyword and like filters run before billing, so filtered comments are free.

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

## Pricing

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

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## YouTube Comments Scraper — Bulk Comments & Replies with Likes, Authors and Dates

Pull **every comment from a video, a whole channel, or a playlist** in one run. Top-level comments and reply threads, with like counts, reply counts, author channel IDs, verified and creator flags, and a direct link to each comment.

### What it does well

- **Bulk input** — videos, `@handles`, channel URLs and playlists in the same run. Channels are expanded automatically.
- **Real pagination** — pulls hundreds of comments per video, not just the first page. (Getting this right is subtle: YouTube's page token and its reply-thread tokens are the same shape, and matching on shape rather than position quietly paginates into one reply thread and stops at ~30 comments. This actor does not do that.)
- **Replies** — optional full reply-thread expansion, flagged with `isReply` and `replyLevel`.
- **Sort control** — Top comments, or Newest first for monitoring.
- **Server-side filtering** — keep only comments containing your keywords, or above a like threshold. **Filtered comments are not billed.**
- **Throttle handling** — datacenter → residential proxy escalation with per-video IP sessions.

### Input

```jsonc
{
  "videoUrls": ["https://www.youtube.com/watch?v=8S0FDjFBj8o", "@veritasium"],
  "maxVideos": 25,
  "maxCommentsPerVideo": 500,
  "sortBy": "newest",
  "includeReplies": true,
  "filterKeywords": ["pricing", "alternative", "how do I"],
  "minLikeCount": 2
}
```

### Output

```json
{
  "videoId": "8S0FDjFBj8o",
  "commentId": "UgxRK6CK8oblNf__AHx4AaABAg",
  "text": "This is the equivalent to adding random words to reach the word count.",
  "likeCount": 12000,
  "replyCount": 14,
  "publishedTimeText": "7 years ago",
  "isReply": false,
  "replyLevel": 0,
  "authorName": "@davidrojas9668",
  "authorChannelId": "UCzvkFTT6KgHZeMYf0gczw5Q",
  "authorChannelUrl": "https://www.youtube.com/channel/UCzvkFTT6KgHZeMYf0gczw5Q",
  "authorIsVerified": false,
  "authorIsCreator": false,
  "commentUrl": "https://www.youtube.com/watch?v=8S0FDjFBj8o&lc=UgxRK6CK8oblNf__AHx4AaABAg",
  "videoTitle": "The Danger of Silence"
}
```

### Common uses

- **Brand & competitor monitoring** — watch a competitor's channel for complaints and feature requests.
- **Lead generation** — `filterKeywords` on buying-intent phrases, then work the author channels.
- **Audience research** — what your viewers actually ask, in their own words.
- **Sentiment & moderation datasets** — export to CSV or JSON with author metadata attached.
- **Creator analytics** — find your most-engaged commenters across a back catalogue.

### Pricing

Pay per comment delivered. Comments removed by your keyword or like filters, videos with comments disabled, and failed requests **cost nothing**.

Starting a run costs $0.00004 — the platform's $0.00001 minimum, charged once per GB of memory, and these Actors run on 4 GB. That is four cents per thousand runs, and it is the only charge not tied to a row you received.

### FAQ

**Does it need a YouTube API key?** No.

**Comments disabled on a video?** That video is skipped and reported in the run summary; you are not charged.

**How many comments can I get per video?** As many as YouTube will paginate — set `maxCommentsPerVideo` to control cost.

**Can I run it on a schedule?** Yes, via Apify Schedules, webhooks, or the API. Also available over MCP for AI agents.

# Actor input Schema

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

Videos, channels or playlists. Any mix of watch URLs, youtu.be links, /shorts/, bare video IDs, @handles, /channel/UC…, or playlist URLs. Channels and playlists are expanded into their videos automatically.

## `maxVideos` (type: `integer`):

Cap on how many videos to visit, counting videos pulled out of channels and playlists.

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

Stop after this many comments on each video. Comments arrive 20 per request, so this is also the main cost control.

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

Top comments is YouTube's relevance ranking. Newest first is what you want for monitoring and alerting.

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

Expand reply threads as well as top-level comments. Replies are marked with isReply and replyLevel. This costs extra requests, so leave it off if you only need top-level sentiment.

## `filterKeywords` (type: `array`):

Case-insensitive keywords. A comment is kept if it contains any of them. Leave empty to keep everything. Useful for brand monitoring and lead detection.

## `minLikeCount` (type: `integer`):

Drop comments below this like count. Filtered-out comments are not billed.

## `concurrency` (type: `integer`):

How many videos to process in parallel.

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

Leave the default. The actor starts on cheap datacenter proxies and only escalates to residential if YouTube actually throttles it.

## Actor input object example

```json
{
  "videoUrls": [
    "https://www.youtube.com/watch?v=8S0FDjFBj8o"
  ],
  "maxVideos": 10,
  "maxCommentsPerVideo": 100,
  "sortBy": "top",
  "includeReplies": false,
  "minLikeCount": 0,
  "concurrency": 5,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

One row per comment, with author, like count, reply depth and the video it belongs to.

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

Counts for this run: rows delivered, rows filtered, items that failed, the proxy tier used, and whether the run stopped at its charge limit.

# 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=8S0FDjFBj8o"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("gganbukim/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=8S0FDjFBj8o"] }

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

```

## MCP server setup

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