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

Scrape comments and replies from any public YouTube video or Short without an API key: text, author, likes, reply count, date, pinned flag. Pay only per comment.

- **URL**: https://apify.com/yegnata/youtube-comments-scraper.md
- **Developed by:** [eshetu elias](https://apify.com/yegnata) (community)
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.80 / 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 **comments and replies from any public YouTube video or Short** with no API key, quota or login. For every comment: text, author, likes, reply count, date, pinned flag and whether the video's creator wrote it.

### What you get

| author | text | likes | replyCount | publishedText | isPinned |
|---|---|---|---|---|---|
| @programmingwithmosh | 🔥Want to master Python? Get my Python mastery course… | 39 | 1 | 1 month ago | true |
| @viewer… | Web development | 0 | 0 | 5 hours ago | false |
| @viewer… | data science | 0 | 0 | 3 minutes ago | false |

*Viewer handles shortened here; the dataset has the full public handle.*

Every comment also has `commentId`, `authorChannelId`, `authorIsVerified`, `authorIsVideoOwner`, `publishedDate` (approximate), `edited`, `isReply`, `parentCommentId`, `url` (opens the comment on YouTube), the video's `videoId`, `videoTitle`, `channelName` and `scrapedAt`.

### Use cases

- **Audience research:** find out what viewers ask, praise and complain about.
- **Sentiment and AI analysis:** feed comments into sentiment models, topic clustering or LLM summaries.
- **Creator and brand monitoring:** track reactions to launches, ads and reviews.
- **Lead and community insights:** see who engages most under competitors' videos.

### How much does it cost?

You pay **$0.80 per 1,000 comments** (replies count as comments), nothing else. Set *Maximum results* to cap your spend.

### How to use it

1. Paste **Videos**: watch links, youtu.be links, Shorts links or video IDs.
2. Choose **Top comments** or **Newest first**, and **Max comments per video**.
3. Turn on **Include replies** if you want reply threads too.
4. Click **Start** and download as JSON, CSV or Excel, or pull results by API.

### Input example

```json
{
  "videos": ["https://www.youtube.com/watch?v=kqtD5dpn9C8", "https://www.youtube.com/shorts/ai1gIWacf0I"],
  "sortBy": "newest",
  "maxCommentsPerVideo": 500,
  "includeReplies": true,
  "maxRepliesPerComment": 10,
  "maxItems": 2000
}
```

### Speed

About 1,000 comments a minute from one video.

### FAQ

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

**Do Shorts work?** Yes. Paste a Shorts link (`youtube.com/shorts/…`) like any other video.

**The same video is in my list twice.** It's scraped once; you're never charged twice for the same comment.

**A video returned nothing.** Videos that are private, deleted or have comments turned off are listed under `FAILED_VIDEOS` in the run's key-value store and cost nothing.

**How exact is `publishedDate`?** YouTube shows relative times ("5 hours ago"), so it's approximate: exact for recent comments, to the month or year for old ones.

**Something broke.** Open an issue on the Issues tab; fixes usually ship within 24 hours.

# Actor input Schema

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

YouTube video links or IDs: watch, youtu.be, Shorts and live links all work.

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

Top comments (as YouTube ranks them) or newest first.

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

Includes replies when they are turned on.

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

Also get replies to each comment. Each reply is one result.

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

Limit of replies saved for each comment when replies are on.

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

Stop after this many comments in total. You are charged per comment, so this caps your cost.

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

Not needed for normal use.

## Actor input object example

```json
{
  "videos": [
    "https://www.youtube.com/watch?v=kqtD5dpn9C8"
  ],
  "sortBy": "top",
  "maxCommentsPerVideo": 100,
  "includeReplies": false,
  "maxRepliesPerComment": 20,
  "maxItems": 100,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

Every comment saved in this 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 = {
    "videos": [
        "https://www.youtube.com/watch?v=kqtD5dpn9C8"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("yegnata/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=kqtD5dpn9C8"] }

# Run the Actor and wait for it to finish
run = client.actor("yegnata/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=kqtD5dpn9C8"
  ]
}' |
apify call yegnata/youtube-comments-scraper --silent --output-dataset

```

## MCP server setup

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