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

Scrape every comment on YouTube videos, channels, playlists or keyword searches, with replies if you want them. One row per comment: text, author, likes, reply count, posting time, creator hearts, pinned flag. Top or newest first. No login, no API key, no quota.

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

## Pricing

$0.70 / 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 - All Comments & Replies

Scrape **every comment on a YouTube video**, with the replies if you want them, as one clean row per comment: text, author and channel link, likes, reply count, posting time, creator hearts and pinned status. Paste video, Shorts, channel, @handle or playlist URLs, or search by keyword. **No login, no API key, no quota.**

### Why this comments scraper

- **All of them, not the first page.** The scraper walks YouTube's comment feed to the end. A video with 50,000 comments gives you 50,000 rows; a channel URL does that for every video it has.
- **Top or newest.** Read comments in YouTube's "Top comments" ranking, or newest first when you only care about the latest reactions.
- **Replies as rows.** Turn on replies and each reply becomes its own row with `isReply` and `parentCommentId`, so threads stay reconstructable.
- **Signals, not just text.** Like counts as numbers, reply counts, hearts from the creator, pinned comments, edited flags, verified authors, and whether the channel owner wrote the comment.
- **Honest about dates.** YouTube only shows "3 weeks ago"; you get that label plus an approximate ISO date computed from it.

### Use cases

- Sentiment and audience research on a product launch, trailer or campaign
- Mining questions, objections and feature requests from your own or a competitor's audience
- Lead and community discovery: the people who comment most under a niche channel
- Moderation and brand-safety monitoring on sponsored videos
- Training data and RAG corpora of real user language on a topic

### Input

