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

Get the comments and replies of YouTube videos, Shorts, whole channels and playlists: text, author, likes, replies, pinned and creator-hearted flags. Top or newest first. $0.50 per 1,000 comments, less on Scale and Business plans; videos with comments off are free. Export to JSON, CSV or Excel.

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

## Pricing

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

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

### What is YouTube Comments Scraper?

YouTube Comments Scraper gets the **comments and replies of YouTube videos and Shorts**: the
text, the author, likes, reply count, the date, and whether the comment is **pinned** or
**hearted by the creator**. It reads single videos and Shorts, the newest videos of **whole
channels**, and **playlists**, top comments or newest first.

Paste links, click **Start**, and download one row per comment as JSON, CSV or Excel. No YouTube
API key, no login, no quota, no proxies to set up.

To try it, open the Actor, keep the example video and click **Start**. The example is free.

### What can you use it for?

- **Sentiment and audience research:** see what viewers say about a video, a product or a brand.
- **AI and LLM apps:** feed comments to ChatGPT, Claude or your own model for summaries, topics
  and classification.
- **Creators and marketers:** find questions, feedback and ideas for new videos; track reactions
  to launches and campaigns.
- **Competitor and influencer research:** compare how audiences react across channels.
- **Training and analysis data:** collect comment threads at scale.

### What data do you get?

| Field | What it is |
|---|---|
| `text` | The comment |
| `type`, `parentId` | `comment`, or `reply` with the id of the comment it answers |
| `author`, `authorChannelId`, `authorThumbnail` | Who wrote it |
| `likes`, `likesText` | Likes: the exact number when YouTube shows it (under 1,000), and YouTube's text ("3K") |
| `replyCount` | How many replies the comment has |
| `isPinned`, `isHearted` | Pinned by the creator; hearted by the creator |
| `isFromCreator`, `isVerified` | Written by the video's own channel; a verified author |
| `publishedTimeText`, `publishedDate` | When: YouTube's text ("2 days ago") and the date it means (approximate for older comments) |
| `commentId`, `commentUrl` | The comment, and a link that opens the video at it |
| `videoId`, `videoUrl`, `videoTitle` | The video |
| `videoChannelId`, `videoChannelTitle` | The video's channel |
| `source` | The link the row came from |

Every row has every column (empty when there is nothing), so CSV and Excel exports line up. A
reply comes right after its comment.

### How to scrape YouTube comments

1. Open the Actor.
2. Add **YouTube links**, one per line:
   - videos: `https://www.youtube.com/watch?v=…`, `https://youtu.be/…` or the 11-character id
   - Shorts: `https://www.youtube.com/shorts/…`
   - channels: `https://www.youtube.com/@name` or an `@handle` (its newest videos);
     `https://www.youtube.com/@name/shorts` for its Shorts, `/streams` for its live streams
   - playlists: `https://www.youtube.com/playlist?list=…`
3. Set **Comments per video** (default 100), and **Replies per comment** if you want replies
   (0 = none).
4. Choose the **Order**: top comments (as YouTube ranks them, pinned first) or newest first.
5. For channels and playlists, set **Videos per channel or playlist** (default 10).
6. Click **Start**, then download the results from the Output tab, or send them to Google Sheets,
   Make, Zapier or n8n.

#### Input examples

The 500 newest comments of two videos:

```json
{
    "links": ["https://www.youtube.com/watch?v=arj7oStGLkU", "https://youtu.be/3Ae4qCvQIcM"],
    "maxComments": 500,
    "sortBy": "newest"
}
```

The top 200 comments, with up to 5 replies each, of a channel's 20 newest videos:

```json
{
    "links": ["https://www.youtube.com/@TED"],
    "maxComments": 200,
    "maxRepliesPerComment": 5,
    "maxVideos": 20
}
```

#### Output example

