# YouTube Comments Scraper: Export Comments & Replies to CSV (`viktorov_aa/youtube-comments`) Actor

Export YouTube comments and replies from videos and Shorts to CSV, Excel or JSON: text, author, likes, reply count and time. No API key and no login.

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

## Pricing

from $0.50 / 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: export comments and replies of videos and Shorts to CSV, Excel or JSON

Use this **YouTube comments scraper** to **export YouTube comments** and their replies from any public video or Short. Download the comments **to CSV or Excel**, or read them as JSON through the API, for sentiment analysis, community management or research.

Export the comments of any public YouTube video or Short, with replies if you want them. You get the comment text, author, likes, reply count and time in a flat table that is ready for Excel, Google Sheets, BI tools or an LLM pipeline. The actor talks to YouTube's own web API directly: no browser, no login, no API key and no YouTube Data API quota.

Comment pages use a continuation token, so a normal run does not download the watch page. The video title comes from YouTube's public oEmbed endpoint. The watch-next page is requested only when oEmbed has no title, or when the comment section comes back empty. About 20 comments arrive per request. A run with the prefilled input finishes in seconds on 256 MB.

#### Who is it for?

- **Creators and community managers** who want to read, search and analyse what viewers say.
- **Brands and agencies** monitoring reactions to their own or competitor videos (sort by newest for monitoring).
- **Researchers and data scientists** building sentiment, topic or language datasets.
- **AI and automation builders** who feed comments into classification or summarisation workflows through the Apify API, Make, n8n or Zapier.

#### What do you get?

One row per comment or reply:

| Field | Meaning |
|---|---|
| `videoId`, `title`, `commentId`, `url` | the video, its title, the comment and a direct link to it |
| `text` | the comment text. The same string is also stored as `comment` |
| `author`, `authorChannelId` | author handle and channel ID |
| `authorIsChannelOwner`, `isCreator` | the same flag: YouTube's `isCreator`, true when the author is the video's channel |
| `authorIsVerified` | whether YouTube marks the author verified |
| `likeCount`, `replyCount` | likes and number of replies. `1.7K` is stored as `1700` |
| `commentsCount` | the count YouTube shows on the video, repeated on each row of that video |
| `publishedTimeText` | relative time as shown by YouTube, e.g. "3 days ago" |
| `publishedAt` | that relative label turned into UTC ISO-8601 at run time. An estimate, not the original second |
| `date` | the calendar day of `publishedAt` (`YYYY-MM-DD`). The page has no clock time |
| `isEdited`, `isPinned`, `hasCreatorHeart` | edited, pinned, and hearted by the creator |
| `replyLevel`, `parentCommentId` | 0 for top-level comments, 1 for replies together with the parent's ID |
| `cid`, `voteCount`, `pageUrl`, `type`, `replyToCid` | the same values under the field names used by the leading Store actor |
| `status` | `ok`, `no_comments` or `error` |
| `errorCode` | `NO_COMMENTS`, `COMMENTS_TURNED_OFF`, `DATE_FILTER_TOO_STRICT`, `VIDEO_UNAVAILABLE`, `NOT_A_VIDEO` or `BLOCKED` |

The key-value store also holds a `SUMMARY` record with the comment count shown by YouTube for each video (`totals`), the number of exported comments, failed videos and traffic figures.

#### Input

| Parameter | Default | Description |
|---|---|---|
| `startUrls` | – | Video or Shorts URLs or 11-character IDs, one per line. |
| `maxCommentsPerVideo` | 100 | Top-level comments per video. |
| `maxComments` | 100000 | Hard cap for the whole run, replies included. |
| `sortBy` | `top` | `top` or `newest`. `NEWEST_FIRST` is accepted when `sortBy` is omitted. |
| `oldestCommentDate` | empty | Keep comments on or after this date. `YYYY-MM-DD`, or a relative age such as `2 days`. Forces newest. |
| `includeReplies` | false | Also fetch replies. |
| `maxRepliesPerComment` | 20 | Replies per comment, used only with replies enabled. |
| `maxRetriesOnBlock` | 3 | Retries on HTTP 429/403. A proxy, when set, uses a new session each time. |
| `proxyConfiguration` | proxy off | Off unless the input turns it on. Enable Apify Proxy if a run is blocked. |

Example input (two videos that returned comments; 20 is one page):

