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

Scrape YouTube comments and replies from videos, whole channels, playlists or a YouTube search: text, likes, creator hearts, pinned flag, reply count, commenter channel and video stats. Sort newest or top, filter by keyword, likes and date. Export, run via API, schedule, or use with AI agents.

- **URL**: https://apify.com/lergassy/youtube-comments-scraper.md
- **Developed by:** [Matvey](https://apify.com/lergassy) (community)
- **Categories:** Social media, Agents, MCP servers
- **Stats:** 1 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $0.35 / 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.
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?

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

### What is YouTube Comments Scraper?

**YouTube Comments Scraper** collects the comments and replies of YouTube videos — one video, a list of videos, a **whole channel**, a **playlist**, or the top results of a **YouTube search** — and gives you every comment as one clean row: text, likes, reply count, whether the creator hearted or pinned it, and the commenter's channel. No YouTube API key, no daily quota, no login, no browser.

It reads YouTube data the same way the YouTube web player does, so it is fast (about 20 comments per request, hundreds per second) and cheap: a run costs compute seconds, nothing else.

### What data can YouTube Comments Scraper extract?

| Field | Example |
|---|---|
| `text` | "can confirm: he never gave us up" |
| `likes`, `replyCount` | 313000, 1000 |
| `publishedAgo` / `publishedAt` | "1 year ago" / 2025-09-11 |
| `isPinned`, `isCreatorHearted`, `isEdited` | true, true, false |
| `isReply`, `parentCommentId` | true, UgzuC3zzpRZkjc5Qzsd4AaABAg |
| `authorName`, `authorChannelId`, `authorChannelUrl`, `authorAvatarUrl` | @SanDiegoZoo, UCC5NfQ6…, link, image |
| `authorIsVerified`, `authorIsCreator`, `authorIsArtist` | true, false, false |
| `commentId`, `commentUrl` | YouTube's stable ID and a link that opens the video at this comment |
| `videoId`, `videoTitle`, `channelName`, `channelId`, `source` | which video, and whether it came from a channel, playlist or search |

One **video row** per video (`rowType = video`) adds `videoViews`, `videoLikes`, `videoCommentCount`, `videoPublishedAt`, `videoDurationSeconds`, `videoDescription`, `videoKeywords` and `commentsCollected`. Anything that could not be read becomes an **error row** with a plain-words `errorMessage`; error rows and video rows are free.

### How much does it cost to scrape YouTube comments?

**$0.50 per 1,000 comments**, pay per event, nothing up front. Comments removed by your filters, video rows and error rows cost nothing. Apify's free plan gives $5 of platform credit a month — about 10,000 comments. Bronze, Silver and Gold plans get 10 %, 20 % and 30 % off.

Example: the 20 latest videos of a channel × 200 comments = 4,000 comments = **$2.00**.

### How to scrape YouTube comments

1. Paste into **🎬 Video URLs or IDs** — `watch?v=`, `youtu.be`, Shorts links or bare IDs — or give a **📺 Channel URL**, a **📋 Playlist URL**, or type a **🔍 YouTube search**.
2. Set **💬 Comments per video** (0 = all) and, for channels, playlists and searches, **📹 Videos per source**.
3. Choose **Top comments** or **Newest first**; switch **↩️ Include replies** on or off.
4. Optional filters: **🔎 Keyword in comment** (`battery|charging` for alternatives), **👍 Minimum likes**, **❤️ Only comments hearted by the creator**, **📅 Only comments since**.
5. Click **Start**. Export from the **Output** tab as CSV, Excel or JSON, or connect it to a sheet or a workflow.

### ⬇️ Input

![YouTube Comments Scraper input form: the fields a buyer fills in before pressing Start](https://raw.githubusercontent.com/lergassy/apify-actor-assets/main/youtube-comments/youtube-comments-input-form.png)

```json
{
  "videoUrls": ["https://www.youtube.com/watch?v=dQw4w9WgXcQ"],
  "maxCommentsPerVideo": 100,
  "sort": "newest",
  "includeReplies": true,
  "maxRepliesPerComment": 20
}
```

#### Whole channel, playlist or search

```json
{
  "channelUrls": ["https://www.youtube.com/@mkbhd"],
  "searchQueries": ["n8n tutorial"],
  "maxVideosPerSource": 10,
  "maxCommentsPerVideo": 200
}
```

Channels give their newest videos first, playlists keep playlist order, searches follow YouTube's ranking. Every comment row says in `source` which channel, playlist or query it came from.

#### Filters

- **Only comments since** — `2026-06-01` or `7 days`, `3 months`. YouTube shows ages, not dates, so the cutoff is applied to the age shown; with **Newest first** collection stops at the first older comment, which keeps scheduled runs short.
- **Keyword in comment** — case-insensitive; `|` separates alternatives.
- **Minimum likes**, **Only comments hearted by the creator** — applied before a comment is saved; skipped comments are not charged.

### ⬆️ Output

![YouTube Comments Scraper output table: one row per result, exported as JSON, CSV or Excel](https://raw.githubusercontent.com/lergassy/apify-actor-assets/main/youtube-comments/youtube-comments-output-table.png)

```json
{
  "rowType": "comment",
  "videoId": "dQw4w9WgXcQ",
  "videoTitle": "Rick Astley - Never Gonna Give You Up (Official Video) (4K Remaster)",
  "channelName": "Rick Astley",
  "commentId": "UgzuC3zzpRZkjc5Qzsd4AaABAg",
  "commentUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ&lc=UgzuC3zzpRZkjc5Qzsd4AaABAg",
  "parentCommentId": null,
  "isReply": false,
  "text": "can confirm: he never gave us up",
  "publishedAgo": "1 year ago",
  "publishedAt": "2025-09-11",
  "isEdited": false,
  "likes": 313000,
  "replyCount": 1000,
  "isPinned": true,
  "isCreatorHearted": true,
  "authorName": "@YouTube",
  "authorChannelId": "UCBR8-60-B28hp2BmDPdntcQ",
  "authorChannelUrl": "https://www.youtube.com/channel/UCBR8-60-B28hp2BmDPdntcQ",
  "authorIsVerified": true,
  "authorIsCreator": false,
  "status": "ok"
}
```

#### Dates

YouTube shows comment ages ("3 weeks ago"), not dates. `publishedAt` is that age subtracted from the run date — accurate to the unit YouTube shows. `publishedAgo` keeps YouTube's wording. Video publish dates are exact.

### Use cases for YouTube comments

#### Audience research and sentiment

Pull the comments of a competitor's last 20 videos, run them through a sentiment model or an LLM, and read what their audience praises and complains about.

#### Creator feedback loops

Run daily with **Newest first** and **Only comments since: 1 day** on your own channel; new questions land in a sheet or Slack every morning, with **❤️ hearted** and **pinned** flags so you can see what was already answered.

#### Lead generation and outreach

Comments under "best CRM for small business" style videos are people stating a need in their own words. Filter by keyword and **Minimum likes**, and the commenter's channel link is right there.

#### AI, RAG and datasets

Stable IDs, clean text and thread structure (`parentCommentId`) drop straight into an embedding pipeline. The MCP server lets an AI agent search YouTube and read the comments in one step.

### Integrations

- **API** — start runs and fetch results from any language; the **API** tab has snippets for Python, Node.js and cURL.
- **n8n, Make, Zapier** — run on a schedule, push new comments to Google Sheets, Slack, Notion or a CRM.
- **Google Sheets** — the built-in integration appends each run's rows to a sheet.
- **MCP server** — add `https://mcp.apify.com` to Claude, Cursor or any MCP client; the scraper becomes a tool the agent can call with a video link or a search query.
- **Webhooks** — a POST when a run finishes, with links to the dataset.

### ❓ FAQ

#### Is it legal to scrape YouTube comments?

The scraper reads only public comments, visible to any visitor without logging in. Comments carry personal data (names, channel links), so storing and using them is subject to GDPR and similar laws; consult a lawyer if in doubt.

#### Do I need a YouTube API key?

No. The official Data API caps you at 10,000 units a day; this scraper has no quota and no key.

#### Can I get all comments of a video?

Yes — set **Comments per video** to 0. A video with a million comments takes a while; the scraper pages through YouTube's list until it ends.

#### Are replies included?

Yes by default, each as its own row with `parentCommentId`, up to **Replies per comment** (0 = all).

#### Can I use YouTube Comments Scraper with the Apify API?

Yes. Every run can be started, monitored and downloaded through the API in JSON, CSV or Excel.

#### Can I use it through an MCP server?

Yes. Connect the Apify MCP server and the scraper appears as a tool; an agent can search "iphone 17 review" and reason over the comments in one step.

#### Can I integrate it with other apps?

Yes — n8n, Make, Zapier, Google Sheets, Slack and webhooks.

#### Does one row equal one comment?

Yes. Each comment or reply is one row; each video adds one summary row (`rowType = video`), which **Video summary rows** switches off.

### Your feedback

A video that does not scrape, an empty field, a filter you miss — open an issue in the **Issues** tab; every issue gets an answer. A review in the **Reviews** tab helps other buyers find the scraper.

### You might also like

| Actor | What it does |
|---|---|
| [YouTube Transcript Scraper](https://apify.com/lergassy/youtube-transcript-scraper) | Subtitles and transcripts of YouTube videos |
| [Threads Scraper](https://apify.com/lergassy/threads-scraper) | Posts, profiles and search on Meta Threads |
| [Telegram Channel Analytics](https://apify.com/lergassy/telegram-channel-analytics) | Subscribers, reach and stats of Telegram channels |
| [Speech to Text](https://apify.com/lergassy/speech-to-text) | Transcripts from audio and video files and YouTube links |
| [Trustpilot Reviews API](https://apify.com/lergassy/trustpilot-reviews-api) | Company reviews from Trustpilot |

# Actor input Schema

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

YouTube video links or 11-character video IDs, one per line: <b>https://www.youtube.com/watch?v=dQw4w9WgXcQ</b>, <b>https://youtu.be/dQw4w9WgXcQ</b>, a Shorts link, or just <b>dQw4w9WgXcQ</b>.

## `channelUrls` (type: `array`):

Channel links, one per line — <b>https://www.youtube.com/@mkbhd</b> or a <b>/channel/UC…</b> link. The channel's latest videos are collected (see <b>Videos per channel</b>) and their comments scraped.

## `playlistUrls` (type: `array`):

Playlist links, one per line. Every video in the playlist is scraped, up to <b>Videos per channel</b>.

## `searchQueries` (type: `array`):

Search YouTube and scrape the comments of the top results — <b>"iphone 17 review"</b>, <b>"n8n tutorial"</b>. Up to <b>Videos per channel</b> videos per query.

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

How many videos to take from each channel, playlist or search — newest first for channels, playlist order for playlists, YouTube's ranking for searches.

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

Stop after this many comments per video (replies count too when included). 0 = all comments; a viral video can have hundreds of thousands.

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

<b>Newest first</b> plus a date cutoff turns a scheduled run into a feed of what was said since last time.

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

Also collect the replies under each comment. Each reply is its own row with <b>parentCommentId</b> set.

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

Cap on replies collected under one comment. 0 = all.

## `commentsSince` (type: `string`):

Skip comments older than this: a date such as <b>2026-06-01</b> or a period such as <b>7 days</b>, <b>3 months</b>. YouTube shows ages, not dates, so the cutoff is applied to that age. With <b>Newest first</b> collection stops at the first older comment.

## `keyword` (type: `string`):

Keep only comments whose text contains this word or phrase (case-insensitive). Several alternatives: separate with <b>|</b>, e.g. <b>battery|charging</b>.

## `minLikes` (type: `integer`):

Keep only comments with at least this many likes.

## `onlyCreatorHearted` (type: `boolean`):

Keep only comments the channel owner marked with a heart — the ones the creator noticed.

## `includeVideoDetails` (type: `boolean`):

Add one row per video with title, channel, views, likes, publish date, duration and how many comments were collected (rowType = video). These rows have different columns from the comment rows, so the table shows blanks where a column does not apply.

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

Two-letter language for YouTube's interface text, such as <b>en</b>, <b>de</b>, <b>id</b>. Affects comment ages ("2 weeks ago") and video metadata labels, not the comments themselves.

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

YouTube answers plain requests from Apify's data-centre addresses, so no proxy is used by default. Switch one on only if runs start hitting YouTube's rate limits.

## Actor input object example

```json
{
  "videoUrls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "channelUrls": [],
  "playlistUrls": [],
  "searchQueries": [],
  "maxVideosPerSource": 10,
  "maxCommentsPerVideo": 50,
  "sort": "top",
  "includeReplies": true,
  "maxRepliesPerComment": 20,
  "onlyCreatorHearted": false,
  "includeVideoDetails": false,
  "language": "en",
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

One row per comment or reply (rowType = comment) plus one summary row per video (rowType = video). Error rows explain what could not be read.

# 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"
    ],
    "channelUrls": [],
    "playlistUrls": [],
    "searchQueries": [],
    "maxVideosPerSource": 10,
    "maxCommentsPerVideo": 50,
    "commentsSince": "",
    "keyword": "",
    "language": "en",
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("lergassy/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"],
    "channelUrls": [],
    "playlistUrls": [],
    "searchQueries": [],
    "maxVideosPerSource": 10,
    "maxCommentsPerVideo": 50,
    "commentsSince": "",
    "keyword": "",
    "language": "en",
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("lergassy/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"
  ],
  "channelUrls": [],
  "playlistUrls": [],
  "searchQueries": [],
  "maxVideosPerSource": 10,
  "maxCommentsPerVideo": 50,
  "commentsSince": "",
  "keyword": "",
  "language": "en",
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call lergassy/youtube-comments-scraper --silent --output-dataset

```

## MCP server setup

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