# YouTube Comments Scraper: Replies, Likes & Hearts (`sblabs/youtube-comments-scraper`) Actor

Get the comments and replies of any YouTube video, playlist or channel. Input: links, how many, Top or Newest. Output: text, author, likes, reply count, pinned and creator-hearted flags, links. Use it for audience research, sentiment analysis and moderation. Pay per comment.

- **URL**: https://apify.com/sblabs/youtube-comments-scraper.md
- **Developed by:** [SB](https://apify.com/sblabs) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.40 / 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: replies, likes and hearts

Export the comments of any YouTube video, Short or live replay, or of **a whole playlist or channel**, with their replies, likes, reply counts, authors, and pinned and creator-hearted flags. Choose **Top** or **Newest first**, cap how many you want, and download the results as JSON, CSV or Excel, or call the Actor from your code, n8n, Make, Zapier or an AI agent through MCP.

**You only pay for comments that are delivered.** Listing the videos of a playlist or channel is free. Videos with comments turned off, missing videos and invalid links are reported in the results but never charged.

### What you get for each comment

| Field | Description |
|---|---|
| `text` | The comment text |
| `authorName`, `authorChannelId`, `authorUrl`, `authorAvatarUrl` | Who wrote it |
| `authorIsVerified`, `authorIsVideoOwner` | Verified badge, and whether the video's creator wrote it |
| `likes`, `likesText` | Like count as a number (YouTube rounds large counts, e.g. `44K` becomes 44000) and as shown |
| `replyCount` | How many replies the comment has |
| `isPinned`, `isHeartedByCreator`, `isEdited` | Pinned by the creator, hearted by the creator, edited |
| `publishedTimeText`, `publishedAtApprox` | As shown on YouTube ("6 years ago") and an approximate date |
| `isReply`, `parentCommentId` | For replies: which comment they answer |
| `commentId`, `commentUrl` | A direct link that opens the video at this comment |
| `videoId`, `videoTitle`, `videoChannel`, `videoCommentCount` | The video, and its total comment count as YouTube shows it (includes replies) |
| `position` | Order of the comment in the sort you chose |
| `sourceType`, `sourceTitle`, `sourcePosition` | For videos that came from a playlist or channel |

#### Example output

```json
{
  "videoId": "5MuIMqhT8DM",
  "videoTitle": "Sleep Is Your Superpower | Matt Walker | TED",
  "videoChannel": "TED",
  "videoCommentCount": 11646,
  "status": "ok",
  "position": 1,
  "commentId": "UgxWiXiUQDz1CSmjIr14AaABAg",
  "commentUrl": "https://www.youtube.com/watch?v=5MuIMqhT8DM&lc=UgxWiXiUQDz1CSmjIr14AaABAg",
  "text": "That moment when you‘re watching this at 2 am",
  "authorName": "@ninopreuss2549",
  "authorIsVerified": false,
  "authorIsVideoOwner": false,
  "likes": 44000,
  "likesText": "44K",
  "replyCount": 897,
  "isPinned": false,
  "isHeartedByCreator": false,
  "publishedTimeText": "6 years ago",
  "publishedAtApprox": "2020-10-19",
  "isReply": false,
  "parentCommentId": null
}
```

### Features

- **Videos, playlists and channels.** Paste video links, a playlist link, or a channel link (`@handle`, `/channel/UC…`). For channels, choose regular videos, Shorts, past live streams or all uploads, newest first.
- **Top or newest.** The same two sort options YouTube shows under a video.
- **Replies when you want them.** Turn on replies and set how many per comment. Replies come right after their parent comment, linked by `parentCommentId`.
- **Creator signals.** Pinned comments, comments hearted by the creator and comments written by the creator are flagged, which makes it easy to find what the creator engaged with.
- **Fast and light.** No browser: it reads YouTube's own comment data, 20 comments per request, several videos in parallel, with residential proxy and automatic retries.
- **Clear errors.** Every input gets a row. Failed rows have an `error` code (`comments_disabled`, `unavailable`, `no_comments`, `playlist_not_found`, `channel_not_found`, `blocked`…) and a plain-English `errorMessage`.

### Tested before release

- **Mixed run:** a popular TED talk, a Short, a Romanian news video, a video with comments turned off, a video ID that does not exist and the @TED channel (2 newest videos), with replies on. Result: 156 comments and 341 replies from the 5 readable videos in 2.5 minutes; the two bad inputs got `comments_disabled` and `unavailable` rows and were not charged.
- **Deep run:** 300 comments newest-first from one video plus a playlist. Result: 600 comments in 30 seconds, no duplicates across 15 pages, the duplicate video in the playlist skipped.

### How to use

1. Paste YouTube links into **YouTube videos, playlists or channels**.
2. Set **Max comments per video** (default 100, `0` = all) and the sort order.
3. Optional: turn on **Include replies** and set how many per comment.
4. For playlists and channels, set how many videos to take.
5. Click **Start** and open the **Output** tab, or export the dataset.

#### Use it from code

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_API_TOKEN>")
run = client.actor("sblabs/youtube-comments-scraper").call(run_input={
    "videos": ["https://www.youtube.com/watch?v=5MuIMqhT8DM"],
    "maxComments": 500,
    "sort": "newest",
    "includeReplies": True,
    "maxRepliesPerComment": 5,
})
for c in client.dataset(run["defaultDatasetId"]).iterate_items():
    if c["status"] == "ok":
        print(c["likes"], c["text"][:80])
```

#### Use it from an AI agent (MCP)

Add the Apify MCP server (`https://mcp.apify.com`) to Claude, Cursor or any MCP client and ask: *"Get the top 200 comments of this YouTube video and summarize what viewers liked and disliked."*

### Pricing

Pay per event: **one charge per delivered comment or reply**, at the price shown on the Pricing tab. Listing playlist and channel videos, failed videos and error rows are free. Proxy and compute are included. Set a maximum cost per run and the Actor stops cleanly when it reaches it.

### Input options

| Option | Default | Notes |
|---|---|---|
| `videos` | — | Video, playlist or channel links, or video IDs. Required |
| `maxComments` | 100 | Top-level comments per video, `0` = all |
| `sort` | `top` | `top` or `newest` |
| `includeReplies` | false | Also collect replies |
| `maxRepliesPerComment` | 10 | Replies per comment when replies are on, `0` = all |
| `maxVideosPerSource` | 10 | Videos taken from each playlist or channel, `0` = all (up to 5,000) |
| `channelContent` | `videos` | `videos`, `shorts`, `streams` or `all`. A channel link ending in `/shorts` or `/streams` picks that tab |
| `maxConcurrency` | 5 | Videos processed in parallel |
| `maxRetries` | 3 | Retries with a fresh IP on blocks or dropped connections |
| `proxyConfiguration` | Residential | Recommended for YouTube |

### FAQ

**Are like counts exact?** YouTube shows exact counts below 1,000 and rounded counts above (`1.2K`, `44K`). `likes` converts those to numbers, so large values are approximate; `likesText` keeps the original.

**Why is `publishedAtApprox` approximate?** YouTube only shows relative times such as "3 weeks ago". The Actor converts them to a date counted back from the run, so older comments can be off by a few days or weeks.

**Does `videoCommentCount` match the number of rows?** Not exactly. YouTube's count includes replies and can include comments held for review, so it is usually a little higher than the top-level comments you get.

**Is it legal?** The Actor reads publicly visible comments. You are responsible for how you use the data, including YouTube's terms and privacy laws such as GDPR, since comments are personal data. Use it for research, moderation and analysis, not to contact or profile individual users.

**Something broke?** Open an issue on the Issues tab with the video link and it will be looked at quickly.

### More tools from sblabs

- [YouTube Transcript Scraper](https://apify.com/sblabs/youtube-transcript-scraper): transcripts, AI-ready chunks with timestamps, SRT and VTT, for videos, playlists and channels.
- [App Reviews Scraper](https://apify.com/sblabs/app-reviews-scraper): Google Play and App Store reviews in one run, same fields for both stores.
- [Shopify Products Scraper](https://apify.com/sblabs/shopify-products-scraper): every product, price, sale price, variant and stock flag from any Shopify store.
- [Product Hunt Launches Scraper](https://apify.com/sblabs/product-hunt-launches-scraper): daily, weekly and monthly leaderboards with votes, ranks and topics.

# Actor input Schema

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

Video links or 11-character IDs (watch, youtu.be, Shorts, live), playlist links, or channel links (@handle, /channel/UC...). Playlists and channels are expanded into their videos for free.

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

Top-level comments to collect from each video. 0 means all of them.

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

Same as the sort menu under a YouTube video.

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

Also collect the replies under each comment. Each reply is one result (and one charge).

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

Used when replies are on. 0 means all.

## `maxVideosPerSource` (type: `integer`):

For playlist and channel links: how many videos to take (channels: newest first). 0 means all, up to 5,000.

## `channelContent` (type: `string`):

Which uploads to take from channel links. A link ending in /shorts or /streams overrides this.

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

How many videos to process at the same time.

## `maxRetries` (type: `integer`):

Extra attempts with a fresh IP when YouTube blocks a request or the connection drops.

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

Residential proxy is the default and recommended setting for YouTube.

## Actor input object example

```json
{
  "videos": [
    "https://www.youtube.com/watch?v=5MuIMqhT8DM"
  ],
  "maxComments": 100,
  "sort": "top",
  "includeReplies": false,
  "maxRepliesPerComment": 10,
  "maxVideosPerSource": 10,
  "channelContent": "videos",
  "maxConcurrency": 5,
  "maxRetries": 3,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

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

One item per comment or reply, plus error rows for videos that could not be read.

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

No description

# 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=5MuIMqhT8DM"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("sblabs/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=5MuIMqhT8DM"],
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("sblabs/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=5MuIMqhT8DM"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call sblabs/youtube-comments-scraper --silent --output-dataset

```

## MCP server setup

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