# YouTube Comment Scraper (`data_dino/yt-comments`) Actor

💰 $0.50 per 1000 comments❗ Extract YouTube video comments into structured datasets with author details, timestamps, like counts, and reply threads — ready for sentiment analysis, audience research, and content strategy.

- **URL**: https://apify.com/data\_dino/yt-comments.md
- **Developed by:** [Data Dino](https://apify.com/data_dino) (community)
- **Categories:** Automation, Social media, Videos
- **Stats:** 2 total users, 1 monthly users, 83.3% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.50 / 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.

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 Comment Extractor

Extract YouTube video comments into structured, analysis-ready datasets. This Apify actor collects top-level comments, author details, timestamps, like counts, and threaded replies — delivering each comment as a structured dataset item ready for sentiment analysis, audience research, and content strategy workflows.

It is designed for teams that need to understand audience reactions, track engagement trends, compare competitor content, or build dependable research datasets from YouTube comments without manually scrolling through every video.

### Why use this actor?

- **Cost-conscious extraction** — submit only the videos you care about instead of paying for channel-wide crawling.
- **Batch-friendly performance** — process multiple video URLs in one run, with execution designed to maintain useful throughput as the workload changes.
- **Rich comment signals** — collect author names, comment text, publication timestamps, like counts, and reply threads in one record.
- **Consistent dataset output** — every comment keeps its source video URL and follows the same predictable structure.
- **Apify-native workflow** — schedule runs, monitor progress, and export the resulting dataset in the formats your downstream workflow already uses.

### What you can collect

Each comment record may include the following publicly visible information:

| Category | Fields |
|---|---|
| Comment identity | Comment text, publication timestamp, like count |
| Author details | Author display name, author channel URL |
| Source context | Original video URL |
| Reply threads | Nested replies with the same structure as top-level comments |

The actor keeps the source video URL with every record, making it easy to trace a finding back to the originating video.

### Input

Provide one or more YouTube video URLs in `startUrls`. The field is required and accepts Apify request-list objects.

| Field | Type | Required | Description |
|---|---|---|---|
| `startUrls` | Array of objects | Yes | Video URLs to extract comments from. Each object uses the form `{ "url": "https://www.youtube.com/watch?v=..." }`. |
| `maxComments` | Integer | No | Maximum number of top-level comments per video (default: 100). |
| `includeReplies` | Boolean | No | Whether to include reply threads (default: true). |

#### Example input

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

### Output

The actor pushes one dataset item for each extracted comment. A representative result looks like this:

```json
{
  "videoUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "commentId": "UgzDE2...",
  "authorName": "Example User",
  "authorChannelUrl": "https://www.youtube.com/channel/UC...",
  "text": "This is a sample comment.",
  "publishedAt": "2024-01-15T10:30:00Z",
  "likeCount": 42,
  "replyCount": 3,
  "replies": [
    {
      "authorName": "Reply User",
      "text": "I agree!",
      "publishedAt": "2024-01-15T11:00:00Z",
      "likeCount": 5
    }
  ]
}
```

### Built for practical workflows

- **Audience research** — understand viewer sentiment, common questions, and engagement patterns.
- **Content strategy** — identify what resonates with audiences by analyzing comment themes across videos.
- **Competitive analysis** — track engagement and sentiment on competitor content over time.
- **Brand monitoring** — collect feedback and reactions to your own video content at scale.
- **Research operations** — send the dataset to spreadsheets, warehouses, NLP pipelines, or internal dashboards.

### How to run

1. Open the actor in Apify.
2. Add one or more YouTube video URLs to `startUrls`.
3. Optionally adjust `maxComments` and `includeReplies`.
4. Start the run.
5. Review the dataset or export it as JSON, CSV, Excel, or another supported format.

### Important limitations

- The actor extracts publicly visible comments; it does not access private or unlisted video comments without appropriate access.
- YouTube may rate-limit or throttle comment loading for videos with very large comment sections.
- Results depend on the comments publicly displayed on each video at run time; deleted or moderated comments are not available.
- Comment threading depth is limited to one level of replies (reply-to-reply chains are flattened).
- Comment and author fields can change as YouTube updates its page structure.

Use the collected information in accordance with YouTube's terms of service, applicable privacy requirements, and your organization's data-use policies.

# Actor input Schema

## `startUrls` (type: `array`):

One or more YouTube video URLs from which to extract comments. Use full video URLs (e.g., https://www.youtube.com/watch?v=...).

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

Maximum number of top-level comments to extract per video. Leave empty for unlimited.

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

Whether to include replies to top-level comments.

## Actor input object example

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

# Actor output Schema

## `dataset` (type: `string`):

Structured YouTube comment records collected during the run.

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

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

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

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,data_dino/yt-comments"
        }
    }
}

```

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/hdYlwLbjhBqoJXxKO/builds/t2mpDYWqgMeK3mgMM/openapi.json
