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

Scrape comments and replies from YouTube videos and Shorts: text, author, likes, reply count, pinned and creator-hearted flags. Fast HTTP scraper, no browser, no login and no API key.

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

## Pricing

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

Scrape comments and replies from any public YouTube video or Short. Every comment comes with its text, author, like count, reply count, publish time and pinned / creator-hearted flags, plus the video title and channel. Paste video URLs or IDs and download the results as JSON, CSV, Excel or through the API.

### Video tutorial

[![Export YouTube Comments & Replies, No Code (143 Rows in 5 s) | YouTube Comments Scraper](https://img.youtube.com/vi/Nifsz9oibdo/maxresdefault.jpg)](https://www.youtube.com/watch?v=Nifsz9oibdo)

Prefer reading? Follow the [step-by-step guide with screenshots](https://novihub.net/blog/youtube-comments-scraper-tutorial/).

### What can this YouTube Comments Scraper do?

- 💬 **Comments and replies**: top-level comments, plus up to N replies per comment, linked through `parentCommentId`
- ↕️ **Sort order**: get YouTube's **Top comments** or **Newest first**
- 📌 **Rich flags**: pinned comments, comments hearted by the creator, comments written by the channel owner, verified authors, edited comments
- 👤 **Author details**: handle, channel ID, channel URL and avatar for every commenter
- 📺 **Video context**: video title, channel name, channel ID and the total comment count on every row
- 🔗 **Bulk input**: many videos in one run, using `watch?v=` links, `youtu.be` links, Shorts, live and embed links
- ⚡ **Fast and light**: plain HTTP requests, no browser, so it runs in 256 MB of memory and returns hundreds of comments in seconds
- 🛡️ **Keeps going on errors**: unavailable videos or videos with comments turned off return a row with an `error` message and the run continues

### What can I use YouTube comments for?

- **Sentiment analysis and brand monitoring**: see how viewers react to your product, campaign or competitor
- **Audience research**: find questions, pain points and content ideas in your niche
- **Influencer vetting**: check engagement quality on a creator's videos before a partnership
- **AI and LLM datasets**: feed real conversations into classification, summarization or RAG pipelines
- **Community management**: export comments to reply, moderate or report on them

### How to scrape YouTube comments

1. Click **Try for free** and open the actor in Apify Console.
2. Add one or more YouTube video URLs or IDs to **Video URLs**.
3. Set **Max comments per video** and choose **Top comments** or **Newest first**.
4. Turn on **Include replies** if you also want the reply threads.
5. Click **Start**, then download the dataset in JSON, CSV, Excel or HTML.

### Input

| Field                  | Type    | Description |
|------------------------|---------|-------------|
| `startUrls`            | array   | YouTube video or Shorts URLs (`watch?v=`, `youtu.be/`, `/shorts/`, `/live/`, `/embed/`). |
| `maxComments`          | integer | Maximum number of top-level comments per video. Replies are not counted. Default `100`. |
| `sortBy`               | string  | `top` (default) or `newest`. |
| `includeReplies`       | boolean | Also scrape replies. Each reply is a separate row. Default `false`. |
| `maxRepliesPerComment` | integer | Maximum replies per comment when replies are on. Default `10`. |
| `proxyConfiguration`   | object  | Optional. Leave it off: when YouTube blocks a request, the scraper retries it through Apify Proxy automatically. Set your own proxy only if you need a specific one. |

#### Input example

```json
{
  "startUrls": [
    { "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ" },
    { "url": "https://www.youtube.com/shorts/0e3GPea1Tyg" },
    { "url": "https://youtu.be/jNQXAC9IVRw" }
  ],
  "maxComments": 200,
  "sortBy": "top",
  "includeReplies": true,
  "maxRepliesPerComment": 5
}
```

### Output

Each comment or reply is one row in the dataset.

| Field                  | Description |
|------------------------|-------------|
| `type`                 | `comment` or `reply` |
| `commentId`            | YouTube comment ID |
| `parentCommentId`      | For replies, the ID of the comment it answers; `null` for top-level comments |
| `commentUrl`           | Direct link that highlights the comment on YouTube |
| `text`                 | Full comment text |
| `authorName`           | Commenter's handle, e.g. `@MrBeast` |
| `authorChannelId` / `authorChannelUrl` / `authorAvatarUrl` | Commenter's channel and avatar |
| `authorIsVerified`     | Commenter has a verified badge |
| `authorIsChannelOwner` | Comment was written by the video's channel |
| `likeCount`            | Number of likes (YouTube rounds large numbers, e.g. `1.1M` becomes `1100000`) |
| `replyCount`           | Number of replies to the comment |
| `isPinned`             | Comment is pinned by the creator |
| `isHeartedByCreator`   | Comment received a heart from the creator |
| `isEdited`             | Comment was edited |
| `publishedTimeText`    | Relative publish time as shown on YouTube, e.g. `3 years ago` |
| `publishedAt`          | Approximate publish date (ISO 8601), calculated from `publishedTimeText` |
| `videoId` / `videoUrl` / `videoTitle` | The video the comment belongs to |
| `channelName` / `channelId` | The video's channel |
| `totalCommentsText`    | Total comment count shown on the video, e.g. `2,462,957` |
| `error`                | Only on error rows: why no comments were returned for this video |

#### Output example

```json
{
  "type": "comment",
  "commentId": "UgzH8vliQSJKHQMGZjx4AaABAg",
  "parentCommentId": null,
  "commentUrl": "https://www.youtube.com/watch?v=0e3GPea1Tyg&lc=UgzH8vliQSJKHQMGZjx4AaABAg",
  "text": "Like I said in the video, subscribe if you haven’t already and you could win $10,000!",
  "authorName": "@MrBeast",
  "authorChannelId": "UCX6OQ3DkcsbYNE6H8uQQuVA",
  "authorChannelUrl": "https://www.youtube.com/channel/UCX6OQ3DkcsbYNE6H8uQQuVA",
  "authorIsVerified": true,
  "authorIsChannelOwner": true,
  "likeCount": 1100000,
  "replyCount": 741,
  "isPinned": true,
  "isHeartedByCreator": false,
  "isEdited": false,
  "publishedTimeText": "5 years ago",
  "publishedAt": "2021-12-02T00:30:14.455Z",
  "videoId": "0e3GPea1Tyg",
  "videoUrl": "https://www.youtube.com/watch?v=0e3GPea1Tyg",
  "videoTitle": "$456,000 Squid Game In Real Life!",
  "channelName": "MrBeast",
  "channelId": "UCX6OQ3DkcsbYNE6H8uQQuVA",
  "totalCommentsText": "662,258"
}
```

### Use it from code

#### Python

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("novi/youtube-comments-scraper").call(run_input={
    "startUrls": [{"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"}],
    "maxComments": 100,
    "sortBy": "newest",
})
for comment in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(comment["authorName"], comment["text"])
```

#### JavaScript

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: '<YOUR_APIFY_TOKEN>' });
const run = await client.actor('novi/youtube-comments-scraper').call({
    startUrls: [{ url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ' }],
    maxComments: 100,
    includeReplies: true,
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

### How much does it cost to scrape YouTube comments?

You pay only for the comments you get: **$0.30 per 1,000 comments** (each reply counts as one comment), with lower prices on higher Apify plans. Each run also has a small start fee of $0.0005, and rows for unavailable videos are free.

For example, 10,000 comments cost about $3, and the free monthly credit on the Apify Free plan covers roughly 16,000 comments.

### FAQ

**Do I need a YouTube API key or login?**
No. The scraper reads the same public data you see in a browser, without an API key, login or quota.

**Why is `likeCount` a round number?**
YouTube only shows rounded like counts for popular comments (for example `73K`). The scraper converts them to numbers.

**Why are there fewer comments than the video's total?**
The total on YouTube includes replies and comments that YouTube hides as spam or held for review. Turn on **Include replies** to get the reply threads too.

**Is scraping YouTube comments legal?**
This actor only collects publicly available data. Comments can contain personal data, so make sure your use complies with GDPR and other regulations that apply to you, and use the data for legitimate purposes.

# Actor input Schema

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

YouTube video or Shorts URLs (watch, youtu.be, shorts, live, embed).

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

Maximum number of top-level comments to scrape from each video. Replies are not counted here.

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

Order in which YouTube returns the comments.

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

Also scrape replies to each comment. Each reply is a separate result.

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

Maximum number of replies to scrape for each comment when 'Include replies' is on.

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

Optional. Leave it off: when YouTube blocks a request, the scraper retries it through Apify Proxy automatically. Set your own proxy only if you need a specific one.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    }
  ],
  "maxComments": 100,
  "sortBy": "top",
  "includeReplies": false,
  "maxRepliesPerComment": 10,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

Comments and replies, one per item.

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

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

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

```

## MCP server setup

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