# YouTube Comment Scraper (`scraptivo/youtube-comment-scraper`) Actor

Scrape comments from YouTube videos and playlists. Supports multiple video or playlist URLs, comment sorting, and a global comment limit.

- **URL**: https://apify.com/scraptivo/youtube-comment-scraper.md
- **Developed by:** [Scraptivo](https://apify.com/scraptivo) (community)
- **Categories:** Social media, MCP servers, Developer tools
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#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 Comment Scraper** collects comments from YouTube videos and playlists and turns them into structured data for audience research, sentiment analysis, and community management. Provide one or more video or playlist URLs, run the Actor, and export comment text, authors, likes, reply status, and video metadata to JSON, CSV, Excel, or your preferred integration. Use it to analyze viewer sentiment, monitor brand mentions, and expand playlists automatically. Scraping 1,000 comments costs $2.50.

### What can you automate with YouTube Comment Scraper?

- **Analyze audience sentiment** — extract comment text, likes, and timestamps to understand viewer reaction.
- **Monitor brand mentions** — track what people say across your own and competitors' videos.
- **Build content research datasets** — collect comments at scale for research or training data.
- **Manage communities** — export comments for offline review and reply workflows.
- **Expand playlists automatically** — provide a playlist URL and scrape comments from every video in it.

### Who is this scraper for?

| Team | Workflow |
|---|---|
| Content and social teams | Study viewer feedback and sentiment. |
| Market researchers | Analyze opinions and trends around a topic. |
| Brand and reputation teams | Track mentions across YouTube. |
| Data scientists | Build comment datasets for analytics or training. |

### What data can you collect from YouTube?

| Data group | Example fields | How it helps |
|---|---|---|
| Comment content | text, commentId, publishedAt | Access and identify each comment. |
| Author | author, authorChannelId | Attribute the commenter. |
| Engagement | likeCount, isFavorited, isReply, parentCommentId | Gauge reaction and thread structure. |
| Video metadata | videoTitle, videoUrl, videoId, channelName, channelId | Trace the source video. |
| Video stats | videoViewCount, videoCommentCount, videoPublishedAt | Contextualize the comment. |

### How to use YouTube Comment Scraper

1. Open the Actor in the Scraptivo account.
2. Paste one or more YouTube video or playlist URLs.
3. Set a comment limit and choose the sort order.
4. Run the Actor.
5. Export the dataset to JSON, CSV, Excel, or your integration.

```json
{ "videoUrls": ["https://www.youtube.com/watch?v=jNQXAC9IVRw"], "maxItems": 1000, "commentSort": "new", "maxConcurrency": 3, "proxyConfiguration": { "useApifyProxy": true, "apifyProxyGroups": ["RESIDENTIAL"] } }
```

### Example workflow

#### Collect weekly feedback on a new video

1. Run your newest video URL each day for the first week.
2. Keep comments above a like-count threshold for follow-up.
3. Send new comments to Google Sheets or a community tool.
4. Deduplicate using the stable `commentId` field.

### Automate and integrate your results

- **Schedule** recurring runs using Apify's Scheduler or the API.
- **Webhooks** after a successful run to trigger downstream processing.
- **Export** to Google Sheets, Make, Zapier, or a database.
- **Deduplicate** using the stable `commentId` field.

```shell
curl "https://api.apify.com/v2/acts/scraptivo~youtube-comment-scraper/run-sync" -H "Content-Type: application/json" -d '{"videoUrls":["https://www.youtube.com/watch?v=jNQXAC9IVRw"],"maxItems":1000,"commentSort":"new"}'
```

### Input reference

| Field | Type | Required | Default | What it controls |
|---|---|---:|---|---|
| videoUrls | array | yes | — | YouTube video or playlist URLs to scrape comments from. |
| maxItems | integer | no | 100 | Maximum comments across all videos (0 = unlimited). |
| commentSort | string | no | new | Order: `new` (newest first) or `top`. |
| maxConcurrency | integer | no | 3 | Videos to process in parallel (1–10). |
| proxyConfiguration | object | no | RESIDENTIAL | Proxy settings; residential by default. |

### Output example

```json
{
  "commentId": "UgzuC3zzpRZkjc5Qzsd4AaABAg",
  "text": "We're so honored that the first ever YouTube video was filmed here!",
  "author": "@SanDiegoZoo",
  "authorChannelId": "UCC5NfQ6Mf0dq_eEwv4P_hWA",
  "likeCount": 4600000,
  "isFavorited": true,
  "isReply": false,
  "parentCommentId": null,
  "publishedAt": "2020-07-09T00:00:00+00:00",
  "videoId": "jNQXAC9IVRw",
  "videoUrl": "https://www.youtube.com/watch?v=jNQXAC9IVRw",
  "videoTitle": "Me at the zoo",
  "channelName": "jawed",
  "videoViewCount": 398675009,
  "videoCommentCount": 10
}
```

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

YouTube Comment Scraper uses pay-per-event billing on Apify:

- **$0.0025 per comment scraped** (the headline result event).
- **$0.00005 per run** for the actor-start event.

Examples: 1,000 comments cost about $2.50; 10,000 comments cost about $25. Apify platform plan discounts apply at higher volumes, and residential proxy traffic is billed separately by Apify according to your plan.

### Reliability and responsible use

- Expands playlist URLs into individual videos automatically.
- Handles pagination and rate limits with residential proxies by default.
- Reply fields (`isReply`, `parentCommentId`) are only present for reply comments.
- Scrape only public comment data and follow YouTube's terms of service.

### Frequently asked questions

#### Can I scrape comments from a whole playlist?

Yes. Paste a playlist URL into `videoUrls` and the Actor expands it into individual videos automatically.

#### Can I schedule YouTube Comment Scraper to run automatically?

Yes. Use Apify's Scheduler or the API to run a video or playlist on a recurring cadence.

#### What counts as one result?

One comment. Use `maxItems` to cap the number of comments across all videos in a run.

#### What is the difference between "new" and "top" comment sort?

`new` returns the newest comments first; `top` returns the highest-engagement comments.

#### Why are some reply fields empty?

`isReply` and `parentCommentId` only apply to reply comments; top-level comments have these fields unset.

#### How do I avoid duplicate records?

Deduplicate using the stable `commentId` field before writing to your pipeline.

### Related Scraptivo automations

- [YouTube Channel Scraper](https://apify.com/scraptivo/youtube-channel-scraper) — channel and video metadata from YouTube.
- [Instagram Comment Scraper](https://apify.com/scraptivo/instagram-comment-scraper) — comments from Instagram posts.
- [Twitter/X Profile Scraper](https://apify.com/scraptivo/twitter-x-profile-scraper) — profile and post data from X.

### Support and custom workflows

Need a different field, source, or delivery workflow? Contact Scraptivo at scraptivo@gmail.com. Include the Actor name, a sample URL, the required fields, and expected volume so we can assess the request.

# Actor input Schema

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

YouTube video or playlist URLs to scrape comments from. Playlist URLs are expanded into individual videos automatically. Video URLs with both v= and list= parameters are treated as single videos.

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

Maximum number of comments to scrape across all videos (0 = unlimited)

## `commentSort` (type: `string`):

How comments are ordered when extracted

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

How many videos to process at the same time. Higher values are faster for multiple URLs but use more resources.

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

Proxy settings for anti-bot protection

## Actor input object example

```json
{
  "videoUrls": [
    "https://www.youtube.com/watch?v=jNQXAC9IVRw"
  ],
  "maxItems": 30,
  "commentSort": "new",
  "maxConcurrency": 3,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

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

Dataset containing scraped YouTube comments

## `runStats` (type: `string`):

Aggregate statistics for the scrape run

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

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

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

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,scraptivo/youtube-comment-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/jD3S93cQwTyYGSk77/builds/25LK9iLPfyc6ztibk/openapi.json
