# YouTube Comments Scraper: Comments, Replies & Shorts (`earlytern/youtube-comments-scraper`) Actor

Scrape public comments and replies from YouTube videos and Shorts: text, likes, reply count, date, pinned and hearted flags and the author's channel, without an API key.

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

## 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?

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: Comments, Replies & Shorts

YouTube Comments Scraper collects the public comments of YouTube videos and Shorts, without logging in and without a
YouTube API key. Paste one or many video links and get every comment as one clean row: full text, likes, reply count,
when it was posted, whether the channel pinned it or gave it a heart, and the author's name and channel. Turn on
replies to get the answers under each comment too, each linked to the comment it answers. You pay only for the
comments you get: $0.50 per 1,000 on the Free plan, no start fee.

### What does YouTube Comments Scraper do?

- **Many videos in one run:** regular videos, Shorts and live stream replays, by `watch`, `youtu.be`, `shorts`,
  `live` or `embed` address, or by the 11-character video code.
- **Top comments or newest first:** the same two orders YouTube offers under a video.
- **Replies (optional):** up to the number of replies you choose under each comment, as their own rows with
  `parentCommentId` pointing to the comment.
- **Comment data:** comment ID and direct link, full text, likes, number of replies, posted time as YouTube shows it
  ("3 days ago") plus an estimated date, edited, pinned and hearted-by-the-channel flags.
- **Author data:** display name (@handle), channel ID, channel address, profile picture, verified badge, and whether
  the author is the channel that posted the video.
- **Video data on every row:** video ID, address, title, channel name and ID, and the total comment count.
- **Free rows that explain:** a video with comments turned off, a video without comments, a missing video or a line
  that is not a video gets one free row saying why.

### Why use YouTube Comments Scraper?

- **Audience and brand research:** read what viewers say about a product, a campaign video or a competitor's launch.
- **Sentiment analysis:** export thousands of comments to a spreadsheet or an AI model and measure how people feel.
- **Content ideas:** find the questions your audience keeps asking under your videos or similar channels.
- **Community management:** list the newest comments every day, see which ones the channel pinned or hearted.
- **AI and data projects:** build datasets of real viewer language through the Apify API or MCP.
- **A YouTube Data API alternative:** no API key, no daily quota, results as JSON, CSV or Excel.

### How to use YouTube Comments Scraper

1. Click **Try for free**.
2. Paste one or more links in **Videos**, one per line.
3. Set **Maximum comments per video** and **Sort comments by**; turn on **Include replies** if you want them.
4. Click **Start**. 100 comments of one video usually take a few seconds.
5. Download the results as JSON, CSV or Excel, or use them through the API.

### Input

