# YouTube Comments Scraper - Fast & Cheap (`aolmo/youtube-comments`) Actor

Exports the comments of any YouTube video as clean rows: author, text, likes, reply count, date, pinned and verified flags, with optional replies. Top or newest first. No browser, no API key, no quota. $0.0005 per comment; new comments flagged on scheduled runs.

- **URL**: https://apify.com/aolmo/youtube-comments.md
- **Developed by:** [Antonio del Olmo Tena](https://apify.com/aolmo) (community)
- **Categories:** Social media, Videos
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

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

Get the comments of any YouTube video as clean, structured rows. Paste video URLs or ids and the Actor returns one row per comment with author, text, likes, reply count, date, pinned, creator and verified flags, and optionally the replies of each comment. Choose YouTube's top ranking or newest first, and schedule it to catch new comments as they arrive.

No browser, no proxies on your side, no YouTube API key and no daily quota: the Actor reads the same internal endpoints the YouTube website uses, so it is fast and cheap. You pay $0.0005 per comment returned.

### What you get

One Dataset row per comment:

- `text`, `url` (direct link to the comment), `id`.
- `authorName`, `authorChannelId`, `authorUrl`, `authorAvatarUrl`, `isVerified`, `isCreator` (comment by the video's own channel).
- `likes` and `likesText`, `replyCount`, `isPinned`, `isHearted` (hearted by the creator).
- `publishedText` (YouTube's relative date such as `1 year ago`) and `publishedAt`, an approximate ISO date computed from it.
- `parentId`: for replies, the id of the comment they answer; `null` for top-level comments.
- `video`, `videoId`, `videoTitle`, `channelName`: the video the comment belongs to.
- `isNew`: `true` when the comment was not in the previous run of that video.

A video that does not exist, is private, or has comments turned off produces no comment rows and is not charged (an unavailable video gives a single row with an `error` field).

### How to use it

1. Open the **Input** tab.
2. In **Videos** paste one video per line: `https://www.youtube.com/watch?v=dQw4w9WgXcQ`, `https://youtu.be/dQw4w9WgXcQ` or just `dQw4w9WgXcQ`.
3. Pick the **Order**: top comments (YouTube's ranking) or newest first.
4. Set **Max comments per video** (default 200) and switch on **Include replies** if you want the full threads.
5. Click **Start**. Read the rows in **Output** or export them as JSON, CSV or Excel.
6. To monitor a video, schedule the Actor with the order set to newest. Every run compares with the previous one and new comments come with `isNew: true`. Connect a webhook or an email integration to be notified.

### Input

```json
{
  "videos": ["https://www.youtube.com/watch?v=dQw4w9WgXcQ"],
  "sortBy": "top",
  "maxComments": 200,
  "includeReplies": false
}
```

| Field            | Description |
|------------------|-------------|
| `videos`         | Video URLs or ids. Up to 50 per run. |
| `sortBy`         | `top` (default) or `newest`. |
| `maxComments`    | Per video, 1 to 5,000. Replies count toward it when included. Default 200. |
| `includeReplies` | Also fetches each comment's replies, with `parentId` set. Default off. |

### Output example

```json
{
  "video": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "videoId": "dQw4w9WgXcQ",
  "videoTitle": "Rick Astley - Never Gonna Give You Up (Official Video) (4K Remaster)",
  "channelName": "Rick Astley",
  "id": "Ugzge340dBgB75hWBm54AaABAg",
  "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ&lc=Ugzge340dBgB75hWBm54AaABAg",
  "text": "can confirm: he never gave us up",
  "authorName": "@YouTube",
  "authorChannelId": "UCBR8-60-B28hp2BmDPdntcQ",
  "authorUrl": "https://www.youtube.com/@YouTube",
  "authorAvatarUrl": "https://yt3.ggpht.com/...",
  "isVerified": true,
  "isCreator": false,
  "isPinned": true,
  "isHearted": true,
  "likes": 323000,
  "likesText": "323K",
  "replyCount": 962,
  "publishedText": "1 year ago",
  "publishedAt": "2025-10-04T09:30:00.000Z",
  "parentId": null,
  "isNew": false,
  "timestamp": "2026-10-04T09:30:00.000Z"
}
```

### Pricing

Pay per event, no subscription:

- **Comment scraped**: $0.0005 per comment row. 1,000 comments cost $0.50.
- **New comment**: $0.001 per comment flagged as new in a scheduled run. Runs with nothing new only pay for the rows.

Videos that cannot be read are free. Compare with typical YouTube comment scrapers at $0.0009 to $0.005 per comment.

### Use it as an API

Run it from your code with the Apify API or client libraries:

```bash
curl -X POST "https://api.apify.com/v2/acts/aolmo~youtube-comments/run-sync-get-dataset-items?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"videos": ["dQw4w9WgXcQ"], "maxComments": 500, "sortBy": "newest"}'
```

The response is the list of comment rows. You can also call it from AI agents through the Apify MCP server. For the videos of a channel use `aolmo/youtube-videos`, and for transcripts `aolmo/youtube-transcript`.

### FAQ

**Are the like counts exact?** YouTube shows rounded figures for large numbers (`323K`), and `likes` is the rounded number. Small counts are exact.

**How precise is `publishedAt`?** It is computed from YouTube's relative text, so `2 days ago` becomes a timestamp two days before the run. Use it for ordering and filtering, not as the exact posting time.

**Can I get all comments of a very popular video?** Up to 5,000 per video per run. Comments are read in pages of 20, so 5,000 comments take about 250 requests.

**What about the replies?** Switch on **Include replies**: each thread with replies costs one extra request, and the replies come right after their parent with `parentId` set.

**Where is the data stored between runs?** In a Key-Value Store of your account named `micro-saas-state-youtube-comments`, one key per video. Delete it to start fresh.

# Actor input Schema

## `videos` (type: `array`):

One per line: video URL (watch, youtu.be, shorts) or the 11-character video id.

## `sortBy` (type: `string`):

Top comments (YouTube's default ranking) or newest first. Use newest to monitor new comments.

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

Replies count toward this limit when included. Also caps what you pay per video.

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

Also fetches the replies of each comment (one extra request per thread with replies). Replies carry the parent comment id in parentId.

## `product` (type: `string`):

Internal. Leave as is.

## Actor input object example

```json
{
  "videos": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "sortBy": "top",
  "maxComments": 200,
  "includeReplies": false,
  "product": "youtube-comments"
}
```

# Actor output Schema

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

Dataset items: url, changed, events, data, timestamp and error (when the target failed).

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

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

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

```

## MCP server setup

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