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

Scrape comments and replies from any YouTube video, Short, playlist or channel: text, author, likes, reply count, date, pinned and creator-hearted flags. Top or newest first. Fast, no browser, no API key, no quota.

- **URL**: https://apify.com/ksvan/youtube-comments-scraper.md
- **Developed by:** [K.S. Van](https://apify.com/ksvan) (community)
- **Categories:** Social media, Videos, AI
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$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: Comments, Replies & Likes

Scrape **comments and replies** from any YouTube video or Short, or from a **whole playlist or channel**, in one run. You get the text, author, like count, reply count, date, and the pinned and creator-hearted flags. Order them **Top** or **Newest first**, the same way YouTube does.

No YouTube API key, no quota limits, no browser, no login. You pay only per comment delivered.

### What you can paste

- Video URLs: `youtube.com/watch?v=...`, `youtu.be/...`, `youtube.com/shorts/...`, `youtube.com/live/...`
- Plain 11-character video IDs
- Playlist URLs: `youtube.com/playlist?list=...`
- Channel URLs: `youtube.com/@handle`, `youtube.com/channel/UC...` (newest videos first, optionally Shorts)

### What you get

| Field | Example |
|---|---|
| `videoId`, `videoUrl`, `videoTitle`, `videoCommentCount` | dQw4w9WgXcQ, ..., "Rick Astley - Never Gonna Give You Up", 2460041 |
| `commentId` | Ugxzbv_ZeZXNRcfwsSF4AaABAg |
| `text` | the full comment text |
| `author`, `authorChannelId`, `authorChannelUrl`, `authorAvatarUrl` | @candycake9531, UC..., link, avatar |
| `authorIsChannelOwner`, `authorIsVerified` | false, false |
| `publishedTimeText` | 6 years ago |
| `likeCount`, `replyCount` | 291000, 683 |
| `isPinned`, `isHeartedByCreator` | false, false |
| `isReply`, `parentCommentId` | replies point to their parent comment |
| `scrapedAt` | 2026-10-19T15:40:00+00:00 |

### Use cases

- **Audience research and sentiment analysis**: what viewers love, hate and ask for.
- **Content ideas**: mine questions and requests from comments on your niche's top videos.
- **Brand and product monitoring**: track what people say about a product in reviews and unboxings.
- **AI datasets**: clean, structured comment text for classification, LLM analysis or training.
- **Giveaways and community management**: export all comments of a video.

### How to use

1. Paste videos, playlists or channels.
2. Set **Max comments per video** and **Sort by** (Top comments or Newest first).
3. Turn on **Include replies** to also get the replies under each comment.
4. Run. Each comment and each reply is one dataset record.

#### Example input

```json
{
  "videos": ["https://www.youtube.com/watch?v=dQw4w9WgXcQ"],
  "maxCommentsPerVideo": 500,
  "sortBy": "top",
  "includeReplies": true,
  "maxRepliesPerComment": 20
}
```

#### Example output

```json
{
  "videoId": "dQw4w9WgXcQ",
  "videoTitle": "Rick Astley - Never Gonna Give You Up (Official Video) (4K Remaster)",
  "videoCommentCount": 2460041,
  "commentId": "Ugxzbv_ZeZXNRcfwsSF4AaABAg",
  "text": "Is everyone going to ignore the fact that Rick Astley looks like a twelve year old boy but has a uniquely deep voice?",
  "author": "@candycake9531",
  "authorChannelUrl": "https://www.youtube.com/channel/UCNLgzvqrGzFi5SEAbVkFchg",
  "publishedTimeText": "6 years ago",
  "likeCount": 291000,
  "replyCount": 683,
  "isPinned": false,
  "isHeartedByCreator": false,
  "isReply": false,
  "parentCommentId": null
}
```

### Pricing

Pay per comment or reply delivered. Proxies and compute are included. Videos with comments turned off cost nothing.

### Notes

- YouTube shows like counts rounded above 1,000 (for example 291K), so `likeCount` is the rounded value.
- `publishedTimeText` is the relative date YouTube shows ("6 years ago", "2 days ago").
- **Max comments (total)** caps the whole run, which is useful for big channels.

### FAQ

**Do I need a YouTube API key or quota?** No.

**Something broke?** Open an issue on the Issues tab and it will be fixed quickly.

# Actor input Schema

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

Any mix of video URLs (watch, youtu.be, Shorts, live), 11-character video IDs, playlist URLs and channel URLs (@handle, /channel/UC...).

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

Top-level comments per video (replies are counted separately).

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

Same order as on YouTube.

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

Also scrape replies under each comment (each reply is one record).

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

Only used with Include replies.

## `maxVideosPerChannel` (type: `integer`):

Newest videos first for channels.

## `includeShorts` (type: `boolean`):

For channel URLs, also take videos from the Shorts tab.

## `maxItems` (type: `integer`):

Stop after this many comments and replies in total. 0 = no limit.

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

How many videos are processed at the same time.

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

Apify datacenter proxy works well.

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

Retries with a fresh proxy IP before a video is reported as failed.

## Actor input object example

```json
{
  "videos": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "maxCommentsPerVideo": 100,
  "sortBy": "top",
  "includeReplies": false,
  "maxRepliesPerComment": 20,
  "maxVideosPerChannel": 20,
  "includeShorts": false,
  "maxItems": 0,
  "maxConcurrency": 8,
  "proxyConfiguration": {
    "useApifyProxy": true
  },
  "maxRetries": 6
}
```

# Actor output Schema

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

One record per comment or reply.

# 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"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

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

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

```

## MCP server setup

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