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

Extract YouTube comments and replies from videos, Shorts, channels, playlists or search. Likes, reply counts, pinned and hearted flags, creator replies, keyword filter and video context on every row. For sentiment analysis, research and AI datasets.

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

## Pricing

from $0.70 / 1,000 comment or replies

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/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** exports YouTube comments **and their replies** from single videos, Shorts, the latest videos of whole channels, playlists or the top videos for any keyword. Each row includes likes, reply count, pinned and hearted flags, whether the creator wrote it, and the video it belongs to. Use it for sentiment analysis, audience research, brand monitoring and AI datasets.

### What can this Actor do?

- Comments from **videos, Shorts, channels, playlists and search keywords**.
- **Replies included** (optional), linked to their parent comment.
- Likes as numbers, reply count, published time, **pinned**, **hearted by creator**, **channel member** and **creator** flags.
- **Sort** by top comments or newest first.
- **Keyword filter**: keep only comments mentioning your brand or topic. Filtered-out comments are free.
- Direct link to every comment.

### Why choose it over other tools?

- **Whole channels in one run**, not just one video at a time.
- Video title, channel and total comment count on every row: analysis-ready without joins.
- Keyword filter saves money: you pay only for comments you keep.

### What data can I extract?

| Field | Description |
|---|---|
| `commentId / commentUrl` | Comment ID and direct link |
| `text / author / authorChannelId` | Comment text and author |
| `likeCount / replyCount` | Engagement numbers |
| `publishedText` | When it was posted |
| `isPinned / isHearted / isMember / authorIsCreator` | Comment flags |
| `isReply / parentCommentId` | Reply structure |
| `videoId / videoTitle / channelName / videoCommentCount` | Video context |

### How to use it

1. Paste video, Shorts, channel or playlist URLs, or enter search keywords.
2. Set max videos and max comments per video; turn on replies if needed.
3. Optionally add keywords to keep only relevant comments.
4. Click **Start** and export to CSV/Excel or send to your AI pipeline.

### Input example

```json
{
  "startUrls": [
    "https://www.youtube.com/@veritasium"
  ],
  "maxVideos": 20,
  "maxComments": 500,
  "sortBy": "newest",
  "includeReplies": true,
  "keywordFilter": [
    "price",
    "buy"
  ]
}
```

### Output example

```json
{
  "commentId": "UgwPwTibxdgqCHZxktd4AaABAg",
  "text": "My algebra teacher said that this was a link to the test answers",
  "author": "@bdr8823",
  "likeCount": 73000,
  "replyCount": 725,
  "publishedText": "7 years ago",
  "isPinned": false,
  "isReply": false,
  "videoTitle": "Rick Astley - Never Gonna Give You Up (Official Video) (4K Remaster)",
  "channelName": "Rick Astley"
}
```

Download the dataset as JSON, CSV, Excel or HTML, or read it with the API.

### How much does it cost?

This Actor uses **pay-per-event** pricing: you pay only for results delivered, and platform usage is included. Prices drop further on higher Apify plans (Silver, Gold).

| What you pay for | Price on paid plans |
|---|---|
| Comment or reply delivered | $0.001 ($1 per 1,000) |

**Example:** 10,000 comments from a competitor's channel cost **$10**.

You can set a **maximum cost per run** in the run options; the Actor stops cleanly when it is reached. Failed items and errors are never charged.

### Use cases

- **Sentiment analysis and brand monitoring** on product reviews and competitor channels.
- **Audience research**: questions, complaints and feature requests from real viewers.
- **Influencer vetting**: real engagement quality.
- **AI and NLP datasets** of authentic opinions.

### Integrations and API

You can run this Actor and get its data in many ways:

- **Apify API and clients** for [JavaScript](https://docs.apify.com/api/client/js) and [Python](https://docs.apify.com/api/client/python): start runs and download results as JSON, CSV, Excel, XML or HTML.
- **Schedules**: run it hourly, daily or weekly to monitor changes.
- **Integrations**: Make, Zapier, n8n, Google Sheets, Slack, Airbyte, webhooks and more.
- **AI agents (MCP)**: add it to Claude, Cursor, VS Code or any MCP client through the [Apify MCP server](https://mcp.apify.com), and your agent can call it as a tool.

### FAQ

#### Are replies counted separately?

Yes. `maxComments` limits top-level comments per video; replies are extra and limited by `maxRepliesPerComment`.

#### What if comments are turned off?

The video is reported as an error row and nothing is charged.

#### Is it legal to scrape this data?

This Actor collects only publicly available data and does not log in to any account. Personal data is protected by laws such as the GDPR in the EU; don't scrape personal data unless you have a legitimate reason. If you're unsure whether your use case is legitimate, consult a lawyer. See also Apify's post on [the legality of web scraping](https://blog.apify.com/is-web-scraping-legal/).

### Related tools

- [YouTube Scraper](https://apify.com/karioski/youtube-scraper): views, likes and subscribers of the same videos
- [YouTube Transcript Scraper](https://apify.com/karioski/youtube-transcript-scraper): what is said in the videos
- [App Store & Google Play Reviews Scraper](https://apify.com/karioski/app-reviews-scraper): app store reviews for sentiment analysis

Found a bug or missing a feature? Open an issue on the **Issues** tab. We usually reply within 24 hours.

# Actor input Schema

## `startUrls` (type: `array`):

Video/Shorts URLs or IDs, or a channel (@handle, /channel/...) or playlist URL to collect comments from its latest videos.

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

Collect comments from the top videos for each keyword.

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

Maximum number of videos taken from each channel, playlist or search.

## `maxComments` (type: `integer`):

Top-level comments per video (replies are counted separately).

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

Order of the results.

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

Also extract the replies under each comment.

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

Max replies per comment.

## `keywordFilter` (type: `array`):

Keep only comments containing at least one of these words (case-insensitive). Filtered-out comments are not charged.

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

Requests normally go direct. If YouTube answers with a bot check, that request is retried through a fresh proxy IP.

## Actor input object example

```json
{
  "startUrls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "maxVideos": 10,
  "maxComments": 50,
  "sortBy": "top",
  "includeReplies": true,
  "maxRepliesPerComment": 50,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

## `results` (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 = {
    "startUrls": [
        "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    ],
    "maxComments": 50,
    "includeReplies": true,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

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

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

```

## MCP server setup

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