```json
{
    "commentId": "UgzRh8Bx6IGwA_5EqER4AaABAg",
    "type": "comment",
    "parentId": null,
    "text": "Enjoying this talk? You'll love the brand new TED Radio Hour series ...",
    "author": "@nprpodcasts",
    "authorChannelId": "UCuVaB0t5qJRxP55gEl6TuKQ",
    "authorThumbnail": "https://yt3.ggpht.com/...",
    "publishedTimeText": "3 years ago (edited)",
    "publishedDate": "2023-11-26",
    "likes": null,
    "likesText": "3K",
    "replyCount": 42,
    "isPinned": true,
    "isHearted": false,
    "isFromCreator": false,
    "isVerified": true,
    "commentUrl": "https://www.youtube.com/watch?v=arj7oStGLkU&lc=UgzRh8Bx6IGwA_5EqER4AaABAg",
    "videoId": "arj7oStGLkU",
    "videoUrl": "https://www.youtube.com/watch?v=arj7oStGLkU",
    "videoTitle": "Inside the Mind of a Master Procrastinator | Tim Urban | TED",
    "videoChannelId": "UCAuUUnT6oDeKwE6v1NGQxug",
    "videoChannelTitle": "TED",
    "source": "https://www.youtube.com/watch?v=arj7oStGLkU"
}
```

### How much does it cost?

You pay per comment (replies count as comments), with Apify Store discounts on bigger plans, plus
Apify's tiny start fee per run:

| Your Apify plan | Per comment | Per 1,000 comments | Per 10,000 comments |
|---|---|---|---|
| Free, Starter | $0.0005 | $0.50 | $5 |
| Scale | $0.00045 | $0.45 | $4.50 |
| Business | $0.0004 | $0.40 | $4 |

You pay only for the comments you get: videos with comments turned off,
private or deleted videos and links that cannot be read are **free**, and so is the example
video. Each comment is charged once per run. Set a maximum charge per run in the run options; the
run stops when it is reached.

**On Apify's Free plan** you can try it with up to **100 comments per run and 1,000 a month**
(the example video is free and not counted). Any paid Apify plan, from Starter up, has **no
limit**: [see Apify's plans](https://apify.com/pricing).

### FAQ

**Why is a video missing from my results?** Its comments are turned off, it is for channel members
only, or it is private or deleted. Each one is listed with its reason in the `ERRORS` record of the
run's key-value store (the "Not read" link on the Output tab), free of charge.

**Why is `likes` empty for some comments?** YouTube shows exact likes only under 1,000; above
that it shows "3K" or "1.2M", which is in `likesText`. We never guess a number.

**How do I get all comments of a video?** Set **Comments per video** to the number of comments
the video has (up to 100,000). YouTube itself may stop listing very old comments of huge videos.

**How fast is it?** About 200 comments of a video in 6 seconds and 1,000 in under half a minute, and several videos are read at the same time.

**Is it legal?** It reads only public comments that YouTube shows to every visitor. You are
responsible for how you use the data; respect privacy laws such as the GDPR.

**Need help or a new feature?** Open an issue on the Actor's Issues tab.

# Actor input Schema

## `links` (type: `array`):

Videos, Shorts, channels or playlists, one per line: video links or ids, youtube.com/shorts/… links, channel links or @handles (a channel's /shorts or /streams link reads its Shorts or live streams), playlist links.

## `maxComments` (type: `integer`):

The most comments to get from each video, replies included. On Apify's Free plan: up to 100 per run and 1,000 a month; paid plans have no limit.

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

Also get up to this many replies of each comment, right after it. 0: no replies. Replies count towards the comments per video and are charged like comments.

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

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

## `maxVideos` (type: `integer`):

How many videos to read from each channel (newest first) or playlist. Video links are always read.

## Actor input object example

```json
{
  "links": [
    "https://www.youtube.com/watch?v=arj7oStGLkU"
  ],
  "maxComments": 20,
  "maxRepliesPerComment": 0,
  "sortBy": "top",
  "maxVideos": 10
}
```

# Actor output Schema

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

One row per comment or reply: text, author, likes, replies, pinned and hearted, with its video.

## `errors` (type: `string`):

Videos with comments turned off and links that could not be read, with the reason (free of charge).

# 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 = {
    "links": [
        "https://www.youtube.com/watch?v=arj7oStGLkU"
    ],
    "maxComments": 20
};

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

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

```

## MCP server setup

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