# YouTube Video Comments Scraper (`electrabot.info/youtube-video-comments`) Actor

Scrapes comments (text, author, likes, replies, timestamps) from YouTube videos. Supports top/newest sort and up to 1000 comments per video.

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

## Pricing

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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 **YouTube video comments** — with replies, likes, verified and creator
badges, pinned/hearted flags, timestamps, and **built-in sentiment analysis** —
as JSON, CSV, or Excel.

Paste one video or a whole list. No browser under the hood.

**Pay per result** — you're charged per comment delivered. Videos with comments
disabled or unavailable cost nothing.

---

### What can I use it for?

- **Audience & sentiment research** — every comment ships with a positive/negative/neutral label and score. Measure how a video, product launch, or campaign actually landed.
- **Creator analytics** — which comments the creator pinned or hearted, who's verified, what drives engagement.
- **Competitor & market intel** — mine the comment sections of competitors' videos for complaints, requests, and objections.
- **AI & LLM datasets** — clean, structured comment text with reply threading intact.
- **Community moderation** — surface the most-liked and most-negative comments at a glance.

---

### Input

| Field | Required | Description |
|-------|----------|-------------|
| **Video URLs** | ✅ | One or more videos: watch URLs, `youtu.be` links, `/shorts/`, or bare 11-character IDs. Each comment is one result. |
| **Sort comments by** | – | `top` (most-engaged first — best for analysis) or `new` (most recent). |
| **Max comments per video** | – | 1–5,000 (default 100). The run reports how many the video actually has. |
| **Max replies per thread** | – | How many replies to load under each top-level comment (0 = top-level only; default 10). |
| **Proxy configuration** | – | **Automatic by default:** datacenter proxy first, escalating to RESIDENTIAL only if YouTube blocks it. |

### Output

One record per comment:

```json
{
  "videoId": "dQw4w9WgXcQ",
  "videoUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "videoTitle": "Rick Astley - Never Gonna Give You Up",
  "channel": "Rick Astley",
  "commentId": "UgxKREWxIgDrw71paZx4AaABAg",
  "parentId": null,
  "isReply": false,
  "author": "@SomeUser",
  "authorUrl": "https://www.youtube.com/@SomeUser",
  "authorIsVerified": false,
  "authorIsUploader": false,
  "text": "This song is a timeless classic!",
  "likeCount": 4200,
  "isPinned": false,
  "isHearted": true,
  "publishedTimeText": "2 years ago",
  "timestamp": 1700000000,
  "sentiment": "positive",
  "sentimentScore": 0.6597
}
````

| Field | Description |
|-------|-------------|
| `sentiment` / `sentimentScore` | VADER sentiment (tuned for social text): label + compound score (−1…+1) |
| `isReply` / `parentId` | Rebuild the thread tree, or analyze flat |
| `isPinned` / `isHearted` | What the creator promoted or endorsed |
| `authorIsVerified` / `authorIsUploader` | Verified accounts and the creator's own replies |
| `likeCount` | Engagement per comment |

***

### Why this scraper is reliable

- **No browser** — pure HTTP built on a battle-tested extraction engine whose maintainers track YouTube's changes daily. Fast cold starts, low cost.
- **Sentiment included** — no separate NLP step; every comment ships labeled and scored.
- **Block-aware with automatic escalation** — if YouTube blocks the cheap proxy tier, the scraper retries through a residential proxy, then a fresh IP, before giving up.
- **No silent truncation** — popular videos have far more comments than any run fetches. The run tells you `commentsScraped` vs `commentsAvailable` per video in the `SUMMARY`, so you always know whether you got everything.
- **Honest run statuses** — videos with comments disabled are reported per video and never charged; a run with zero comments is **Failed**, never a silent empty dataset.
- **Batch-safe** — comments are saved incrementally and runs are checkpointed: an interruption never loses finished work or double-charges you.

### Tips & limits

- **Big videos:** a viral video may have hundreds of thousands of comments. Set **Max comments per video** to what you actually need — `top` sort gives you the most-engaged ones first, which is usually what matters.
- Replies are loaded per thread; set **Max replies per thread** to 0 if you only want top-level opinions (cheaper and faster).
- Videos with comments disabled, private, or removed are reported in the `SUMMARY` — never charged.

### Use it from code

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("electrabot.info/youtube-video-comments").call(
    run_input={"videoUrls": ["dQw4w9WgXcQ"], "sort": "top", "maxComments": 200}
)
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["sentiment"], item["likeCount"], item["text"][:60])
```

