# YouTube Comments Scraper – Comments, Replies, Likes & Authors (`azzarilabs/youtube-comments-scraper`) Actor

Scrape public YouTube comments and replies with likes, authors, TOP or NEWEST sorting, and structured exports.

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

## Pricing

$0.60 / 1,000 comment 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/actors/running/actors-in-store.md#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 Comments Scraper – Comments, Replies, Likes & Authors

**YouTube Comments Scraper** extracts public comments and replies from one video or a batch of videos without a user-supplied API key. It follows the public YouTube web client's HTTP/InnerTube continuation flow and writes clean, exportable rows to an Apify Dataset.

Use it to scrape YouTube comments, turn public YouTube comment data into a structured YouTube comment export, inspect public author signals, compare TOP with NEWEST results, and collect replies linked to their parent comments. This is a focused YouTube comment extractor and a practical HTTP-based YouTube comments API alternative for public videos.

### What it delivers

Each valid Dataset row contains:

- video ID, title, channel name, and direct comment URL;
- comment ID and text;
- author name, public channel ID, and thumbnail when available;
- observed likes and reply count;
- YouTube's published-time label;
- pinned, hearted, creator, and verified signals when exposed;
- `parent_comment_id` and `reply_level` for YouTube replies;
- selected `TOP` or `NEWEST` sort and row warnings.

Unavailable optional values are `null`. The Actor does not invent an exact publication date when YouTube only supplies relative text such as `3 hours ago`.

### Input

Provide `video_urls`, `video_ids`, or both. The Actor validates in Python that at least one is present and deduplicates all video IDs while preserving their first-seen order.

```json
{
  "video_urls": ["https://www.youtube.com/watch?v=dQw4w9WgXcQ"],
  "max_comments": 25,
  "sort": "TOP",
  "include_replies": true,
  "max_replies_per_comment": 5,
  "max_videos": 10
}
```

`max_comments` is the maximum total rows per video, including replies. Supported URL shapes include watch, youtu.be, Shorts, Live, and embed links. One run accepts at most 25 unique videos and 2,000 results per video.

### Outputs

- **Dataset** — one record per valid comment or reply, ready for JSON, CSV, Excel, XML, and other Apify exports.
- **OUTPUT** — run status, requested/completed videos, counts, deterministic summary metrics, warnings, and storage references.
- **REPORT.html** — responsive report with videos, channels, comment table, likes, replies, public creator/pinned/hearted signals, most-liked comments, warnings, and methodology.

Summary metrics include delivered top-level comments and replies, public signal counts, comments with replies, observed likes, most-liked delivered comments, and reply share. No sentiment analysis, demographic inference, toxicity classification, topic extraction, authenticity score, or invented engagement rate is performed.

### Acquisition and reliability

The Actor uses only public HTTP requests:

1. load the public watch page;
2. read the public web client's InnerTube configuration and video metadata;
3. open the comments continuation;
4. select YouTube's TOP or NEWEST continuation;
5. paginate comments and optionally replies;
6. deduplicate by `video_id + comment_id`.

Requests use explicit 15-second timeouts and two short retries for transient failures. A failed video is isolated so other videos in the batch can still finish. There is no browser or Playwright fallback, login, user-supplied API key, paid API, proxy, or external paid service.

Private, removed, age-restricted, regional, or otherwise unavailable videos may return no results. Comments-disabled videos return a clean empty result with a warning. YouTube's TOP order is dynamic, abbreviated like counts are normalized, and InnerTube is an unofficial public web interface that may change.

### Billing

The prepared PPE event is `comment-result`. It is emitted only after a valid comment or reply is delivered to the Dataset. Empty content, duplicates, errors, timeouts, unavailable videos, comments-disabled videos, metadata, OUTPUT, and REPORT are not billable. The event price remains unset until a real Cloud cost is measured.

### Free-user friendly sample

The default evergreen sample uses one public video, 25 total results, TOP order, and at most five replies per parent. It requires no secret or external setup and is designed to finish comfortably inside five minutes.

### Responsible use

Scrape only public information and follow applicable laws, platform terms, and privacy requirements. Public availability does not remove your responsibility to use personal data lawfully.

# Actor input Schema

## `video_urls` (type: `array`):

Public YouTube watch, Shorts, Live, embed, or youtu.be URLs. You may also use Video IDs below.

## `video_ids` (type: `array`):

Optional 11-character YouTube video IDs. At least one URL or ID is required.

## `max_comments` (type: `integer`):

Maximum total Dataset rows per video, including replies when enabled.

## `sort` (type: `string`):

Use YouTube's TOP or NEWEST comment ordering.

## `include_replies` (type: `boolean`):

Follow reply continuations and add valid replies to the Dataset within the per-video limit.

## `max_replies_per_comment` (type: `integer`):

Maximum replies collected from each top-level comment; set 0 to skip reply collection.

## `max_videos` (type: `integer`):

Safety limit for unique videos accepted in one run.

## Actor input object example

```json
{
  "video_urls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "max_comments": 25,
  "sort": "TOP",
  "include_replies": true,
  "max_replies_per_comment": 5,
  "max_videos": 10
}
```

# Actor output Schema

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

No description

## `output` (type: `string`):

No description

## `report` (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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("azzarilabs/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 = {}

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

```

## MCP server setup

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