# YouTube Comments Scraper ($0.40/1000 results) (`api-ninja/youtube-comments-scraper`) Actor

Export YouTube comments & replies to a structured dataset in minutes. Get author, text, likes, timestamps, and more—ready for analysis, dashboards, or archiving. Built for speed and reliability.

- **URL**: https://apify.com/api-ninja/youtube-comments-scraper.md
- **Developed by:** [API ninja](https://apify.com/api-ninja) (community)
- **Categories:** Automation, Social media, Videos
- **Features:** Limited permissions
- **Stats:** 610 total users, 55 monthly users, 100.0% runs succeeded, 26 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $0.40 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

A powerful Apify actor that extracts comments from YouTube videos with advanced filtering and customization options. Perfect for sentiment analysis, market research, content analysis, and social media monitoring.

### ✨ Features

- **🎯 Multi-Video Support**: Scrape comments from multiple YouTube videos in a single run
- **📊 Flexible Comment Limits**: Choose specific comment counts or extract all available comments
- **💬 Reply Extraction**: Include comment replies for comprehensive conversation analysis
- **🔄 Smart Sorting**: Order comments by "top" (most popular) or "newest" (most recent)
- **🌍 Localization**: Specify country and language for region-specific content
- **⚡ High Performance**: Optimized scraping with intelligent data extraction

### 🚀 Quick Start

#### Basic Usage

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

#### Advanced Configuration

```json
{
    "videoUrls": [
        "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
        "https://www.youtube.com/watch?v=9bZkp7q19f0"
    ],
    "commentsPerVideo": 500,
    "scrapeAllComments": false,
    "includeReplies": true,
    "orderBy": "top",
    "geo": "US",
    "lang": "en"
}
```

### 📋 Input Configuration

The actor accepts the following configuration parameters:

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| **videoUrls** | `array` | ✅ Yes | - | YouTube video URLs or video IDs to scrape. Supports both full URLs (`https://www.youtube.com/watch?v=VIDEO_ID`) and video IDs (`VIDEO_ID`) |
| **commentsPerVideo** | `integer` | ❌ No | `100` | Number of comments to extract per video. Ignored when `scrapeAllComments` is enabled. Minimum: 100 |
| **scrapeAllComments** | `boolean` | ❌ No | `false` | Extract all available comments from the video when enabled |
| **includeReplies** | `boolean` | ❌ No | `false` | Include comment replies (approximately 10 replies per comment) |
| **orderBy** | `string` | ❌ No | `top` | Sort comments by popularity: `top` or `newest` |
| **geo** | `string` | ❌ No | - | ISO 3166-2 country code (e.g., `US`, `GB`, `IN`) for region-specific results |
| **lang** | `string` | ❌ No | - | ISO 639-1 language code (e.g., `en`, `es`, `fr`) for localized content |

#### Input Validation

- `videoUrls` must contain at least one valid YouTube URL or video ID
- `geo` must be a valid 2-letter country code (uppercase)
- `lang` must be a valid 2-letter language code (lowercase)
- `commentsPerVideo` must be at least 100 when specified

### 📤 Output Structure

The actor generates a structured dataset with the following fields for each comment:

```json
{
    "commentId": "UgwYX91Z7rTb7a6jGux4AaABAg",
    "text": "This is an amazing video! Really helped me understand the concept better.",
    "published": "2 days ago",
    "likes": 42,
    "author": "John Doe",
    "authorThumb": "https://yt3.ggpht.com/ytc/AKedOLQexample",
    "authorId": "UC123456789012345678",
    "authorUrl": "/channel/UC123456789012345678",
    "isEdited": false,
    "isPinned": false,
    "replyCount": 3,
    "replyToken": "Eg0SC1Vnd1lXOTFaN3JUYjdhNmpHdXg0QWFBQUJBZw",
    "isReply": false
}
```

#### Field Descriptions

| Field | Type | Description |
|-------|------|-------------|
| **commentId** | `string` | Unique identifier for the comment |
| **text** | `string` | The comment content |
| **published** | `string` | Relative time when the comment was posted |
| **likes** | `integer` | Number of likes the comment received |
| **author** | `string` | Display name of the comment author |
| **authorThumb** | `string` | URL to the author's profile thumbnail |
| **authorId** | `string` | YouTube channel ID of the author |
| **authorUrl** | `string` | Relative URL to the author's channel |
| **isEdited** | `boolean` | Whether the comment has been edited |
| **isPinned** | `boolean` | Whether the comment is pinned by the creator |
| **replyCount** | `integer` | Number of replies to this comment |
| **replyToken** | `string` | Token for fetching replies (if applicable) |
| **isReply** | `boolean` | Whether this item is a reply to another comment |

### 🔧 Use Cases

#### Market Research

Analyze customer sentiment and feedback on product-related videos to understand market trends and user preferences.

#### Content Analysis

Study engagement patterns and popular discussion topics to optimize content strategy.

#### Academic Research

Collect data for social media analysis, communication studies, and behavioral research.

#### Competitor Monitoring

Track comments on competitor videos to gather insights about their audience engagement.

### 💰 How much does it cost to scrape YouTube comments?

This Actor uses **pay-per-event pricing**.

| Charge | Free plan | Bronze-Diamond plans |
| --- | ---: | ---: |
| Actor start | $0.01 | $0.01 |
| Result saved to the default dataset | $0.004 per result | $0.0004 per result |

The Actor start event is charged according to memory, at one event per GB with at least one event per run. The final cost depends mainly on how many comment and reply records are saved. Apify requires a maximum-charge limit of at least **$0.10 per run**; this is a spending cap, not a minimum fee. Test one or two videos with a limited comment count and check the Actor's **Pricing** tab before a large run.

### 🔌 Integrations

This actor seamlessly integrates with popular automation platforms:

- **[Make](https://www.make.com)**: Create automated workflows with YouTube comment data
- **[Zapier](https://zapier.com)**: Connect YouTube comments to 3000+ apps
- **[Google Sheets](https://sheets.google.com)**: Direct export to spreadsheets for analysis
- **[Airtable](https://airtable.com)**: Organize comment data in relational databases

### 🛠 Other YouTube Scraping Tools

If you like this Actor, you might also find these YouTube tools useful:

- 📥 **[YouTube Video Downloader](https://apify.com/api-ninja/youtube-video-downloader)**: Download video or audio and receive direct media links.
- 🔍 **[YouTube Search Scraper](https://apify.com/api-ninja/youtube-search-scraper)**: Discover videos, channels, playlists, and Shorts by keyword.
- 📺 **[YouTube Channel Scraper](https://apify.com/api-ninja/youtube-channel-scraper)**: Extract videos, Shorts, playlists, livestreams, and posts from channels.
- 📝 **[YouTube Transcript Scraper](https://apify.com/api-ninja/youtube-transcript-scraper)**: Turn video URLs or IDs into structured transcript data.

### ⚠️ Important Notes

- **Rate Limiting**: The actor implements intelligent delays to respect YouTube's rate limits
- **Comment Availability**: Some videos may have comments disabled or limited by the creator
- **Reply Limitations**: Approximately 10 replies per comment are extracted to balance completeness and performance
- **Geographic Restrictions**: Some content may be region-restricted based on `geo` and `lang` settings

### 🤝 Support

For questions, bug reports, or feature requests drop an issue on the page.

**Built with ❤️**

# Actor input Schema

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

An array of YouTube video URLs or video IDs to scrape comments from. You can input full URLs like 'https://www.youtube.com/watch?v=9bZkp7q19f0' or just video IDs like 'e-ORhEE9VVg'.

## `commentsPerVideo` (type: `integer`):

Number of comments to scrape per video. If 'Scrape all comments' is enabled, this will be ignored.

## `scrapeAllComments` (type: `boolean`):

If enabled, all comments from the video will be scraped.

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

If enabled, replies to comments will be included. Only about 10 replies per comments will be parsed.

## `orderBy` (type: `string`):

The order to scrape comments by.

## `geo` (type: `string`):

ISO 3166-2 country code (e.g., US, GB, IN).

## `lang` (type: `string`):

Language code (e.g., en, es, fr).

## Actor input object example

```json
{
  "videoUrls": [
    "https://www.youtube.com/watch?v=9bZkp7q19f0",
    "e-ORhEE9VVg"
  ],
  "commentsPerVideo": 100,
  "scrapeAllComments": false,
  "includeReplies": false,
  "orderBy": "top"
}
```

# Actor output Schema

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

No description

# 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=9bZkp7q19f0",
        "e-ORhEE9VVg"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("api-ninja/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=9bZkp7q19f0",
        "e-ORhEE9VVg",
    ] }

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

```

## MCP server setup

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