```json
{
  "startUrls": [
    "https://www.youtube.com/watch?v=aircAruvnKk",
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "maxCommentsPerVideo": 20,
  "sortBy": "top",
  "includeReplies": false,
  "proxyConfiguration": { "useApifyProxy": false }
}
```

#### Example output

One row per comment. The values below are the field shape (the same shape the offline fixture builds). Likes are integers: YouTube's `1.7K` is stored as `1700`. `publishedAt` is the run clock minus the relative label, in UTC. A reply has `replyLevel` 1 and `parentCommentId` set to the parent `commentId`. `hasCreatorHeart` is true only when YouTube's toolbar state is hearted, not when the heart tooltip is merely present.

```json
{
  "videoId": "aircAruvnKk",
  "commentId": "C1",
  "text": "hi",
  "author": "@a",
  "authorChannelId": "UCx",
  "authorIsChannelOwner": true,
  "isCreator": true,
  "authorIsVerified": true,
  "likeCount": 1700,
  "replyCount": 64,
  "commentsCount": 9521,
  "publishedTimeText": "2 years ago",
  "publishedAt": "2024-11-19T15:04:00Z",
  "isEdited": true,
  "isPinned": true,
  "hasCreatorHeart": true,
  "replyLevel": 0,
  "parentCommentId": null,
  "url": "https://www.youtube.com/watch?v=aircAruvnKk&lc=C1",
  "status": "ok"
}
```

#### Pricing

The actor uses pay-per-event pricing with one event, **`comment`**: one charge for every comment or reply returned. Videos with comments disabled are reported with `status: no_comments` and are not charged by the actor. The price and the Apify platform fee are shown on the Pricing tab. Set `maxCommentsPerVideo`, `maxComments` and your Apify spending limit to keep costs predictable. Remember that replies are separate paid results.

#### Limitations

- **`publishedAt` is an estimate, and so is `oldestCommentDate`.** YouTube's comment payload has "3 days ago", not a timestamp. The actor keeps that label in `publishedTimeText` and also writes `publishedAt` by subtracting the label from the run time (calendar months and years, exact hours and below). A label of "6 years ago" covers the year that started six years before the run, not the original second. The date filter uses that same estimate, so a comment inside the bucket can fall on either side of a calendar day. A non-English label stays in `publishedTimeText`, leaves `publishedAt` null, and is kept. The request asks YouTube for English. `1 day` means today (UTC) and `2 days` means yesterday and today. Setting the filter switches the sort to newest, and a non-pinned comment older than the cutoff stops the crawl.
- **Public videos only.** Private, deleted or restricted videos (for example members-only) return no comments.
- **YouTube may block some IPs.** Proxy is off unless you set it: on 18 Nov 2026 the comments call answered from a datacenter IP with no sign-in wall. If a video comes back blocked, turn on Apify Proxy. The actor then retries with a new session. A video that is still blocked is listed in `failedVideos` of the `SUMMARY` record.
- **Totals can differ.** YouTube hides some comments (spam filter, held for review), so the exported number can be lower than the counter on the video.
- Live-chat messages, author profile pictures and comment translations are not included.
- This is an unofficial tool and is not affiliated with YouTube or Google. YouTube can change its internal API; we update the actor when that happens.

#### FAQ

**How do I export YouTube comments to CSV or Excel?** Paste the video or Shorts URLs, run the Actor, then open the Export button on the dataset and pick CSV or Excel. Each comment and each reply is one row.

**Does it scrape replies to comments?** Yes. Turn on `includeReplies`. Each reply is its own row with `replyLevel` 1 and the parent's ID in `parentCommentId`, and `maxRepliesPerComment` caps how many replies are read for each comment.

**Can I try it on a small run first?** Yes. The prefilled input reads two videos and stops at 20 comments per video. Pricing is per stored comment or reply, shown on the Pricing tab.

**Do I need to log in or use an API key?** No. There is no YouTube account, no browser and no YouTube Data API quota.

**Do I need a proxy?** No. `proxyConfiguration` is off when the field is omitted, which is the same default as the form. Turn on Apify Proxy only if a run is blocked. Choose residential proxy only if a sign-in wall persists.

**What are the limits?** About 20 comments per request. `maxCommentsPerVideo` defaults to 100 when the field is omitted and the form example is 20. `maxComments` caps the whole run, replies included. Replies are off unless `includeReplies` is on.

