# YouTube Comments Scraper — with likes, replies, and authors (`dangul/youtube-comments-scraper`) Actor

Extract YouTube comments with author, like count, reply count, and timestamps. Sort by top or newest, paginated automatically.

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

## Pricing

$0.50 / 1,000 comment scrapeds

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## YouTube Comments Scraper

Extract comments from any YouTube video — with the author, like count, reply count, and when
each one was posted. Sort by **top comments** or **newest first**. Pagination is handled for
you: ask for 2,000 comments and you get 2,000.

**Why this one returns data.** YouTube blocks the datacenter address ranges that scraping
platforms run on, which is why so many comment scrapers return empty results or bot-check
errors. This one routes every request through a residential connection, so it sees what a
normal viewer sees.

### Quick start

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

### What you get per comment

| Field | Description |
|---|---|
| `text` | The comment itself |
| `author` · `authorChannelId` · `authorAvatar` | Who wrote it |
| `authorIsCreator` | Whether the video's own channel wrote it |
| `likeCountText` · `likeCount` | Likes, as displayed (`275K`) and parsed where possible |
| `replyCount` | Number of replies |
| `publishedText` | When it was posted, as YouTube shows it |
| `commentId` | Stable identifier |
| `videoId` · `videoTitle` · `channel` | Which video it came from |

By default each comment is its own dataset row, so the output exports straight to CSV or
Excel. Turn off **One row per comment** to get one row per video with the comments nested
inside instead.

### What people use it for

- **Audience research** — what viewers actually say about a product, topic, or competitor
- **Sentiment analysis** — feed comments into a classifier or an LLM
- **Content ideas** — the questions asked repeatedly under a popular video are a content plan
- **Community management** — find unanswered questions on your own videos
- **Market research** — read complaints and requests in a niche, at scale

Pairs well with the **YouTube Data Scraper** — use it to find videos in a niche, then this
one to read what people said about them.

### Pricing

Pay per comment returned. A video with 20 comments costs a twentieth of one with 400.
**Videos that fail or have comments disabled cost you nothing** — they still appear in the
dataset with an `error` field so nothing disappears silently.

### Notes and limits

- Videos with comments disabled return a clear error rather than an empty result.
- Replies to comments are counted (`replyCount`) but not expanded into separate rows.
- `likeCount` is parsed from YouTube's abbreviated display where possible; `likeCountText`
  always carries the exact string YouTube shows (`275K`, `1.2M`).
- Each video is fetched independently — one failure never aborts the run.
- This actor reads publicly available data only.

### Support

Something not returning what you expect? Open an issue on the **Issues** tab with the video
URL you used.

# Actor input Schema

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

Videos to read comments from. Accepts watch links, youtu.be, Shorts, or bare 11-character IDs.

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

Upper bound on comments returned for each video. Pagination is handled for you.

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

Top comments are ranked by engagement; newest returns the most recent first.

## `oneItemPerComment` (type: `boolean`):

On: each comment is its own dataset row, ready for CSV or Excel export. Off: one row per video with comments nested inside.

## Actor input object example

```json
{
  "videoUrls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "maxCommentsPerVideo": 100,
  "sortBy": "top",
  "oneItemPerComment": true
}
```

# 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=dQw4w9WgXcQ"
    ]
};

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

# Run the Actor and wait for it to finish
run = client.actor("dangul/youtube-comments-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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=dQw4w9WgXcQ"
  ]
}' |
apify call dangul/youtube-comments-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=dangul/youtube-comments-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/j4xPOogb0WeplBGDD/builds/dy145RvpR4Hzatcly/openapi.json
