# YouTube Comments Scraper (`agentflow/youtube-comments-scraper`) Actor

Extract comments and replies from YouTube videos. Fast, lightweight, no browser needed.

- **URL**: https://apify.com/agentflow/youtube-comments-scraper.md
- **Developed by:** [Yunbin Huang](https://apify.com/agentflow) (community)
- **Categories:** Social media
- **Features:** Limited permissions
- **Stats:** 44 total users, 3 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.25 / 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/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

Extract comments and replies from YouTube videos. Fast, lightweight, no browser needed.

### What does YouTube Comments Scraper do?

Extract public comments from any YouTube video via pure HTTP — no browser, no Playwright, no Puppeteer.

- Extract **top-level comments** with author, likes, publish time, and reply count
- Optionally fetch **replies** for each comment
- Support **batch processing** — scrape multiple videos in one run
- Get basic **video metadata** alongside comments
- **No browser needed** — runs in 128MB memory, extremely fast

### How to use YouTube comments data

- **Sentiment analysis**: Understand how audiences react to a video
- **Market research**: Find pain points and requests from real users
- **Lead generation**: Find potential customers discussing relevant topics
- **Content strategy**: Discover what viewers care about most
- **Brand monitoring**: Track mentions of your brand in comments
- **Competitive analysis**: See how audiences respond to competitor content

### What data can you extract?

| Field | Description |
|-------|-------------|
| 💬 Comment text | Full text of the comment |
| 👤 Author | Display name of the commenter |
| 👍 Like count | Number of likes on the comment |
| 💬 Reply count | Number of replies to the comment |
| 🕐 Published time | Relative time (e.g. "2 days ago") |
| 📌 Is pinned | Whether the comment is pinned by the creator |
| 🏆 Is channel owner | Whether commenter is the video creator |
| ↩️ Replies | Full reply threads (if enabled) |

### How to scrape YouTube comments

1. Create a free Apify account
2. Open [YouTube Comments Scraper](https://apify.com/agentflow/youtube-comments-scraper)
3. Paste one or more YouTube video URLs
4. Set max comments and whether to include replies
5. Click **Start** and download results in JSON, CSV, or Excel

### ⬇️ Input example

```json
{
    "urls": [
        "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    ],
    "maxComments": 100,
    "includeReplies": false
}
```

### ⬆️ Output example

```json
{
    "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    "videoId": "dQw4w9WgXcQ",
    "title": "Rick Astley - Never Gonna Give You Up",
    "channelName": "Rick Astley",
    "commentCount": 100,
    "comments": [
        {
            "commentId": "UgxXXXXXXXXXXXXXXXX",
            "text": "This song will never get old.",
            "author": "John Doe",
            "authorChannelId": "UCxxxxxxxxxxxxxxxx",
            "likeCount": 1523,
            "replyCount": 12,
            "publishedTime": "2 years ago",
            "isPinned": false,
            "isLikedByAuthor": false,
            "authorIsChannelOwner": false,
            "replies": []
        }
    ]
}
```

### Integrations — send YouTube comments anywhere

Connect YouTube Comments Scraper to almost any app through the Apify platform. Pipe comments straight into **Make**, **Zapier**, **n8n**, **Slack**, **Google Sheets**, **Google Drive**, or **Airbyte** for dashboards and sentiment pipelines. Trigger runs and receive results with **webhooks**, or drive everything from the **Apify API**. You can also expose this Actor to AI agents through an **MCP server** so an LLM can pull and analyze a video's comments on demand.

### Other YouTube scrapers you might like

Combine this Actor with the rest of the YouTube toolkit:

- 📺 [YouTube Channel Scraper](https://apify.com/agentflow/youtube-channel-scraper) — list every video from a channel
- 🎬 [YouTube Shorts Scraper](https://apify.com/agentflow/youtube-shorts-scraper) — pull every Short from a channel
- 📝 [YouTube Transcript Scraper](https://apify.com/agentflow/youtube-transcript-scraper) — grab subtitles and captions

### Error handling

When a video's comments cannot be scraped, the Actor pushes an item with an `error` field instead of failing the whole run, so a single bad input never blocks the rest of your batch.

| Error | Meaning |
|-------|---------|
| `Invalid YouTube URL` | The input string is not a recognizable video URL |
| `Comments disabled or unavailable` | The video exists but has comments turned off |
| `Video unavailable` | The video is private, deleted, or region-blocked |

### ❓ FAQ

#### How many comments can I scrape?

Set `maxComments` to 0 to scrape all comments. Popular videos may have millions of comments — use a reasonable limit to control cost and run time.

#### Does it support replies?

Yes. Enable `includeReplies` to fetch all reply threads. Note this significantly increases run time for videos with many replies.

#### How much does it cost?

Charged per comment scraped at **$0.25 per 1,000 comments** — among the lowest in the market. No browser means minimal compute cost.

#### What if comments are disabled?

The result will include video metadata but `comments` will be empty and an `error` field will indicate "Comments disabled or unavailable".

#### Is scraping YouTube comments legal?

Scraping publicly available data is generally legal. This Actor only accesses public comments that anyone can view without logging in. You are responsible for how you use the data — follow YouTube's Terms of Service and applicable laws such as GDPR when handling author names and other personal data.

#### Do I need proxies to scrape YouTube comments?

No. The Actor runs over plain HTTP and works out of the box without proxies for typical use. For very large jobs you can optionally attach Apify Proxy to spread requests across IPs.

#### Can I use YouTube Comments Scraper with the API?

Yes. Every Actor on Apify is fully controllable through the [Apify API](https://docs.apify.com/api/v2) — start runs, pass input, and fetch results as JSON, CSV, or Excel from your own code, with official clients for Python and JavaScript.

#### Can I use YouTube Comments Scraper through an MCP server?

Yes. You can expose this Actor to AI agents and LLMs (Claude, ChatGPT, and others) through the [Apify MCP server](https://mcp.apify.com), so an agent can fetch and analyze a video's comments as a tool call.

YouTube Comments Scraper · Youtube Comment Scraper · YouTube Comments Scrapper · YouTube Comments API · Export YouTube Comments & Replies · Extract Video Comments · Scrape YouTube Comments · YouTube Comment Extractor · YouTube Comments Downloader · YouTube Comment Crawler

# Actor input Schema

## `urls` (type: `array`):

List of YouTube video URLs to scrape comments from.

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

Maximum number of top-level comments to extract per video. Set to 0 for all comments (may take a long time for popular videos).

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

Fetch replies for each comment. Significantly increases run time for videos with many replies.

## Actor input object example

```json
{
  "urls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "maxComments": 100,
  "includeReplies": false
}
```

# 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 = {
    "urls": [
        "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    ]
};

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

# Run the Actor and wait for it to finish
run = client.actor("agentflow/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 '{
  "urls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ]
}' |
apify call agentflow/youtube-comments-scraper --silent --output-dataset

```

## MCP server setup

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