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

Comments and replies from any public YouTube video, Short or live replay, with no login. For every video, the run tells you whether you got all the comments, and if not, why.

- **URL**: https://apify.com/sedgelabs/youtube-comments-scraper.md
- **Developed by:** [Sedge Labs](https://apify.com/sedgelabs) (community)
- **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

Get comments and replies from any public YouTube video, Short or live replay, with no login and no
API key. Every run also tells you, per video, whether you got everything and, if not, why.

### Why this YouTube comment scraper

Most comment scrapers hand you a file. If it has 40 comments and the video shows 3,680, you're left
guessing whether it's a bug, a limit or YouTube.

This actor gives each video a plain answer in the run's `RUN_SUMMARY`, and in the status message
when you run one video:

- "100 of the 12,513 YouTube shows: stopped at your limit of 100 per video."
- "55 of the 63 YouTube shows: YouTube served no more. YouTube's count also includes comments it no
  longer shows, such as deleted ones or ones held for review."
- "Comments are turned off for this video."

If the platform restarts a run partway, it carries on from the last saved page instead of starting
over.

### What you get

One row per comment or reply:

| Field | What it is |
|---|---|
| `videoId` | The video the comment is on |
| `commentId`, `parentCommentId`, `isReply` | IDs, so you can rebuild reply threads |
| `text` | The comment text |
| `publishedTimeText` | What YouTube shows, for example "2 months ago" |
| `publishedAtApprox` | That time as an approximate date (YouTube only gives relative times) |
| `likeCount`, `replyCount` | Likes and replies |
| `isPinned`, `isHeartedByCreator`, `authorIsChannelOwner` | Flags |
| `authorName`, `authorChannelId`, `authorHandle` | The author. Turn off **Include author fields** to leave these out |

### How to export YouTube comments to CSV, Excel or JSON

1. Paste video URLs or 11-character IDs into **Videos**.
2. Set **Max comments per video** (replies count toward it).
3. Pick **Sort**: top comments or newest first.
4. Click **Start**, then download the results as JSON, CSV or Excel, or read them through the API.

### Input example

```json
{
  "videos": ["https://www.youtube.com/watch?v=dQw4w9WgXcQ", "4z8Hi_uQOkE"],
  "maxCommentsPerVideo": 500,
  "sort": "newest",
  "includeReplies": true,
  "oldestCommentDate": "7 days"
}
```

### Output example

An illustrative row with author fields off:

```json
{
  "videoId": "8WtD3zfsCDI",
  "commentId": "UgwiinymaSb31PP2McJ4AaABAg",
  "parentCommentId": null,
  "isReply": false,
  "text": "Great explanation, thanks!",
  "publishedTimeText": "2 months ago",
  "publishedAtApprox": "2026-08-30T10:38:05.671Z",
  "likeCount": 4,
  "replyCount": 0,
  "isPinned": false,
  "isHeartedByCreator": false,
  "authorIsChannelOwner": false
}
```

And the matching entry in `RUN_SUMMARY` (in the run's key-value store):

```json
{
  "videoId": "IvtAd2g7aac",
  "status": "complete",
  "items": 55,
  "youtubeCount": 63,
  "endedBy": "all_fetched",
  "explanation": "55 of the 63 YouTube shows: YouTube served no more. ..."
}
```

`endedBy` is one of `all_fetched`, `max_comments`, `date_cutoff`, `already_seen`, `scan_limit`,
`charge_limit` or `error`.

### Filters

- **Comments from / until**: a date (2026-01-31) or an age (7 days, 2 weeks). Needs sort set to
  newest. The run stops at the first comment older than your range, so you don't pay for the rest.
- **Minimum likes**, **Only comments hearted by the creator**, **Keywords**: you're charged only for
  comments that match.
- **Max comments to scan per video** limits how far a filter looks when matches are rare (up to
  20,000).

### Watching videos on a schedule

Turn on **Only new comments since the last run** (with sort set to newest) and give the schedule a
**Monitor name**. Each run remembers the newest comments it saw and stops when it reaches them, so
a daily schedule delivers only what's new. Use one monitor name per schedule.

### What people use YouTube comment data for

- Audience research on your own videos or a competitor's: what viewers ask for and complain about.
- Daily monitoring of new comments on launch or sponsored videos.
- Sentiment analysis or training data, with reply structure kept, for an LLM or a spreadsheet.
- Vetting a creator by how engaged their comment sections look.

### Pricing

$1.00 per 1,000 comments, plus $0.002 per video whose comments load. Apify's platform usage is
included. Bad IDs, unavailable videos and videos with comments turned off cost nothing.

| Job | Cost |
|---|---|
| 1,000 comments from one video | $1.00 |
| 100 comments each from 10 videos | $1.02 |
| A daily check of 20 videos that finds 50 new comments | $0.09 per day |

To control spend, set **Max comments per video**, use the date range, and set a maximum charge per
run in the run options.

### Why do I get fewer comments than YouTube shows?

Check the video's `explanation` in `RUN_SUMMARY`. The usual reasons:

- You hit **Max comments per video**, or your date range or filters ended the run.
- **Include replies** is off. YouTube's count includes replies.
- YouTube counts comments it no longer shows: deleted ones, ones held for review, and ones
  filtered as spam. No scraper can fetch those.
- On the Top sort, YouTube can stop serving early on very large videos. Newest-first can go further
  back.

### FAQ

#### How do I download all comments from a YouTube video?

Paste the video URL, set **Max comments per video** high enough, keep **Include replies** on, and
run it. The video's `explanation` in `RUN_SUMMARY` tells you whether you got everything YouTube
serves.

#### Is this an alternative to the YouTube Data API?

Yes, for comments. You don't need a Google Cloud project, an API key or a daily quota.

#### Do I need a YouTube account or API key?

No. The actor reads public comments without logging in.

#### Do I need proxies?

No setup needed. It uses Apify's proxy by default.

#### Can I use it through the API, Make, Zapier or n8n?

Yes, like any Apify actor. Call it with your
API token and read the dataset when the run finishes.

#### Does it work on Shorts and live replays?

Yes. Live chat is not included, only comments.

#### Is scraping YouTube comments legal?

The actor collects only public comments, logged out. The
comments are personal data in many places (for example under the GDPR), and their authors own
them. You are responsible for how you collect, store and use them. If you're unsure, ask a
lawyer, and turn off **Include author fields** when you don't need them.

Don't use the data for spam, harassment, impersonation or any other unlawful purpose.

This actor is independent and not affiliated with, endorsed by or sponsored by YouTube or Google.
YouTube is a trademark of Google LLC.

### Support

Open an issue on the Issues tab and include your run link.

# Actor input Schema

## `videos` (type: `array`):

YouTube video URLs or 11-character video IDs.

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

Stop after this many comments per video, replies included.

## `sort` (type: `string`):

Top comments or newest first.

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

Also fetch replies to each comment.

## `includeAuthor` (type: `boolean`):

Add author name, channel ID and handle to each row. Turn off to leave personal data out.

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

Only comments posted on or after this. A date (2026-01-31) or an age (7 days, 2 weeks, 3 months). Stops at the first older comment, so you only pay for the newer ones. Needs Sort set to Newest. YouTube shows dates as "3 weeks ago", so dates are estimates; see the "Posted around" column.

## `newestCommentDate` (type: `string`):

Only comments posted on or before this. Same formats; a date includes that whole day. For example, Comments from "14 days" until "7 days" gives the week before last. Comments newer than this are looked at and skipped, which counts toward Max comments to scan. Needs Sort set to Newest. Can't be used with Only new comments.

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

Only comments with at least this many likes. YouTube rounds large counts (1.3K), so above 1,000 this is approximate.

## `onlyHeartedByCreator` (type: `boolean`):

Only comments the video's creator gave a heart.

## `keywords` (type: `array`):

Only comments containing any of these words or phrases, ignoring upper and lower case.

## `maxCommentsScanned` (type: `integer`):

Only used when a filter or Comments until is on. Filters can match rarely, so this limits how far the run looks on each video, up to 20,000. The run summary says when a video hit it.

## `onlyNewComments` (type: `boolean`):

For scheduled runs that watch the same videos. Each run remembers the newest comments it looked at on each video, and the next run returns only comments posted after it, so you never pay twice for one comment. The first run returns comments as usual (up to Max comments per video and the date filter). Needs Sort set to Newest. New replies on older comments are not picked up. The memory is kept in the key-value store "youtube-comments-memory" in your account; delete it to start over.

## `monitorName` (type: `string`):

Only matters with "Only new comments" on. Runs with the same name share one memory. Give each schedule its own name if two schedules watch the same video, or one will take the other's new comments.

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

Proxy used for requests to YouTube.

## Actor input object example

```json
{
  "videos": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "maxCommentsPerVideo": 100,
  "sort": "top",
  "includeReplies": false,
  "includeAuthor": true,
  "minLikes": 0,
  "onlyHeartedByCreator": false,
  "keywords": [],
  "maxCommentsScanned": 5000,
  "onlyNewComments": false,
  "monitorName": "default",
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `comments` (type: `string`):

One row per comment or reply.

## `summary` (type: `string`):

Per video: how many comments you got, YouTube's count, and why it stopped.

# 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 = {
    "videos": [
        "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("sedgelabs/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 = { "videos": ["https://www.youtube.com/watch?v=dQw4w9WgXcQ"] }

# Run the Actor and wait for it to finish
run = client.actor("sedgelabs/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 '{
  "videos": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ]
}' |
apify call sedgelabs/youtube-comments-scraper --silent --output-dataset

```

## MCP server setup

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