# 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 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 **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

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