# YouTube Comments & Replies Scraper (`wyle/youtube-comments-scraper`) Actor

Fetch public YouTube video comments and nested replies by video URL or ID. Supports Top or Newest sorting with author channels, like counts, heart badges, and timestamps cleanly.

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

## Pricing

from $0.40 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 & Replies Scraper

Extract public YouTube comments, nested replies, like counts, author channel details, and pinned or creator-hearted badges in a clean, structured dataset. Runs fast and lightweight without a browser, YouTube login, or YouTube API quota limits.

### Modes

| Mode | Input | What you get |
|---|---|---|
| **Top-Level Comments** | `videoUrlsOrIds` + `sortBy` (`"top"` or `"newest"`) | Ordered top-level comments with video metadata, author details, like counts, and badges |
| **Comments + Nested Replies** | `includeReplies: true` + `maxRepliesPerComment` | Top-level comments with up to `maxRepliesPerComment` replies nested inside each comment's `replies` array |

### Supported Coverage

- **Video URL & ID Formats**: Standard `youtube.com/watch?v=...`, `youtu.be/...` short links, `youtube.com/shorts/...`, `youtube.com/live/...`, `youtube.com/embed/...`, and bare 11-character video IDs.
- **Comment & Reply Fields**: `commentId`, `commentUrl`, `text`, `publishedTimeText`, `likeCount` (integer) + `likeCountText`, `replyCount`, `isPinned`, `isHeartedByCreator`, `isEdited`, and `sortBy`.
- **Author & Video Metadata**: `authorName`, `authorChannelId`, `authorChannelUrl`, `authorAvatarUrl`, `isAuthorVerified`, `isAuthorCreator`, `isAuthorArtist`, `videoId`, `videoTitle`, `channelName`, `channelId`, and `totalVideoCommentsText`.

### Output Options & Proxy Tips

- **Sorting & Limits**: Sort comments by `"top"` (default) or `"newest"` via `sortBy`. Set `maxCommentsPerVideo` (`1`–`50,000`, default `100`) and `maxRepliesPerComment` (`0`–`500`, default `10`) to balance speed and depth.
- **Zero-Null Output**: Every field uses concrete typed values (`""`, `0`, `false`, `[]`) so downstream CSV exports and pipelines never hit missing-key errors. Videos with comments disabled return zero comment records.
- **Proxy Recommendations**: Direct connections work well for moderate runs. For large multi-video batches or heavy cloud workloads, enable Apify Proxy (`RESIDENTIAL` is used by default when enabled) via `proxyConfiguration`.

### Use Cases

1. **Product & Audience Feedback Research**: Analyze viewer questions, feature requests, and pain points on product reviews, tutorials, and launch videos.
2. **Creator & Competitor Benchmarking**: Track engagement patterns, creator-hearted responses, and top-comment sentiment across rival channels.
3. **AI & NLP Sentiment Datasets**: Feed clean comment threads and nested replies into LLM summarization, topic clustering, and toxicity/sentiment models.
4. **Community Moderation & Q\&A Mining**: Surface recurring viewer questions from long-form videos, Shorts, and live stream replays.

### Input Parameters

| Parameter | Type | Default | Description |
|---|---|---|---|
| `videoUrlsOrIds` | `array` | `["https://www.youtube.com/watch?v=dQw4w9WgXcQ"]` | YouTube watch URLs, Shorts URLs, `youtu.be` links, live/embed URLs, or 11-character video IDs. |
| `sortBy` | `string` | `"top"` | Sort order for top-level comments: `"top"` (Top comments) or `"newest"` (Newest first). |
| `maxCommentsPerVideo` | `integer` | `100` | Maximum number of top-level comments to extract per video (`1`–`50000`). |
| `includeReplies` | `boolean` | `true` | Fetch replies attached to top-level comments that have replies. |
| `maxRepliesPerComment` | `integer` | `10` | Maximum number of replies to fetch per top-level comment (`0`–`500`). |
| `language` | `string` | `"en"` | YouTube interface language code (e.g. `"en"`, `"id"`, `"es"`, `"ja"`). |
| `maxConcurrency` | `integer` | `5` | Maximum number of concurrent video and reply requests (`1`–`20`). |
| `proxyConfiguration` | `object` | `{"useApifyProxy": false}` | Apify Proxy configuration. Enable Apify Proxy (`RESIDENTIAL` default) for heavy workloads. |

