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

Scrape YouTube video comments: text, author, likes, reply count, timestamps. Pure HTTP, no browser, no proxy needed. Cheap per-comment pricing.

- **URL**: https://apify.com/seasoned_seaurchin/youtube-comments-scraper.md
- **Developed by:** [Z Michael](https://apify.com/seasoned_seaurchin) (community)
- **Categories:** Social media, Videos
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.40 / 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/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 from any YouTube video — text, author, likes, reply count and publish time — as clean structured data.

Use it for sentiment analysis, audience research, creator analytics, or building text datasets for LLM training.

### What you get

- **Up to 5,000 comments per video** — paginates automatically
- **One item per video** — metadata plus a `comments` array, so you keep the video context
- **No API key, no proxy setup** — nothing to configure beyond the video URLs
- **~5 seconds per video** for 100 comments

### Example output

```json
{
  "videoId": "dQw4w9WgXcQ",
  "title": "Rick Astley - Never Gonna Give You Up",
  "commentCount": 100,
  "pagesScraped": 4,
  "comments": [
    {
      "commentId": "UgzKYksqeQ5gA3t0g0F4AaABAg",
      "text": "Gonna flag this for nudity so I can rick roll the YouTube staff",
      "author": "@grustache4569",
      "authorChannelId": "UC...",
      "isVerified": false,
      "isCreator": false,
      "likes": "107K",
      "replies": "671",
      "publishedTime": "3 years ago"
    }
  ]
}
```

### Use cases

- **Sentiment analysis** — export comments and run them through any NLP model
- **Audience research** — what do viewers actually complain about or praise
- **Creator analytics** — comment volume and engagement per upload
- **Dataset building** — collect text corpora for training or evaluation
- **Product research** — mine launch videos and reviews for feature requests

### Input

| Field | Type | Description |
|---|---|---|
| Video URLs or IDs | array | YouTube URLs or 11-character video IDs. Multiple allowed. |
| Max comments per video | integer | 1–5,000. Default 100. |
| Content language | string | Interface language, affects relative dates. Default `en`. |

### Output fields

| Field | Example |
|---|---|
| videoId | dQw4w9WgXcQ |
| title | Rick Astley - Never Gonna Give You Up |
| commentCount | 100 |
| comments\[].text | Gonna flag this for nudity... |
| comments\[].author | @grustache4569 |
| comments\[].likes | 107K |
| comments\[].replies | 671 |
| comments\[].publishedTime | 3 years ago |
| comments\[].isVerified | false |
| comments\[].isCreator | false |

### Pricing

Pay per comment: **$0.0004 per comment**.

- 100 comments = **$0.04**
- 1,000 comments = **$0.40**
- 10,000 comments across 100 videos = **$4.00**

Only comments actually delivered are charged. A video with comments disabled costs nothing.

### FAQ

**Do I need a YouTube Data API key?**
No. There is nothing to register and no quota limit.

**What happens if a video has comments disabled?**
That video returns an item with `error: "comments_disabled"` and you are not charged for it.

**Top-level comments or replies too?**
Top-level comments only. Each comment includes a `replies` count so you know which threads have discussion worth opening manually.

**Why is `likes` a string like "107K"?**
That is how YouTube renders it. Parse to a number if you need arithmetic.

**Can I scrape the same video repeatedly?**
Yes. Note that YouTube returns comments in its own order, so results can shift between runs.

**Does it work for any language?**
Yes. Text is returned as-is; the language field only affects relative date formatting.

### Related Actors

- [YouTube Search Scraper](https://apify.com/seasoned_seaurchin/youtube-search-scraper) — find the videos worth scraping first
- [YouTube Channel Videos Scraper](https://apify.com/seasoned_seaurchin/youtube-channel-videos-scraper) — get a channel's full upload list
- [YouTube Transcript Scraper](https://apify.com/seasoned_seaurchin/youtube-transcript) — pair comments with what was actually said

### Monitor Mode (daily incremental runs)

Set **Only new items = true** to turn this scraper into a monitor. It remembers what was already delivered for each query/video/channel and returns only **new items since the last run**.

How it works:

1. **First run** = baseline, returns everything
2. **Every run after** = returns only the delta (new comments / newly listed videos)
3. **No new data** = empty dataset, **you are not charged** (pay-per-result billing only fires on delivered items)
4. Combine with [Apify Schedules](https://docs.apify.com/schedule) to run it daily or hourly

Optional **Webhook URL**: whenever new items are found, the actor POSTs a JSON payload — `{event, source, newCount, scannedCount, sample, at}` — to your endpoint (Slack webhook, n8n, Make, your own API). Nothing is sent when there is no new data; failed deliveries never fail the run.

Typical use cases: track brand mentions in new YouTube comments, alert on newly published videos matching a keyword, watch a competitor channel for fresh uploads — without re-paying for data you already have.

# Actor input Schema

## `videoIds` (type: `array`):

YouTube video URLs or 11-character video IDs. Example: https://www.youtube.com/watch?v=dQw4w9WgXcQ

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

Maximum number of top-level comments to collect per video.

## `language` (type: `string`):

Preferred interface language for the requests (affects relative dates).

## `onlyNew` (type: `boolean`):

Incremental mode: remember what was already delivered (per query/video/channel) and output only NEW items since the last run. The first run returns everything (baseline); subsequent runs return only the delta. With no new items the run finishes with an empty dataset and you are not charged.

## `notifyWebhook` (type: `string`):

If set, a POST request with JSON {event, source, newCount, scannedCount, sample, at} is sent whenever new items are found. Nothing is sent when there is no new data. Failed deliveries are logged but never fail the run.

## Actor input object example

```json
{
  "videoIds": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "maxComments": 100,
  "language": "en",
  "onlyNew": false
}
```

# Actor output Schema

## `comments` (type: `string`):

Comment threads per video.

# 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 = {
    "videoIds": [
        "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    ],
    "maxComments": 100,
    "language": "en",
    "onlyNew": false
};

// Run the Actor and wait for it to finish
const run = await client.actor("seasoned_seaurchin/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 = {
    "videoIds": ["https://www.youtube.com/watch?v=dQw4w9WgXcQ"],
    "maxComments": 100,
    "language": "en",
    "onlyNew": False,
}

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

```

## MCP server setup

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