**What did the live check miss?** On 2026-11-19, 12 of 15 videos returned comments from a datacenter IP with proxy off. The other three (`MCJj86jrl90`, `1usAA35fNpg`, `XqZsoesa55w`) are videos whose comment section says "Comments are turned off." The actor records that sentence on the `no_comments` row. It does not invent comments for a section YouTube has closed. Shorts URLs use the same path. See `LIVE_SMOKE_2026-11-19_v2.md` for the recount, including five extra Shorts and replies. Proxy stays off when the input omits `proxyConfiguration`.

**How close is this to the leading Store actor?** The public input and output of [YouTube Comments Scraper](https://apify.com/streamers/youtube-comments-scraper) are mapped in `PARITY_2026-11-19.md`. `sortBy` accepts that actor's `NEWEST_FIRST` when `sortBy` itself is omitted. `oldestCommentDate` filters on the estimated time and forces newest. Each row also carries `title` and that actor's field names (`comment`, `cid`, `voteCount`, `pageUrl`, `type`, `replyToCid`) next to ours. The price and the charge event are unchanged.

**How do I get only the newest comments?** Set `sortBy` to `newest` and use `maxCommentsPerVideo` as a limit. `NEWEST_FIRST` is accepted when `sortBy` is omitted. On the 2026-11-19 check, newest order differed from top on every video that had comments.

**Can I export replies?** Yes: enable `includeReplies`. Replies have `replyLevel: 1` and the ID of the parent in `parentCommentId`.

**Is it legal?** The actor reads publicly visible comments. Comments can contain personal data, so follow the laws and YouTube's terms that apply to your use (GDPR, for example).

**Something is wrong with a video.** Open the Issues tab and send the video link and the row you got.

# Actor input Schema

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

YouTube video or Shorts URLs (`watch?v=…`, `youtu.be/…`, `/shorts/…`) or plain 11-character video IDs, one per line. The form example is two public videos that returned comments with no login and no proxy.

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

Counts only top-level comments; replies have their own limit below. YouTube returns about 20 comments per request, so 20 is one page. The form example is 20. An API call that omits the field uses 100.

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

Hard cap for the whole run, replies included. The run stops when it is reached. Use it together with your Apify spending limit to keep the cost predictable.

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

Same as the sort menu on YouTube. Use `newest` for monitoring new comments. `sortCommentsBy` values `TOP_COMMENTS` and `NEWEST_FIRST` are accepted when `sortBy` is omitted. A date filter below forces newest.

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

Keep comments published on or after this date. Use YYYY-MM-DD, or a relative age such as "2 days" or "3 hours". "1 day" means today (UTC) and "2 days" means yesterday and today. YouTube only sends a relative label, so the cutoff uses the same estimate as publishedAt and can be off by one bucket. Setting this switches the sort to newest. Leave empty to keep every comment.

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

Also fetch replies under each comment. This costs one extra request per comment thread and every reply is a separate paid result.

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

Used only when replies are enabled.

## `maxRetriesOnBlock` (type: `integer`):

On HTTP 429 or 403 the actor retries this many times before giving up on the video. With a proxy on, each retry uses a new session.

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

Off unless you turn it on, including when an API call omits the field. A datacenter IP returned comments for these videos with no login and no proxy. Enable Apify Proxy if a run is blocked. Choose residential proxy only if a sign-in wall persists.

## Actor input object example

```json
{
  "startUrls": [
    "https://www.youtube.com/watch?v=aircAruvnKk",
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "maxCommentsPerVideo": 20,
  "maxComments": 100000,
  "sortBy": "top",
  "oldestCommentDate": "2024-01-01",
  "includeReplies": false,
  "maxRepliesPerComment": 20,
  "maxRetriesOnBlock": 3,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `overview` (type: `string`):

Default dataset in the overview table: text, author, likes, reply count, time, video title and video.

# 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=aircAruvnKk",
        "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    ],
    "maxCommentsPerVideo": 20,
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("viktorov_aa/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=aircAruvnKk",
        "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    ],
    "maxCommentsPerVideo": 20,
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("viktorov_aa/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=aircAruvnKk",
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "maxCommentsPerVideo": 20,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call viktorov_aa/youtube-comments --silent --output-dataset

```

## MCP server setup

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