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

Scrape comments and replies from any YouTube video or Short: text, author, likes, reply counts, dates, pinned and hearted flags. Top or newest first, bulk input, JSON/CSV/Excel export. Pay only per comment delivered.

- **URL**: https://apify.com/damilo/youtube-comments-apify.md
- **Developed by:** [Imad](https://apify.com/damilo) (community)
- **Categories:** Social media, AI, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.80 / 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

Scrape **all comments and replies** from any **YouTube video or Short** — text, author, likes, reply counts, dates, pinned and hearted flags — and export them to **JSON, CSV or Excel** in minutes. Paste video URLs, choose **Top comments** or **Newest first**, and pay only for the comments you actually get. No YouTube API key, no login, no quota.

### What does YouTube Comments Scraper do?

YouTube Comments Scraper reads the comment section of the videos you give it — the same comments you see on youtube.com — and turns every comment (and, optionally, every reply) into a clean dataset row. It is built for audience research, sentiment analysis, product feedback mining, creator analytics, academic datasets and AI pipelines.

- 💬 **Comments and replies** — each reply is its own row, placed right after its parent comment and linked by `parentCommentId`.
- 🔀 **Top or Newest** — YouTube's own *Top comments* ranking or *Newest first*, exactly like the sort menu on YouTube.
- 📌 **Rich flags** — pinned comments, comments hearted by the creator, comments written by the channel owner, verified authors, edited comments.
- 📦 **Bulk input** — many videos and Shorts per run, processed in parallel; duplicates are removed automatically.
- 🎯 **Precise limits** — cap comments per video and replies per comment, or scrape everything.
- 💸 **Fair pricing** — videos with comments turned off, unavailable videos and invalid links are reported in an `error` row and **never charged**.
- 🤖 **API- and agent-ready** — stable JSON schema, callable from the Apify API, Python/JavaScript clients, Make, Zapier, n8n or AI agents via Apify's MCP server.

#### What data can you extract from YouTube comments?

| Field | Description |
| --- | --- |
| `type` | `comment`, `reply`, or `error` (a video that returned no comments — never charged) |
| `videoId`, `videoTitle`, `videoUrl` | The video the comment belongs to |
| `commentId`, `parentCommentId`, `isReply` | Comment ID; replies carry the ID of their parent comment |
| `position` | Rank in the chosen sort order (for replies: rank within the thread) |
| `text` | Full comment text, including emojis and line breaks |
| `author`, `authorChannelId`, `authorUrl`, `authorAvatar` | Commenter's handle, channel ID, channel link and avatar |
| `authorIsVerified`, `isAuthorChannelOwner` | Verified badge; comment written by the video's own channel |
| `isPinned`, `isHearted`, `isEdited` | Pinned by the creator, hearted by the creator, edited by its author |
| `likeCount`, `replyCount` | Likes and number of replies |
| `publishedTime`, `publishedAtEstimate` | YouTube's relative time ("3 days ago") and an approximate ISO date |
| `commentUrl` | Direct link that opens the video with this comment highlighted |
| `totalCommentCount` | Total comments YouTube shows for the video (replies included) |
| `sortBy`, `scrapedAt` | Sort order used and scrape timestamp |
| `error` | Why a video returned no comments (`null` on comment rows) |

### How to scrape YouTube comments — step by step

1. Click **Try for free** (a free Apify account takes a minute).
2. Paste one or more **YouTube video URLs or IDs** — watch links, `youtu.be` links, Shorts, embeds and bare IDs all work.
3. Set **Max comments per video** (`0` = all comments) and choose **Top comments** or **Newest first**.
4. Tick **Include replies** if you want reply threads too, optionally capped with **Max replies per comment**.
5. Click **Start**. Results stream into the **Dataset** tab while the run is going.
6. Export them as **CSV, Excel, JSON, XML or HTML**, or fetch them through the API.

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

**$0.80 per 1,000 comments** — $0.0008 per comment or reply delivered. Nothing else: no start fee, no charge for videos without comments.

- 100 comments from each of 10 videos → 1,000 comments → **$0.80**
- Every comment and reply of a popular tutorial with 9,421 comments → about **$7.50**
- Apify's free plan includes $5 of monthly usage, enough for **about 6,000 comments a month at no cost**.

Set **Maximum cost per run** in the run options to cap spending: the actor stops cleanly as soon as the limit is reached and keeps everything scraped so far.

### Input example

```json
{
  "videoUrls": [
    "https://www.youtube.com/watch?v=LKrwhjOI8Nc",
    "https://youtu.be/aircAruvnKk",
    "https://www.youtube.com/shorts/4z8Hi_uQOkE"
  ],
  "maxComments": 500,
  "sortBy": "top",
  "includeReplies": true,
  "maxRepliesPerComment": 20
}
```

### Output example

A pinned comment written by the channel owner, followed by one of its replies:

```json
[
  {
    "type": "comment",
    "videoId": "LKrwhjOI8Nc",
    "videoTitle": "There's never been a better time to go into math",
    "videoUrl": "https://www.youtube.com/watch?v=LKrwhjOI8Nc",
    "commentId": "UgyrAqOygKV6crh2jnp4AaABAg",
    "parentCommentId": null,
    "isReply": false,
    "position": 1,
    "text": "Looking back at this, there's one thing I allude to at the end, but wish I had included more in the middle …",
    "author": "@3blue1brown",
    "authorChannelId": "UCYO_jab_esuFRV4b17AJtAw",
    "authorUrl": "https://www.youtube.com/channel/UCYO_jab_esuFRV4b17AJtAw",
    "authorAvatar": "https://yt3.ggpht.com/ytc/AIdro_nFzZFPLxPZRHcE3SSwzdrbuWqfoWYwLAu0_2iO6blQYAU=s88-c-k-c0x00ffffff-no-rj",
    "authorIsVerified": true,
    "isAuthorChannelOwner": true,
    "isPinned": true,
    "isHearted": false,
    "isEdited": false,
    "likeCount": 512,
    "replyCount": 52,
    "publishedTime": "3 days ago",
    "publishedAtEstimate": "2026-10-18",
    "commentUrl": "https://www.youtube.com/watch?v=LKrwhjOI8Nc&lc=UgyrAqOygKV6crh2jnp4AaABAg",
    "totalCommentCount": 5039,
    "sortBy": "top",
    "scrapedAt": "2026-10-21T03:06:21+00:00",
    "error": null
  },
  {
    "type": "reply",
    "videoId": "LKrwhjOI8Nc",
    "commentId": "UgyrAqOygKV6crh2jnp4AaABAg.Ac3_WPGoUWZAc3aAHs2BVd",
    "parentCommentId": "UgyrAqOygKV6crh2jnp4AaABAg",
    "isReply": true,
    "position": 1,
    "text": "I would like to ask you though, I think you're passionate about math, but how much joy do you feel when doing math? …",
    "likeCount": 8,
    "replyCount": 0,
    "isEdited": true,
    "publishedTime": "3 days ago",
    "…": "same video and author fields as above"
  }
]
```

A video that returns nothing gets one uncharged row, for example `{ "type": "error", "videoId": "XqZsoesa55w", "error": "Comments are turned off for this video" }`.

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

Open the run's **Dataset** tab and click **Export**: CSV, Excel (XLSX), JSON, JSONL, XML and HTML are available, with an option to pick columns. For spreadsheets, the **Overview** view gives a compact table (video, author, comment, likes, replies, date, flags, link). Through the API, add `?format=csv` or `?format=xlsx` to the dataset items URL.

### Use the API from Python, JavaScript or no-code tools

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("damilo/youtube-comments-apify").call(
    run_input={"videoUrls": ["https://www.youtube.com/watch?v=aircAruvnKk"], "maxComments": 500}
)
for comment in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(comment["likeCount"], comment["author"], comment["text"][:80])
```

The actor also works from **Make, Zapier, n8n, Google Sheets and webhooks**, and as a tool for AI agents (Claude, ChatGPT, LangChain, LlamaIndex) through [Apify's MCP server](https://apify.com/actors/mcp-server) — agents get structured comments with explicit `error` rows instead of guesses.

### What can you do with YouTube comments data?

- **Sentiment analysis and audience research** — what viewers love, hate and ask for, at scale.
- **Product and market feedback** — mine reviews, unboxings and competitor videos for feature requests and complaints.
- **Creator and channel analytics** — engagement per video, top commenters, pinned and hearted comments, creator replies.
- **Content ideas and SEO** — recurring questions in comments are ready-made topics for your next video or article.
- **Moderation and brand safety** — monitor comment sections of your own or sponsored videos.
- **Research and AI datasets** — conversation data with reply structure for NLP, classification and LLM evaluation.

#### Pair it with the YouTube Transcript Scraper

Comments tell you how people react; the transcript tells you what was said. Combine this actor with the [YouTube Transcript Scraper](https://apify.com/damilo/youtube-transcript-apify) to give an LLM the full context of a video — the talk and the audience's response — for summaries, Q\&A or content repurposing.

### FAQ

#### Can I scrape all comments of a YouTube video?

Yes — set **Max comments per video** to `0`. Very popular videos have millions of comments; the actor streams them page by page, so use a limit or the run's maximum cost if you only need a sample. The video's total is in `totalCommentCount`.

#### Does it scrape replies?

Yes. Tick **Include replies**. Each reply becomes its own row (`type: "reply"`) right after its parent, with `parentCommentId` linking them. Use **Max replies per comment** to cap long threads.

#### Does it work with YouTube Shorts and live streams?

Shorts — yes, paste the Shorts URL. Live chat is not part of the comment section, so live streams that have comments disabled return an `error` row; finished premieres and uploads work normally.

#### Why are like counts rounded?

YouTube displays likes above 1,000 in rounded form (for example "13K"), and that is the only figure it publishes, so `likeCount` is 13000 for such comments. Counts below 1,000 are exact.

#### How accurate are comment dates?

YouTube only shows relative times such as "3 weeks ago". `publishedTime` keeps that text, and `publishedAtEstimate` converts it into an approximate ISO date (exact to the day for recent comments, within a month or so for comments that are years old).

#### Do I need a YouTube API key, an account or cookies?

No. The actor reads the same public data a logged-out visitor sees on youtube.com — no Google Cloud project, no YouTube Data API quota, no login.

#### Why did a video return no comments?

The `error` row says why: comments turned off (common on videos made for kids), no comments yet, video unavailable or private, or not a valid YouTube link. These rows are never charged.

#### Is it legal to scrape YouTube comments?

Comments are publicly visible data, and this actor only reads what YouTube shows to any visitor. Comments can still contain personal data, so make sure your use complies with privacy laws such as GDPR and with YouTube's terms of service, and do not republish personal data without a lawful basis.

### More data tools by damilo

- [YouTube Transcript Scraper](https://apify.com/damilo/youtube-transcript-apify) — transcripts and timestamped captions of any YouTube video, in bulk.
- [Google Search Results Scraper](https://apify.com/damilo/google-search-apify) — find videos for any topic with `site:youtube.com` queries, then scrape their comments here.
- [Google Autocomplete Scraper](https://apify.com/damilo/google-autocomplete-apify) — keyword ideas and search intent for video and content research.
- [Google Images Scraper](https://apify.com/damilo/google-images-scraper) — image search results with full-size URLs.
- [Google Maps Scraper](https://apify.com/damilo/google-maps-scraper) — local business data for lead generation.
- [Google Shopping Scraper](https://apify.com/damilo/google-shopping-apify), [Amazon Search Scraper](https://apify.com/damilo/amazon-search-scraper), [eBay Search Scraper](https://apify.com/damilo/ebay-search-apify) — product and price data.
- [Y Combinator Scraper](https://apify.com/damilo/y-combinator-scraper-apify) — startups, founders and open jobs.
- [FDA Acronyms & Abbreviations Database](https://apify.com/damilo/fda-acronyms-abbreviations) — free regulatory acronym lookup.

### Support

Need channel-wide scraping, comment search or a custom export? Open the **Issues** tab — it is answered quickly. If the actor saved you time, a ⭐⭐⭐⭐⭐ review helps other people find it.

# Actor input Schema

## `videoUrls` (type: `array`):

One per line. Accepts watch URLs, youtu.be links, Shorts, embed and live URLs, or bare 11-character video IDs.

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

Maximum number of top-level comments to scrape from each video. Set 0 to scrape all comments. Replies are counted separately (see below).

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

Top comments (YouTube's default ranking) or Newest first.

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

Also scrape the replies of every comment. Each reply is returned as its own row right after its parent comment.

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

Only used when replies are included. Set 0 to scrape all replies.

## `maxConcurrency` (type: `integer`):

How many videos to scrape at the same time.

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

Apify Proxy is used by default. If YouTube throttles datacenter IPs, the actor switches to residential proxies automatically.

## Actor input object example

```json
{
  "videoUrls": [
    "https://www.youtube.com/watch?v=aircAruvnKk",
    "https://youtu.be/dQw4w9WgXcQ"
  ],
  "maxComments": 100,
  "sortBy": "top",
  "includeReplies": false,
  "maxRepliesPerComment": 0,
  "maxConcurrency": 3,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

Comments and replies with text, author, likes, reply counts, dates, pinned/hearted flags and video context.

# 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 = {
    "videoUrls": [
        "https://www.youtube.com/watch?v=aircAruvnKk",
        "https://youtu.be/dQw4w9WgXcQ"
    ],
    "maxComments": 100,
    "sortBy": "top",
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("damilo/youtube-comments-apify").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 = {
    "videoUrls": [
        "https://www.youtube.com/watch?v=aircAruvnKk",
        "https://youtu.be/dQw4w9WgXcQ",
    ],
    "maxComments": 100,
    "sortBy": "top",
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("damilo/youtube-comments-apify").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 '{
  "videoUrls": [
    "https://www.youtube.com/watch?v=aircAruvnKk",
    "https://youtu.be/dQw4w9WgXcQ"
  ],
  "maxComments": 100,
  "sortBy": "top",
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call damilo/youtube-comments-apify --silent --output-dataset

```

## MCP server setup

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

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/b7MwkfZ9DU14jWNoE/builds/xMGgB5EGUNbgnWYwX/openapi.json