### Sample Output

```json
{
  "commentId": "UgzKYksqeQ5gA3t0g0F4AaABAg",
  "videoId": "dQw4w9WgXcQ",
  "videoUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "videoTitle": "Rick Astley - Never Gonna Give You Up (Official Video) (4K Remaster)",
  "channelName": "Rick Astley",
  "channelId": "UCuAXFkgsw1L7xaCfnd5JJOw",
  "totalVideoCommentsText": "2.4M",
  "commentUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ&lc=UgzKYksqeQ5gA3t0g0F4AaABAg",
  "text": "I Rick rolled my entire French class because we had to study a city in France and make a quiz about it as well as a presentation, I decided to make a Kahoot quiz because it’s very easy. I put a link in to this saying it’s the kahoot link. The teacher needless to say got very very mad. As well as my classmates asking who rick rolls in 2019",
  "publishedTimeText": "6 years ago (edited)",
  "likeCount": 108000,
  "likeCountText": "108K",
  "replyCount": 694,
  "isPinned": false,
  "isHeartedByCreator": false,
  "isEdited": true,
  "sortBy": "top",
  "authorName": "@grustache4569",
  "authorChannelId": "UCKrzgYonJnMd0Dk7zQXjYXw",
  "authorChannelUrl": "https://www.youtube.com/@grustache4569",
  "authorAvatarUrl": "https://yt3.ggpht.com/ytc/AIdro_kDD-FhIbth2qcBbI9VGxR41dJa0kE3kN9iVlGzNgRU_g=s88-c-k-c0x00ffffff-no-rj",
  "isAuthorVerified": false,
  "isAuthorCreator": false,
  "isAuthorArtist": false,
  "replies": [
    {
      "commentId": "UgzKYksqeQ5gA3t0g0F4AaABAg.91a9XW7osVT961rS_2wf3F",
      "parentCommentId": "UgzKYksqeQ5gA3t0g0F4AaABAg",
      "commentUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ&lc=UgzKYksqeQ5gA3t0g0F4AaABAg.91a9XW7osVT961rS_2wf3F",
      "text": "respect",
      "publishedTimeText": "6 years ago",
      "likeCount": 4800,
      "likeCountText": "4.8K",
      "isEdited": false,
      "isHeartedByCreator": false,
      "authorName": "@Kanenfan",
      "authorChannelId": "UC6BLT7n-EQnEILjILxvaJXg",
      "authorChannelUrl": "https://www.youtube.com/@Kanenfan",
      "authorAvatarUrl": "https://yt3.ggpht.com/Q0hjeewb2BhpoOKOEYJ9vBJU-IwUX2aKsnHJhod_RP97N2QQMpcAvikjLpXwQwPoSbWP-9qy=s88-c-k-c0x00ffffff-no-rj",
      "isAuthorVerified": false,
      "isAuthorCreator": false,
      "isAuthorArtist": false
    }
  ],
  "scrapedAt": "2026-11-12T08:01:05.376656+00:00"
}
```

# Actor input Schema

## `videoUrlsOrIds` (type: `array`):

List of YouTube watch URLs, Shorts URLs, youtu.be short links, live/embed URLs, or 11-character video IDs to scrape comments from.

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

Order in which YouTube returns top-level comments: 'top' (Top comments) or 'newest' (Newest first).

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

Maximum number of top-level comments to extract per video (replies are attached under each comment).

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

Whether to fetch replies for top-level comments that have replies.

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

Maximum number of replies to fetch per top-level comment when 'Include Replies' is enabled.

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

YouTube interface language code (for example: 'en', 'id', 'es', 'ja').

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

Maximum number of concurrent requests (videos / reply threads fetched in parallel).

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

Apify Proxy configuration. Direct connection works for moderate runs; enable Apify Proxy (RESIDENTIAL default) for heavy or cloud workloads.

## Actor input object example

```json
{
  "videoUrlsOrIds": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "sortBy": "top",
  "maxCommentsPerVideo": 100,
  "includeReplies": true,
  "maxRepliesPerComment": 10,
  "language": "en",
  "maxConcurrency": 5,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `overview` (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 = {
    "videoUrlsOrIds": [
        "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    ],
    "language": "en"
};

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

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

```

## MCP server setup

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