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

This alternative YouTube Data API has no limits or quotas. Extract YouTube comments data from one or multiple YouTube videos: full comment text, posting date, author username, video title, videoId. Download YouTube comments in JSON, CSV, and Excel.

- **URL**: https://apify.com/streamers/youtube-comments-scraper.md
- **Developed by:** [Streamers](https://apify.com/streamers) (Apify)
- **Categories:** Videos, Social media
- **Stats:** 20,659 total users, 1,746 monthly users, 99.4% runs succeeded, 340 bookmarks
- **User rating**: 4.91 out of 5 stars

## Pricing

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

### What is YouTube Comment Scraper?

YouTube Comments Scraper is a data extraction tool created for scraping comments from YouTube that goes beyond the standard YouTube API. As soon as you provide a video URL, you will be able to extract:

- **All comments** from chosen YouTube videos
- **Comment text**, author name, **date posted**, vote count, reply count
- Whether it **has been liked** by the video’s creator
- **Total comment count**

### How to use data extracted from YouTube comments

- **Monitor competitors’ comments** to see mentions of your brand
- Find **current trends** and **opinions** shared by commenters
- **Analyze comments** to find potential for expansion
- Use extracted data for **sentiment analysis**
- **Identify harmful** or **illegal** comments
- Get **quick insight** into what your community is doing and he opinions they hold

### How do I use YouTube Comment Scraper?

YouTube Comments Scraper is designed to be user-friendly, even for those who have never extracted data from YouTube before. Here’s how you can use YouTube Comment Scraper to extract YouTube comment data:

1. [Create](https://console.apify.com/actors/p7UMdpQnjKmmpR21D?addFromActorId=p7UMdpQnjKmmpR21D) an Apify account
2. Open [YouTube Comments Scraper](https://apify.com/streamers/youtube-comments-scraper)
3. Add one or more YouTube video URLs to scrape comments
4. Click the “Start” button and wait for the data to be extracted
5. Download your data in JSON, XML, CSV, Excel, or HTML

For more information, watch our [short video tutorial](https://www.youtube.com/watch?v=LOmod3V9pZw).

https://www.youtube.com/watch?v=LOmod3V9pZw

### ⬇️ Input example

The input for YouTube Comments Scraper should be a **YouTube video URL.** You can add as many URLs as you want, or even import a CSV file or Google Sheet with a prepared list of URLs.

<a href="https://console.apify.com/actors/p7UMdpQnjKmmpR21D/">
<img src="https://github.com/apify-projects/actor-readme-images/blob/master/youtube-comments-scraper-input.png?raw=true" alt="YouTube Comments Scraper input" style="width:70%;">
</a>

Once you’ve entered the URL, you can choose how many results you would like to extract and then click “Start.” Click on the [input tab](https://apify.com/streamers/youtube-comments-scraper/input-schema) for a full explanation of an input example in JSON.

```json
{
    "maxComments": 300,
    "startUrls": [
        {
            "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
            "method": "GET"
        }
    ]
}
```

### ⬆️ Output sample

The scraped YouTube comments will be shown as a dataset which you can find in the **Storage** tab. Note that the output is organized as a table for viewing convenience, but it doesn’t show **all the fields**:

<a href="https://console.apify.com/actors/p7UMdpQnjKmmpR21D/">
<img src="https://github.com/apify-projects/actor-readme-images/blob/master/youtube-comments-scraper-output.png?raw=true" alt="YouTube Comments Scraper output" style="width:70%;">
</a>

You can preview all the fields and choose in which format to download the YouTube comments you’ve extracted: JSON, Excel, HTML table, CSV, or XML. Here below is the same dataset in JSON:

```json
{
    "comment": "This is up there with their best songs.",
    "cid": "UgxRn0_LUxzRP2MybPR4AaABAg",
    "author": "@Nonie_Jay",
    "videoId": "bJTjJtRPqYE",
    "pageUrl": "<https://www.youtube.com/watch?v=bJTjJtRPqYE>",
    "commentsCount": 171,
    "replyCount": 0,
    "voteCount": 2,
    "authorIsChannelOwner": false,
    "hasCreatorHeart": false,
    "type": "comment",
    "replyToCid": null,
    "title": "Halestorm - Unapologetic [Official Audio]"
  },


```

### Want to try other YouTube APIs and scrapers?

If you want to extract specific YouTube data, you can use one of the specialized scrapers below, each built particularly for the relevant YouTube data scraping case, whether it's shorts, comments, or channels:

- ▶️ [YouTube Scraper](https://apify.com/streamers/youtube-scraper)
- 🏎 [Fast YouTube Channel Scraper](https://apify.com/streamers/youtube-channel-scraper)
- ▶️ [YouTube Shorts Scraper](https://apify.com/streamers/youtube-shorts-scraper)
- 📽️ [YouTube Video Scraper by Hashtag](https://apify.com/streamers/youtube-video-scraper-by-hashtag)

If you need to download scraped YouTube videos, you can use [YouTube Video Downloader](https://apify.com/pocesar/download-youtube-video).

You can also combine YouTube data with that from other social networks using any of the following scrapers:

- [TikTok scrapers](https://apify.com/clockworks)
- [Instagram scrapers](https://apify.com/store/categories?search=instagram\&managedBy=APIFY)
- [Facebook scrapers](https://apify.com/store/categories?search=facebook\&managedBy=APIFY)
- Or try our other [social media scrapers](https://apify.com/store?category=SOCIAL_MEDIA).

Furthermore, you can use the power of AI agents to do multiple tasks at one. For example, our [Comments Analyzer Agent](https://apify.com/apify/comments-analyzer-agent) can perform sentiment analysis of YouTube videos, or you could try our [Influencer Discovery Agent](https://apify.com/apify/influencer-discovery-agent) for lead generation on TikTok videos.

### Integrating YouTube Shorts Scraper with other apps

YouTube Scraper can be connected with almost any cloud service or web app thanks to [integrations](https://apify.com/integrations) on the Apify platform. These include [Make](https://docs.apify.com/platform/integrations/make), [Zapier](https://docs.apify.com/platform/integrations/zapier), [Slack](https://docs.apify.com/platform/integrations/slack), [Airbyte](https://docs.apify.com/platform/integrations/airbyte), [GitHub](https://docs.apify.com/platform/integrations/github), [Google Drive](https://docs.apify.com/platform/integrations/drive), and [plenty more](https://docs.apify.com/platform/integrations).

Alternatively, you can use [webhooks](https://docs.apify.com/platform/integrations/webhooks) to carry out an action whenever an event occurs, e.g. get a notification whenever YouTube Scraper successfully finishes a run, or initiate a new process, like ordering your data.

### Error items

When the scraper cannot retrieve data for a given input — for example a video is unavailable or has no comments — it pushes an **error item** to the dataset instead of silently skipping it. Normal output items are never affected; you can tell them apart by the presence of an `error` field.

#### Error item structure

```json
{
    "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    "input": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    "error": "VIDEO_UNAVAILABLE",
    "note": "This video is not available"
}
```

#### Error codes reference

| `error`                      | Meaning                                                             |
| ---------------------------- | ------------------------------------------------------------------- |
| `CHANNEL_DOES_NOT_EXIST`     | Channel URL points to a channel that does not exist                 |
| `NOT_FOUND`                  | Page was not found                                                  |
| `VIDEO_UNAVAILABLE`          | Video is not available (deleted, region-blocked, etc.)              |
| `AGE_RESTRICTED`             | Channel is age-restricted and cannot be accessed without login      |
| `CHANNEL_HAS_NO_VIDEOS`      | Channel exists but has no uploaded videos                           |
| `CHANNEL_HAS_NO_LIVE_VIDEOS` | Channel exists but has no live videos                               |
| `CHANNEL_HAS_NO_SHORTS`      | Channel exists but has no Shorts                                    |
| `DATE_FILTER_TOO_STRICT`     | Videos exist but none match the active date filter                  |
| `NO_VIDEOS`                  | No videos found on the page                                         |
| `NO_RESULTS`                 | No results collected — check that video-type limits are set above 0 |
| `NO_VALID_START_URLS`        | All provided start URLs were invalid or malformed                   |
| `INVALID_INPUT`              | Actor failed due to bad configuration (run is also terminated)      |
| `NO_COMMENTS`                | No comments found for the video                                     |

***

### FAQ

#### Is YouTube comments scraping legal?

Our [YouTube scrapers](https://apify.com/store?search=youtube) are ethical and **do not extract any private user data, such as email addresses, gender, or location**. They only extract what the user has chosen to share publicly. However, you should be aware that your **results could contain personal data.** You should not scrape personal data unless you have a legitimate reason to do so.

If you're unsure whether your reason is legitimate, consult your lawyers. You can also read our blog post on the [legality of web scraping](https://blog.apify.com/is-web-scraping-legal/) and [ethical scraping](https://blog.apify.com/what-is-ethical-web-scraping-and-how-do-you-do-it/).

#### Do I need proxies to scrape YouTube comments?

If you run the scraper on the Apify platform, for successful YouTube scraping you will need [residential proxies](https://apify.com/proxy?pricing=residential-ip#pricing) which are included in Apify's **monthly Starter plan**.

For more details about how our pricing works, platform credits, proxies, and usage, see the [platform pricing page](https://apify.com/pricing/actors).

#### Can I use YouTube Comments Scraper with the API?

Yes. You can do so using Apify API which will enable you to manage, schedule, and run any Apify Actors, including this one. The API also lets you access any datasets, monitor Actor performance, fetch results, create and update versions, and more. To access the API using Node.js, use the `apify-client` [NPM package](https://apify.com/streamers/youtube-comments-scraper/api/javascript). To access the API using Python for scraping YouTube comments, use the `apify-client` [PyPi package](https://apify.com/streamers/youtube-comments-scraper/api/python).

Check out the [Apify API reference](https://docs.apify.com/api/v2) docs for full details or click on the [API tab](https://apify.com/streamers/youtube-comments-scraper/api/python) for code examples.

#### Can I use YouTube Scraper through an MCP Server?

With Apify API, you can use almost any Actor in conjunction with an MCP server. You can connect to the MCP server using clients like ClaudeDesktop and LibreChat, or even build your own. Read all about how you can [set up Apify Actors with MCP](https://blog.apify.com/how-to-use-mcp/).

For YouTube Scraper, go to the [MCP tab](https://apify.com/streamers/youtube-comments-scraper/api/mcp) and then go through the following steps:

1. Start a Server-Sent Events (SSE) session to receive a `sessionId`
2. Send API messages using that `sessionId` to trigger the scraper
3. The message starts the Amazon ASINs Scraper with the provided input
4. The response should be: `Accepted`

#### Your feedback

We’re always working on improving the performance of our Actors. So if you’ve got any technical feedback for YouTube Comment Scraper or simply found a bug, please create an issue on the Actor’s [Issues tab](https://apify.com/streamers/youtube-comments-scraper/issues/open).

# Actor input Schema

## `startUrls` (type: `array`):

Enter a link to a specific Youtube video <a href='https://www.youtube.com/watch?v=xObhZ0Ga7EQ' target='_blank' rel='noopener'>YouTube video</a>. You can also import a CSV file or Google Sheet with a list of URLs.<br>

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

Limit the number of comments you want to scrape per video.

## `sortCommentsBy` (type: `string`):

Select Youtube sorting parameter for comments

## `oldestCommentDate` (type: `string`):

Only comments published after or on this date will be scraped. Alternatively, specify how old the scraped comments should be. Putting <code>1 day</code> will get you only today's comments, <code>2 days</code> - yesterday's and today's, and so on. Note, that if you select this, sorting parameter will be auto-reset to newest first

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    }
  ],
  "maxComments": 100,
  "sortCommentsBy": "NEWEST_FIRST",
  "oldestCommentDate": "2026-03-01"
}
```

# Actor output Schema

## `dataset` (type: `string`):

Dataset containing all scraped YouTube comments

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

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

# Run the Actor and wait for it to finish
run = client.actor("streamers/youtube-comments-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "startUrls": [
    {
      "url": "https://www.youtube.com/watch?v=xObhZ0Ga7EQ"
    }
  ],
  "maxComments": 10
}' |
apify call streamers/youtube-comments-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=streamers/youtube-comments-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/p7UMdpQnjKmmpR21D/builds/c8FJQA0LHPGm5oybv/openapi.json