| Field | What it does | Example |
|-------|--------------|---------|
| **YouTube URLs** | Videos, Shorts, youtu.be links, channels, @handles, playlists, or bare video ids. A channel or playlist collects comments from every video it contains. | `https://youtu.be/aircAruvnKk`, `https://www.youtube.com/@mkbhd` |
| **Search terms** | Or find videos by keyword and collect their comments. | `iphone 17 review`, `מתכון חומוס` |
| **Max comments per video** | How many top-level comments to take from each video. Blank = all. | `500` |
| **Order** | Top comments (YouTube's ranking) or newest first. | `top` |
| **Include replies** | Also collect replies under each comment as separate rows. Slower; every reply is a result. | off |
| **Max replies per comment** | When replies are on, how many to keep per comment. Blank = all. | `20` |
| **Max videos per channel / playlist / search** | How many newest videos to take from each source. Blank = all. | `50` |
| **Max comments in total** | Optional overall cap for the run. Blank = everything. | `10000` |

Run it with the prefilled URL to see a full example.

### Output

One row per comment (or reply):

```json
{
  "commentId": "Ugwedfi--9yZVC0eefl4AaABAg",
  "commentUrl": "https://www.youtube.com/watch?v=aircAruvnKk&lc=Ugwedfi--9yZVC0eefl4AaABAg",
  "text": "I study mathematics, physics and architecture. By definition this man is an ORACLE in the strict meaning of the word...",
  "author": "@kummer45",
  "authorChannelId": "UCqArZkt3NAOU0tcgIi6xmFQ",
  "authorUrl": "https://www.youtube.com/@kummer45",
  "authorAvatar": "https://yt3.ggpht.com/ytc/AIdro_m4CSuafW-y2xf_8OTq-udiBcDuBIkYQ6mivro3bwU=s88-c-k-c0x00ffffff-no-rj",
  "authorIsVerified": false,
  "authorIsChannelOwner": false,
  "likeCount": 14000,
  "replyCount": 176,
  "publishedTimeText": "7 years ago",
  "publishedAt": "2019-11-02",
  "isEdited": true,
  "isHearted": true,
  "isPinned": false,
  "isReply": false,
  "parentCommentId": null,
  "videoId": "aircAruvnKk",
  "videoUrl": "https://www.youtube.com/watch?v=aircAruvnKk",
  "videoTitle": "But what is a neural network? | Deep learning chapter 1",
  "videoChannelName": "3Blue1Brown",
  "videoChannelId": "UCYO_jab_esuFRV4b17AJtAw",
  "videoCommentCount": 9456,
  "sortedBy": "top",
  "scrapedAt": "2026-11-02T14:52:10.000Z"
}
```

A reply looks the same, with `isReply: true`, `parentCommentId` set, its own `commentId` of the form `parentId.replyId`, and `replyCount: null`.

### How it works

The actor talks to the same internal interface the YouTube site uses to load comments, page after page, in the order you choose, and reads each comment's text, author, counts and badges from YouTube's own records. Channel, playlist and search URLs are expanded through YouTube's listing endpoints so every video is covered. Requests go through a residential proxy by default, with a fresh address on any refusal, because YouTube throttles comment feeds pulled from datacenter ranges.

### Limits

- YouTube's "Top comments" ranking serves roughly the first 1,000 comments of a video and then ends (measured: 980 of 9,457). Choose **Newest first** to walk a large video's comments completely.
- YouTube publishes only relative posting times ("2 weeks ago"); `publishedAt` is derived from that label and is approximate.
- `likeCount` follows YouTube's rounding above 1,000 (14K becomes 14000).
- Videos with comments turned off, and private or removed videos, produce no rows; the run log and status message say which ones they were.
- Reply threads are read only when **Include replies** is on; `replyCount` is always filled regardless.

### Export formats

Download results as JSON, CSV, Excel or XML, or pull them through the Apify API into your own app, spreadsheet, database or MCP client.

### Frequently asked questions

**Do I need a YouTube API key?** No. The official YouTube Data API caps you at a few thousand comments a day; this actor has no quota and needs no key or login.

**Can I get all comments from a whole channel?** Yes. Paste the channel or @handle URL; every video is expanded and read. Use the per-video and total limits if you want to control cost.

**Does it include replies?** Optionally. Turn on **Include replies** and each reply is returned as its own row linked to its parent.

**Can I sort by newest?** Yes. Choose "Newest first" to walk the comments in reverse chronological order.

**Is scraping YouTube comments legal?** The actor collects only public data. You are responsible for how you use it; review YouTube's terms and your local laws before large-scale use.

### Pricing

Pay per comment. Every row you receive is a real comment or reply; videos that return nothing cost nothing.

# Actor input Schema

## `startUrls` (type: `array`):

Video, Shorts, youtu.be, channel, @handle or playlist URLs, or bare 11-character video IDs. A channel or playlist URL collects the comments of every video it contains. Examples: https://www.youtube.com/watch?v=aircAruvnKk , https://youtu.be/dQw4w9WgXcQ , https://www.youtube.com/@mkbhd , https://www.youtube.com/playlist?list=PLZHQObOWTQDNU6R1_67000Dx_ZCJB-3pi

## `searchTerms` (type: `array`):

Or find videos by keyword and collect their comments, e.g. iphone 17 review, מתכון חומוס, elecciones 2026.

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

How many top-level comments to collect from each video. Leave blank for every comment the video has (a video with 50,000 comments returns 50,000 rows).

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

'Top comments' is YouTube's default ranking (most liked and engaged first); 'Newest first' walks the comments in reverse chronological order, which is the right choice when you only need recent reactions.

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

Also collect the replies under each comment, as their own rows (isReply = true, parentCommentId set). Every reply is a billed result and each comment with replies costs one extra request, so a run takes longer. Off by default.

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

When replies are on, how many replies to keep under each comment. Leave blank for all of them.

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

For each channel, playlist or search term, how many of its newest videos to take. Leave blank to take every video the source lists. Does not apply to single video URLs.

## `maxItems` (type: `integer`):

Optional overall cap on how many rows (comments plus replies) the whole run returns. Leave blank for everything your inputs point to.

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

YouTube rate-limits comment feeds pulled from datacenter addresses, so a residential proxy is the default. Keep it on unless you bring your own proxies.

## Actor input object example

```json
{
  "startUrls": [
    "https://www.youtube.com/watch?v=aircAruvnKk"
  ],
  "searchTerms": [],
  "sortBy": "top",
  "includeReplies": false,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

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

All comment rows (JSON). Append ?format=csv for CSV.

# 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 = {
    "startUrls": [
        "https://www.youtube.com/watch?v=aircAruvnKk"
    ],
    "searchTerms": [],
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("swerve/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 = {
    "startUrls": ["https://www.youtube.com/watch?v=aircAruvnKk"],
    "searchTerms": [],
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("swerve/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 '{
  "startUrls": [
    "https://www.youtube.com/watch?v=aircAruvnKk"
  ],
  "searchTerms": [],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call swerve/youtube-comments-scraper --silent --output-dataset

```

## MCP server setup

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