# YouTube Comments Scraper (`vakitek/youtube-comments`) Actor

Get every comment of a YouTube video, with replies, author, votes and reply counts. 1 USD per 1,000 comments, no minimum charge per run.

- **URL**: https://apify.com/vakitek/youtube-comments.md
- **Developed by:** [Brahim Sliti](https://apify.com/vakitek) (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.00 / 1,000 comments

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

Give it YouTube videos, get back every comment, with replies if you want them. One row per comment or reply.

YouTube only shows a first page of comments at a time and hides most replies behind a click. We page through all of it for you.

### What people use it for

- **Audience research.** Read what viewers actually say about a video, a product review, or a launch.
- **Sentiment at scale.** Pull thousands of comments into a spreadsheet or a model instead of scrolling.
- **Competitor and creator monitoring.** Track how people react to a competitor's or your own new upload.
- **Moderation and support.** Find questions and complaints buried in a busy comment section.

### How to use it

1. Add videos in **Videos**, one per line: a watch URL, a `youtu.be` link, a Shorts URL, or a bare video id.
2. Set **Max comments per video** (default 100).
3. Optional: **Sort comments by** (top comments or newest first) and **Include replies**.
4. Click **Start**. Export as JSON, CSV or Excel, or pull the results through the API.

```json
{
  "startUrls": ["https://www.youtube.com/watch?v=dQw4w9WgXcQ"],
  "maxComments": 500,
  "sortCommentsBy": "TOP_COMMENTS",
  "includeReplies": true
}
```

### What you get

```json
{
  "cid": "UgyEnXfdC-umwvTt8JF4AaABAg",
  "comment": "Gonna flag this for nudity so I can rick roll the YouTube staff",
  "author": "@Oatman69",
  "authorChannelId": "UCWf34D_s8K_m2vwBISIDWtg",
  "voteCount": 569000,
  "replyCount": 722,
  "replyToCid": null,
  "type": "comment",
  "publishedTimeText": "6 years ago",
  "authorIsChannelOwner": false,
  "hasCreatorHeart": true,
  "isPinned": false,
  "videoId": "dQw4w9WgXcQ",
  "pageUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "title": "Rick Astley - Never Gonna Give You Up (Official Video) (4K Remaster)",
  "commentsCount": 1600000
}
```

- `type` is `comment` for a top-level comment, `reply` for a reply; `replyToCid` is the parent comment's `cid`, null for a top-level comment.
- `voteCount`/`replyCount` are `0` when YouTube shows no likes or replies yet, and null only when the figure is missing from YouTube's response.
- `hasCreatorHeart` is true when the channel owner hearted that comment. `isPinned` is true for the comment the creator pinned on top.
- `commentsCount` is the video's total comment count, the same on every row.

### Pricing

**1 USD per 1,000 comments**, all fields included, replies counted the same as top-level comments.

There is no minimum charge per run: 100 comments from one video cost 0.10 USD. Error rows are free, and there's no monthly fee or Apify platform usage on top.

Example: 500 comments each from 10 videos (5,000 comments) costs 5 USD.

### Good to know

- Including replies adds one extra request per thread that has any, so a video with many long threads takes longer to finish.
- With replies on, each thread's replies come right after their parent comment and count toward **Max comments per video**. A small limit can therefore return only a few threads with all their replies: raise the limit if you want more top-level comments.
- The `oldestCommentDate` field of other comment scrapers is accepted but ignored: YouTube only gives relative dates ("3 days ago"). Sort by newest first and set a limit instead.
- This actor only scrapes comments. For the video itself, our [YouTube Scraper](https://apify.com/vakitek/youtube-scraper) gets views, likes and metadata; our [YouTube Transcript Scraper](https://apify.com/vakitek/youtube-transcript) gets captions.
- You don't need a proxy, a YouTube account or a YouTube API key.

### Use it from n8n, Make or an API

- **Small inputs**: call `run-sync-get-dataset-items` and read the items back directly. Set **Time budget (seconds)** (default 240) to how long you are willing to wait: the actor stops picking up new videos before that point and returns what it already has, so you never hit Apify's 300 second run-sync limit and lose the whole run. Any video left unfinished comes back as a `TIME_BUDGET_EXCEEDED` row instead of being silently dropped.
- **Big inputs**: start the run with `POST /v2/acts/vakitek~youtube-comments/runs`, poll `GET /v2/actor-runs/<runId>` (or add `waitForFinish=60`) until the status is `SUCCEEDED`, then read `GET /v2/datasets/<datasetId>/items`. Set **Time budget (seconds)** to `0` (no limit) for this pattern.

### Errors

A bad input never crashes the run. It becomes a row with an `error` code, and you are not charged for it.

| `error` | What happened | Retry? |
| --- | --- | --- |
| `NOT_FOUND` | The URL or id doesn't match a real video | No |
| `NO_RESULTS` | The video has no comments | No |
| `COMMENTS_DISABLED` | The creator turned comments off for this video | No |
| `INVALID_INPUT` | The video input could not be read | No |
| `BLOCKED` | YouTube refused us for now, even after trying every proxy tier | Yes |
| `UPSTREAM_ERROR` | Something went wrong on YouTube's side or ours | Yes |
| `UPSTREAM_UNAVAILABLE` | Our API was unreachable | Yes |
| `TIME_BUDGET_EXCEEDED` | The time budget ran out before this video finished | Yes |

### FAQ

**How many comments can I get per video?**
Up to 100,000. Set **Max comments per video** as high as you need.

**I already use another YouTube comments actor. Do I have to change my code?**
Probably not. The output field names follow the most used comments scraper on the Store.

**Can I call it from my code or from an AI agent?**
Yes, like any Apify actor: REST API, the Python and JavaScript clients, or the Apify MCP server. The examples are in the API tab.

**Something broke or a field is missing?**
Open an issue on this page. We read every one and usually answer within a day.

# Changelog

This Actor's version history is a separate document: https://apify.com/vakitek/youtube-comments/changelog.md

# Actor input Schema

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

YouTube videos: watch URL, youtu.be link, Shorts URL, or bare 11-character video id.

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

Maximum number of comments (and replies, if included) to scrape per video.

## `sortCommentsBy` (type: `string`):

Top comments (YouTube's featured order) or newest first.

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

Also scrape each thread's replies. Slower: one extra request per thread that has any.

## `language` (type: `string`):

Interface language (hl) requested from YouTube, as an ISO 639-1 code (e.g. fr, de, ja).

## `country` (type: `string`):

Geolocation (gl) requested from YouTube, as an ISO 3166-1 alpha-2 code (e.g. FR, DE, JP).

## `timeBudgetSecs` (type: `integer`):

Stop and return what is ready after this many seconds, so n8n/Make run-sync calls never time out. 0 = no limit.

## Actor input object example

```json
{
  "startUrls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "maxComments": 100,
  "sortCommentsBy": "TOP_COMMENTS",
  "includeReplies": false,
  "language": "en",
  "country": "US",
  "timeBudgetSecs": 240
}
```

# Actor output Schema

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

Comments and replies of each video, with author, votes and reply counts. Error items carry an `error` code and the `input` that failed.

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

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

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

```

## MCP server setup

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

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/k6hBe11SfKsegpK06/builds/EFbs0czEcGcizLOQp/openapi.json
