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

Comments and replies of YouTube videos, playlists and channels: text, author, likes, replies, pinned and creator hearts, video metadata. Top or newest first, date cut. A row per video says why when there are none. No login, no browser.

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

## Pricing

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

Comments and replies of any YouTube video, Short, playlist or channel, straight from YouTube's own app API: the text, the author (name, channel, avatar, verified, creator), likes, reply count, when it was posted, whether it is pinned or hearted by the creator, and the video's title, channel, views, likes and total comment count on every row. Top comments or newest first, an optional date cut, replies on request. **Every video comes back as rows**: when it has no comments to give, one free row says why (`comments_off`, `no_comments`, `unavailable`, `blocked`) instead of an empty dataset. You pay only for comments.

No browser, no login, no API key, no YouTube Data API quota: it asks the same endpoint the site uses, paces itself, and rotates IPs before YouTube's bot check shows up.

### What you get

One row per comment, in YouTube's order for the sort you chose:

- **The comment**: `commentId`, `text` (emoji included), `publishedTimeText` (YouTube only says "3 weeks ago") and `publishedAt` (that phrase counted back from `scrapedAt`), `isEdited`, `likeCount` (with `likeCountText`, since YouTube abbreviates "4.8M"), `replyCount`, `isPinned`, `isHeartedByCreator`, `url` (the watch page opened on that comment).
- **The author**: `author` (handle), `authorChannelId`, `authorUrl`, `authorAvatarUrl`, `authorIsVerified`, `authorIsCreator` (the video's own channel), `authorIsArtist`.
- **Replies** (`includeReplies`): rows with `isReply` true and `parentCommentId`; `rank` counts within the thread.
- **The video**, on every row: `videoId`, `videoUrl`, `videoTitle`, `channelName`, `channelId`, `videoPublishDate`, `videoViewCount`, `videoLikeCount`, `videoCommentCount`.
- **What was asked**: `sortBy`, `rank`, `source` (the video, playlist or channel the row came from), `scrapedAt`.
- **`status` and `reason`**: `ok`, or one free row per video with `comments_off` ("Comments are turned off"), `no_comments` (nobody commented yet), `unavailable` (the video does not exist or is private), `blocked` (every IP route was refused; try again later).

### Input

| field | what it does |
|---|---|
| `urls` | One per line: a video link in any shape (`watch?v=`, `youtu.be`, Shorts, live, embed) or a bare id; a playlist link or id; a channel (`@handle`, `/channel/UC…`, `/c/`, `/user/`). Playlists and channels expand to their videos. |
| `maxCommentsPerVideo` | Top-level comments per video (default 100, up to 100,000). YouTube pages by 20. |
| `sortBy` | `top` (YouTube's default) or `newest`. |
| `includeReplies`, `maxRepliesPerComment` | Read the replies under each comment (default off; 50 per comment when on). |
| `publishedAfter` | `YYYY-MM-DD`: walk newest first and stop at the first older comment. As exact as YouTube's "3 weeks ago". |
| `maxVideosPerSource` | How many videos to take from each playlist or channel (default 20). |
| `residentialFallback` | Retry through residential proxies when YouTube refuses the datacenter IPs. Default on. |

```json
{
    "urls": ["https://www.youtube.com/watch?v=jNQXAC9IVRw", "@TED"],
    "maxCommentsPerVideo": 200,
    "sortBy": "top",
    "includeReplies": true,
    "maxRepliesPerComment": 20,
    "maxVideosPerSource": 5
}
```

### Output example

```json
{
    "videoId": "jNQXAC9IVRw",
    "videoUrl": "https://www.youtube.com/watch?v=jNQXAC9IVRw",
    "status": "ok",
    "reason": null,
    "videoTitle": "Me at the zoo",
    "channelName": "jawed",
    "channelId": "UC4QobU6STFB0P71PMvOGN5A",
    "videoPublishDate": "2005-04-23T20:31:52-07:00",
    "videoViewCount": 433550174,
    "videoLikeCount": 19873706,
    "videoCommentCount": 10625130,
    "sortBy": "top",
    "rank": 1,
    "commentId": "UgzuC3zzpRZkjc5Qzsd4AaABAg",
    "parentCommentId": null,
    "isReply": false,
    "text": "We're so honored that the first ever YouTube video was filmed here!",
    "author": "@SanDiegoZoo",
    "authorChannelId": "UCC5NfQ6Mf0dq_eEwv4P_hWA",
    "authorUrl": "https://www.youtube.com/@SanDiegoZoo",
    "authorAvatarUrl": "https://yt3.ggpht.com/…",
    "authorIsVerified": true,
    "authorIsCreator": false,
    "authorIsArtist": false,
    "publishedTimeText": "6 years ago",
    "publishedAt": "2020-09-18T21:00:00.000Z",
    "isEdited": false,
    "likeCount": 4800000,
    "likeCountText": "4.8M",
    "replyCount": 985,
    "isPinned": true,
    "isHeartedByCreator": true,
    "url": "https://www.youtube.com/watch?v=jNQXAC9IVRw&lc=UgzuC3zzpRZkjc5Qzsd4AaABAg",
    "source": { "type": "video", "id": "jNQXAC9IVRw" },
    "scrapedAt": "2026-09-18T21:00:00.000Z"
}
```

### Use cases

- **Sentiment and audience research**: every comment of a launch video, a campaign or a competitor's channel, with likes to weigh them.
- **Brand monitoring**: the newest comments of your channel's last videos on a schedule, with `publishedAfter` so each run only brings what is new.
- **Creator tools**: pinned comments, creator hearts and reply threads, to see which comments the channel engages with.
- **Datasets for NLP and LLMs**: clean text with author and engagement fields, thousands of comments per minute.

### Limits and honesty

- YouTube gives comments the way its page does: **dates are relative** ("3 weeks ago") and **like counts abbreviated** above 1,000 ("4.8M"). `publishedAt` and `likeCount` are those phrases turned into numbers, exact to the unit YouTube used.
- YouTube's "top" order is its own ranking and can differ slightly between runs; "newest" is stable.
- A pinned comment comes first in both orders, whatever its date; with `publishedAfter` it is judged on its own and never stops the walk.
- Comment counts on the video (`videoCommentCount`) include replies; `maxCommentsPerVideo` counts top-level comments only.
- YouTube refuses some datacenter IPs. The Actor retries through residential proxies (about 1.5 KB per comment of proxy traffic) and marks a video `blocked` only when every route was refused; those rows are free.

### Pricing

Pay per event: one `comment` event per row with status `ok`, replies included, and nothing per video. Rows with any other status are free, and so is every request that gave nothing. Set a spending limit on the run and the Actor stops at it.

### Legal

The Actor reads public comments that YouTube shows to anyone without logging in. Comments carry the author's public handle and channel id; use the data in line with YouTube's terms and the privacy law that applies to you.

# Actor input Schema

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

One per line: a video link in any shape (<code>watch?v=</code>, <code>youtu.be</code>, Shorts, live, embed) or a bare video id; a playlist link or id; a channel link (<code>@handle</code>, <code>/channel/UC…</code>, <code>/c/</code>, <code>/user/</code>) or a bare <code>@handle</code>. A playlist or channel expands to its videos, newest first for channels.

## `maxCommentsPerVideo` (type: `integer`):

Top-level comments to read per video, in the order chosen below (YouTube pages by 20). Replies are counted apart.

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

YouTube's own two orders: <code>top</code> (what the page shows first) or <code>newest</code>.

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

Also read the replies of each comment (one request per 10 replies). Reply rows have <code>isReply</code> true and <code>parentCommentId</code>.

## `maxRepliesPerComment` (type: `integer`):

With replies on: how many replies to read under each comment.

## `publishedAfter` (type: `string`):

<code>YYYY-MM-DD</code>. Walks the comments newest first (the order switches to <code>newest</code>) and stops at the first older one. YouTube only says "3 weeks ago", so the cut is as exact as that.

## `maxVideosPerSource` (type: `integer`):

Stop expanding each playlist or channel after this many videos. Videos given directly are not counted.

## `residentialFallback` (type: `boolean`):

A video refused on the direct route and on a datacenter proxy is retried through Apify's residential proxy (about 1.5 KB per comment, charged by Apify as proxy traffic). Off: such videos end with status <code>blocked</code>.

## Actor input object example

```json
{
  "urls": [
    "https://www.youtube.com/watch?v=jNQXAC9IVRw"
  ],
  "maxCommentsPerVideo": 50,
  "sortBy": "top",
  "includeReplies": false,
  "maxRepliesPerComment": 50,
  "maxVideosPerSource": 20,
  "residentialFallback": true
}
```

# Actor output Schema

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

No description

## `summary` (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 = {
    "urls": [
        "https://www.youtube.com/watch?v=jNQXAC9IVRw"
    ],
    "maxCommentsPerVideo": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("steadyscrape/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=jNQXAC9IVRw"],
    "maxCommentsPerVideo": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("steadyscrape/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=jNQXAC9IVRw"
  ],
  "maxCommentsPerVideo": 50
}' |
apify call steadyscrape/youtube-comments-scraper --silent --output-dataset

```

## MCP server setup

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