| Field | What it does |
|---|---|
| **Videos** | Video or Shorts links, youtu.be links or video codes, one per line. Duplicates are read once. |
| **Maximum comments per video** | How many comments to save for each video (replies not counted). Default 100, up to 100,000. |
| **Sort comments by** | `top` (YouTube's top comments) or `newest` (newest first). |
| **Include replies** | Also save the replies under each comment. Off by default. |
| **Maximum replies per comment** | With replies on, how many replies to save under each comment. Default 20. |
| **Proxy** | Apify Proxy settings. The default works for most runs. |

Example input:

```json
{
  "videoUrls": ["https://www.youtube.com/watch?v=dQw4w9WgXcQ", "https://www.youtube.com/shorts/_JUlWtSCNbs"],
  "maxComments": 30,
  "includeReplies": true,
  "maxRepliesPerComment": 5
}
```

### Output

Each comment or reply is one row. Example (a reply, shortened):

```json
{
  "type": "reply",
  "videoId": "dQw4w9WgXcQ",
  "videoTitle": "Rick Astley - Never Gonna Give You Up (Official Video) (4K Remaster)",
  "videoChannelName": "Rick Astley",
  "videoCommentCount": 2462495,
  "commentId": "Ugxzbv_ZeZXNRcfwsSF4AaABAg.91_2FL04Xww97FrL-edZw3",
  "commentUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ&lc=Ugxzbv_ZeZXNRcfwsSF4AaABAg.91_2FL04Xww97FrL-edZw3",
  "parentCommentId": "Ugxzbv_ZeZXNRcfwsSF4AaABAg",
  "text": "@Sam The Gamer?",
  "likeCount": 4300,
  "replyCount": null,
  "publishedTimeText": "6 years ago",
  "publishedAt": "2020-11-19T10:34:25.025Z",
  "isEdited": true,
  "isPinned": false,
  "isHeartedByCreator": false,
  "authorName": "@candycake9531",
  "authorChannelId": "UCNLgzvqrGzFi5SEAbVkFchg",
  "authorChannelUrl": "https://www.youtube.com/@candycake9531",
  "authorIsVerified": false,
  "authorIsChannelOwner": false,
  "message": null
}
```

The `type` column tells rows apart: `comment` and `reply` are charged; `no_results` (comments turned off or none
yet), `not_found`, `blocked` (YouTube did not answer), `invalid` and `skipped` are free rows with a `message` that
says what happened. The **Comments** view in the Output tab shows the main columns as a table.

### How much does YouTube Comments Scraper cost?

You pay per saved comment or reply. There is no start fee, and explanation rows are free.

| Apify plan | Price per 1,000 comments |
|---|---|
| Free | $0.50 |
| Bronze | $0.45 |
| Silver | $0.40 |
| Gold and higher | $0.35 |

Example: 20 videos with 500 comments each are 10,000 comments, which cost $5.00 on the Free plan. Replies are charged
like comments, so 100 comments with up to 10 replies each cost at most $0.55. Set a **maximum cost per run** in the
run options to cap what a run can spend: when it is reached, the run stops cleanly and videos it could not pay for
come back as free `skipped` rows.

### Tips

- YouTube shows like counts from 1,000 up rounded (1.4K), so `likeCount` is rounded the same way.
- YouTube shows only "3 days ago", not an exact date: `publishedAt` is that period counted back from the time of the
  run, so "2 years ago" is accurate to about a year. For exact recent dates, sort by newest and run often.
- The total in `videoCommentCount` is the number YouTube shows above the comments; it can differ from the comments
  you can read, because YouTube hides some (held for review, removed as spam).
- For a daily check of new comments, sort by **newest** with a small maximum.
- If many rows come back as `blocked`, run again later or set the proxy to residential.

### Is it legal to scrape YouTube comments?

The Actor collects only comments YouTube shows publicly to visitors who are not logged in. Comments, author names,
handles and profile pictures are **personal data** of the people who wrote them. If you store or process them, you
need a lawful basis under the data protection laws that apply to you (for example the GDPR in the EU or the UK GDPR),
and you must respect the rights of the people in the data. Do not use the data for spam or harassment. You are
responsible for how you use the results; when in doubt, ask a lawyer.

### Questions and feedback

Open an issue on the **Issues** tab; we answer within 2 working days.

# Actor input Schema

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

One per line: a video address (https://www.youtube.com/watch?v=…), a Shorts address, a youtu.be link or an 11-character video code.

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

The run saves at most this many comments for each video, not counting replies.

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

Top comments (the order YouTube shows first) or newest first.

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

Also save the replies under each comment, each as its own row linked to the comment it answers. Replies are charged like comments.

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

With replies on, the run saves at most this many replies under each comment.

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

Apify Proxy settings. The default works for most runs; switch to residential proxies if YouTube stops answering.

## Actor input object example

```json
{
  "videoUrls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "maxComments": 20,
  "sortBy": "top",
  "includeReplies": false,
  "maxRepliesPerComment": 20,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

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

// Run the Actor and wait for it to finish
const run = await client.actor("earlytern/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"],
    "maxComments": 20,
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("earlytern/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"
  ],
  "maxComments": 20,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call earlytern/youtube-comments-scraper --silent --output-dataset

```

## MCP server setup

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