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

Scrape YouTube comments from any video: text, likes, reply count, author name and channel, pinned and hearted flags, edit status and post time. Top or newest first, optional replies, bulk video URLs. Export to JSON, CSV or Excel for sentiment and audience research.

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

## Pricing

from $0.50 / 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

Scrape **YouTube comments from any video**. The **YouTube Comments Scraper** collects each comment's text, like count, reply count, author name and channel, pinned and "hearted by creator" flags, edit status and post time, with optional replies. Sort by top or newest and paste as many videos as you like. Use it for sentiment analysis, audience and product research, community monitoring, giveaway draws or training data.

### ✨ Features

- 💬 **Full Comment Data**: Text, likes, reply count, post time and a direct link to every comment.
- 👤 **Author Details**: Name (@handle), channel ID and URL, avatar, verified badge and whether the author is the channel owner.
- 📌 **Pinned & Hearted Flags**: See which comments the creator pinned or hearted.
- ↩️ **Replies (Optional)**: Turn on replies to get each thread right under its parent comment, linked by `parentCommentId`.
- 🔃 **Top or Newest First**: The same two orders YouTube offers.
- 📦 **Bulk Videos**: Many videos per run, each with its own comment limit.

### 🛠️ How It Works

1. **Paste video URLs or IDs** – one per line.
2. **Choose the order, replies and how many comments per video** – the default is 100 top comments.
3. **Run the Scraper** – comments can be downloaded as JSON, CSV or Excel or pulled through the API.

### ⚙️ Input

| Field                       | What it does                                                                   |
| --------------------------- | ------------------------------------------------------------------------------ |
| **Video URLs or IDs**       | YouTube links or video IDs, one per line.                                      |
| **Sort by**                 | `top` (YouTube's "Top comments") or `newest`.                                  |
| **Include replies**         | Also save replies. They count toward the per-video limit. Default off.         |
| **Max comments per video**  | Stop after this many comments (and replies) for each video. Default 100.       |

```json
{
    "videos": ["https://www.youtube.com/watch?v=dQw4w9WgXcQ"],
    "sortBy": "newest",
    "includeReplies": true,
    "maxItems": 1000
}
```

### 💰 Pricing

Pay only for the comments you get. No monthly rental.

| Event           | Price                                    | What you get                                        |
| --------------- | ---------------------------------------- | --------------------------------------------------- |
| **Comment**     | $0.0005 per comment ($0.50 per 1,000)    | One comment or reply with all fields below          |
| **Actor start** | $0.00005 per run                         | Charged once when the run starts.                   |

Examples: 1,000 comments = $0.50 · 10,000 comments = $5.00.

### 📊 Sample Output Data

```json
{
    "commentId": "Ugwif70lqUQcp6oq8pN4AaABAg",
    "videoId": "dQw4w9WgXcQ",
    "videoUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    "commentUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ&lc=Ugwif70lqUQcp6oq8pN4AaABAg",
    "text": "Fun fact, this song came out in July 1987. If you were born in August 1987 or later that year, the chances of this song playing on the radio while you were born is pretty decent.",
    "publishedTimeText": "2 years ago",
    "isEdited": false,
    "likeCount": 512,
    "replyCount": 22,
    "isPinned": false,
    "isHeartedByCreator": false,
    "isReply": false,
    "parentCommentId": null,
    "authorName": "@catsandfriends5918",
    "authorChannelId": "UCsuqpurmq5hBKZ1pbsPORIQ",
    "authorChannelUrl": "https://www.youtube.com/channel/UCsuqpurmq5hBKZ1pbsPORIQ",
    "authorAvatarUrl": "https://yt3.ggpht.com/ytc/AIdro_mZB-A6DWZcInjmLzKTxqMt3bJABSB8yYWmHvQZX9A=s88-c-k-c0x00ffffff-no-rj",
    "authorIsVerified": false,
    "authorIsChannelOwner": false,
    "scrapedAt": "2026-10-17T05:55:43.025Z"
}
```

### ❓ FAQ

**Do I need a YouTube account or API key?** No.

**Why is the post time "2 years ago" and not a date?** That is what YouTube shows publicly for comments; the text is kept as is.

**What about videos with comments turned off?** They are named in the run's status message; nothing is charged for them.

**Do like counts match the site?** They are YouTube's displayed counts, so large numbers are rounded the same way (1.2K → 1200).

### 🔗 More YouTube Actors

- [YouTube Transcript Scraper](https://apify.com/piotrv1001/youtube-transcript-scraper): full transcripts with timestamps for any list of videos, in the language you pick.
- [YouTube Channel Videos Scraper](https://apify.com/piotrv1001/youtube-channel-videos-scraper): every video, Short or live stream of a channel with views and duration.
- [YouTube Search Scraper](https://apify.com/piotrv1001/youtube-search-scraper): search results for any keyword with date, length and view filters.

# Actor input Schema

## `videos` (type: `array`):

YouTube video links or 11-character video IDs, one per line.

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

Which comments come first.

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

Also save the replies under each comment (they count toward the limit).

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

Stop after this many comments for each video.

## Actor input object example

```json
{
  "videos": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "sortBy": "top",
  "includeReplies": false,
  "maxItems": 100
}
```

# Actor output Schema

## `results` (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 = {
    "videos": [
        "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    ],
    "maxItems": 100
};

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

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

```

## MCP server setup

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