### FAQ

**Does it get all comments from a video?**
It gets as many as you ask for (up to 5,000/video), sorted by top or newest. The `SUMMARY` always reports how many the video has in total, so you know exactly what you received.

**What sentiment engine is used?**
VADER — a lexicon tuned for social-media text (handles emphasis, negation, emoji, slang). `sentimentScore` runs from −1 (most negative) to +1 (most positive).

**Can I get transcripts too?**
Yes — see our [YouTube Transcript Scraper](https://apify.com/electrabot.info/youtube-transcript-scraper) for single videos and [YouTube Channel Transcript Scraper](https://apify.com/electrabot.info/youtube-bulk-video-transcript) for whole channels.

**Is scraping comments legal?**
This actor accesses only publicly visible comments. You are responsible for complying with applicable laws and YouTube's Terms of Service. Comments contain personal data — handle them accordingly (GDPR/CCPA).

***

### Disclaimer

**This is an unofficial tool. It is not affiliated with, endorsed by, sponsored by,
or in any way officially connected to YouTube or Google LLC.** "YouTube" and all
related names, marks, and logos are trademarks of their respective owners and are
used here for descriptive purposes only.

This actor only accesses **publicly available** information. You are responsible
for ensuring your use complies with applicable laws, YouTube's Terms of Service,
and any applicable rate-limiting rules. Use it ethically and at your own risk.

# Actor input Schema

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

One or more videos: watch URLs, youtu.be links, /shorts/, /embed/, or bare 11-character video IDs. Each comment found is one result.

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

'Top' returns the most-engaged comments first (best for analysis); 'New' returns the most recent.

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

Upper bound per video (1-5000). Each comment is one billable result. Videos usually have far more - the run tells you how many were available.

## `maxRepliesPerThread` (type: `integer`):

How many replies to load under each top-level comment (0 = top-level comments only).

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

Default (recommended): automatic tiering - cheap datacenter proxy first, auto-escalating to RESIDENTIAL only if YouTube blocks it.

## Actor input object example

```json
{
  "videoUrls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "sort": "top",
  "maxComments": 100,
  "maxRepliesPerThread": 10,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `transcripts` (type: `string`):

One record per video: full plain-text transcript, timed segments, language info, and video metadata.

## `runSummary` (type: `string`):

Requested/scraped/failed counts and per-video failure reasons.

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

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

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

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "YouTube Video Comments Scraper",
        "description": "Scrapes comments (text, author, likes, replies, timestamps) from YouTube videos. Supports top/newest sort and up to 1000 comments per video.",
        "version": "2.0",
        "x-build-id": "H7H1q7shVdYKe7TaK"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/electrabot.info~youtube-video-comments/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-electrabot.info-youtube-video-comments",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/electrabot.info~youtube-video-comments/runs": {
            "post": {
                "operationId": "runs-sync-electrabot.info-youtube-video-comments",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/electrabot.info~youtube-video-comments/run-sync": {
            "post": {
                "operationId": "run-sync-electrabot.info-youtube-video-comments",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "videoUrls"
                ],
                "properties": {
                    "videoUrls": {
                        "title": "Video URLs",
                        "type": "array",
                        "description": "One or more videos: watch URLs, youtu.be links, /shorts/, /embed/, or bare 11-character video IDs. Each comment found is one result.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "sort": {
                        "title": "Sort comments by",
                        "enum": [
                            "top",
                            "new"
                        ],
                        "type": "string",
                        "description": "'Top' returns the most-engaged comments first (best for analysis); 'New' returns the most recent.",
                        "default": "top"
                    },
                    "maxComments": {
                        "title": "Max comments per video",
                        "minimum": 1,
                        "maximum": 5000,
                        "type": "integer",
                        "description": "Upper bound per video (1-5000). Each comment is one billable result. Videos usually have far more - the run tells you how many were available.",
                        "default": 100
                    },
                    "maxRepliesPerThread": {
                        "title": "Max replies per thread",
                        "minimum": 0,
                        "maximum": 100,
                        "type": "integer",
                        "description": "How many replies to load under each top-level comment (0 = top-level comments only).",
                        "default": 10
                    },
                    "proxyConfiguration": {
                        "title": "Proxy configuration",
                        "type": "object",
                        "description": "Default (recommended): automatic tiering - cheap datacenter proxy first, auto-escalating to RESIDENTIAL only if YouTube blocks it.",
                        "default": {
                            "useApifyProxy": true
                        }
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
