# YouTube Comments Scraper – Comments & Replies, No API Key (`filexy634/youtube-comments-scraper`) Actor

Scrape comments from any YouTube video as clean JSON: text, author, likes, reply counts, pinned and creator-hearted flags. Sort by top or newest, include replies, and set a limit per video. No API key, quotas or login. You pay only for comments returned.

- **URL**: https://apify.com/filexy634/youtube-comments-scraper.md
- **Developed by:** [felix gerald](https://apify.com/filexy634) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 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 & Replies, No API Key

Collect the comments on any YouTube video as clean, flat JSON, with replies, like counts and creator signals. No YouTube API key, no daily quota, no login.

### What you get per comment

- **Text and author:** comment text, author name, channel ID and URL, avatar, verified badge, and whether the author is the video's channel owner.
- **Engagement:** like count and number of replies.
- **Creator signals:** pinned by the creator, hearted by the creator.
- **Time:** YouTube's relative time ("3 weeks ago"), an approximate ISO date computed from it, and an edited flag.
- **Replies:** optional. Each reply is its own item with `type: "reply"` and a `parentCommentId`, so you can rebuild threads or analyze replies separately.

### Controls

- **Max comments per video**, from a handful up to 20,000.
- **Sort:** top comments (YouTube's ranking) or newest first.
- **Replies:** on or off, with a per-comment limit.
- **Author details:** turn them off if you only need text and metrics, for example for sentiment analysis, so no personal identifiers are collected.
- Several videos per run; every item carries its `videoId`.

### Input

| Field | Description |
|---|---|
| `videoUrls` | Watch, youtu.be, shorts, embed or live links, or bare video IDs |
| `maxComments` | Top-level comments per video (default 100) |
| `sortBy` | `top` or `newest` |
| `includeReplies`, `maxRepliesPerComment` | Collect replies and cap them per comment |
| `includeAuthorDetails` | Include names, channel IDs and avatars (default on) |
| `proxyConfiguration` | Residential proxies recommended |

### Output example

```json
{
  "status": "ok",
  "type": "comment",
  "videoId": "dQw4w9WgXcQ",
  "commentId": "Ugx…",
  "text": "Great video!",
  "author": "@alice",
  "likesCount": 1200,
  "replyCount": 3,
  "publishedTimeText": "2 years ago",
  "approxPublishedAt": "2024-10-23T00:00:00.000Z",
  "isPinned": true,
  "isHeartedByCreator": true
}
```

### Pricing

Charged per comment or reply returned. Videos that fail (comments turned off, unavailable, blocked) are reported with a clear reason and are free.

### Proxies

YouTube blocks data-center IP addresses. Use residential proxies (the default input does). If a request is blocked, the Actor retries from a new IP and keeps going from where it left off.

### Limitations

- YouTube only shows relative times, so dates are approximate, and less precise for older comments.
- Like counts above 1,000 are rounded by YouTube (for example 1.2K is returned as 1200).
- Very popular videos stop paging before the full total, and newest-first paging can end sooner than top-first.
- Comments turned off, private videos, live chat and community posts are not supported.
- YouTube changes its internal formats from time to time, which can briefly reduce success rates until the Actor is updated.
- Comments contain personal data (names, channel IDs). Collect it only for a legitimate purpose, consider switching off author details, and follow YouTube's terms and laws such as GDPR.

# Actor input Schema

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

YouTube videos, one per line. Accepts watch, youtu.be, shorts, embed and live links, or bare 11-character video IDs.

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

Maximum number of top-level comments to collect per video. Replies are extra and limited separately.

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

Top comments (YouTube's default ranking) or newest first. Newest-first paging can end sooner on very popular videos.

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

Also collect replies under each comment. Each reply is returned as its own item linked to its parent.

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

Only used when replies are included.

## `includeAuthorDetails` (type: `boolean`):

Include each commenter's name, channel ID, channel URL and avatar. Turn off if you only need the comment text and metrics, for example for sentiment analysis, to avoid collecting personal data.

## `pageDelaySecs` (type: `number`):

Pause between page requests for the same video. Higher values reduce blocking.

## `maxConcurrency` (type: `integer`):

How many videos are processed in parallel.

## `proxyConfiguration` (type: `object`):

YouTube blocks data-center IPs, so residential proxies are strongly recommended. You can also supply your own proxy URLs.

## Actor input object example

```json
{
  "videoUrls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "maxComments": 100,
  "sortBy": "top",
  "includeReplies": false,
  "maxRepliesPerComment": 5,
  "includeAuthorDetails": true,
  "pageDelaySecs": 0.5,
  "maxConcurrency": 3,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

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

Dataset of YouTube comments and replies.

# 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=dQw4w9WgXcQ"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("filexy634/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=dQw4w9WgXcQ"],
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("filexy634/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=dQw4w9WgXcQ"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call filexy634/youtube-comments-scraper --silent --output-dataset

```

## MCP server setup

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