# Youtube Comments Scraper (`scraper_one/youtube-comments-scraper`) Actor

Extract comments from YouTube videos based on provided video URLs. Retrieve comment text, author info, timestamp, likes, and more. Perfect for audience sentiment analysis, content feedback tracking, and YouTube engagement monitoring.

- **URL**: https://apify.com/scraper_one/youtube-comments-scraper.md
- **Developed by:** [Scraper One](https://apify.com/scraper_one) (community)
- **Categories:** Social media, Videos, Developer tools
- **Features:** Limited permissions
- **Stats:** 85 total users, 4 monthly users, 100.0% runs succeeded, 3 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

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

![Apify Actor](https://img.shields.io/badge/Apify-Actor-blue)

This **Apify Actor** extracts comments from **YouTube videos** based on provided video URLs. It retrieves comment text, author info, timestamps, likes, and
more. Perfect for **audience sentiment analysis, content feedback tracking, and YouTube engagement monitoring**. 🎥💬

### Features

- 🔍 Scrape **comments from multiple YouTube videos**
- 👤 Extract **author details and channel URLs**
- ❤️ Collect **like counts on comments**
- 📅 Retrieve **timestamps (text + interpolated format)**
- 🔢 Limit the number of comments per video

***

### Input Parameters

| Parameter      | Type       | Required | Description                                                                                                  |
|----------------|------------|----------|--------------------------------------------------------------------------------------------------------------|
| `videoUrls`    | `string[]` | ✅        | Array of YouTube video URLs to extract comments from.                                                        |
| `resultsLimit` | `number`   | ❌        | Maximum number of comments per video (optional). If not set, the actor will return a default limited amount. |

***

### Example Input

```json
{
  "videoUrls": [
    "https://www.youtube.com/watch?v=ZxXruY7llcc"
  ],
  "resultsLimit": 50
}
```

***

### Output Data

The actor returns an array of JSON objects containing comment data for each video.

Every successful result includes `inputUrl`, the original `videoUrls` entry (with surrounding whitespace trimmed). `videoUrl` keeps its existing meaning and also retains the input URL for backward compatibility. These values retain the original input URL even when YouTube redirects it.

#### URL errors

- `INVALID_URL`: invalid or unsupported URL.
- `PAGE_UNAVAILABLE`: content confirmed unavailable, including private videos.

Each error record contains only `inputUrl` and `error`. Successful records have no `error` field. Error rows are free and do not count toward `resultsLimit`; normal result charges and the initialization charge still apply. Other URLs continue to be processed.

Zero comments, disabled comments, login or consent pages, age or regional restrictions, rate limits and technical failures do not by themselves mark a video as unavailable.

#### Example dataset with results and an error record

One complete comment record and one complete error record for another input:

```json
[
  {
    "inputUrl": "https://www.youtube.com/watch?v=ZxXruY7llcc",
    "commentText": "Quick question, do you like these types of convos? If so please hit the like button on the vid - that’s the best way to let us know ❤ (also, would be doing me a big favour if you could subscribe & join our community 🙏🏾🥲) i appreciate you - SB! X",
    "id": "UgxQG0IlkB-0SEbeLS54AaABAg",
    "publishedTime": "2 days ago",
    "interpolatedTimestamp": 1744020870611,
    "likeCount": 295,
    "author": {
      "channelId": "UCGq-a57w-aPwyi3pW7XLiHw",
      "displayName": "@TheDiaryOfACEO",
      "avatarThumbnailUrl": "https://yt3.ggpht.com/JHCZDz37bsTmwoE1o4LEodF5vhsHfk29kCEauDTFr27-7hHXsHHvvWGzcG77v32ERrkpfInkGQ=s88-c-k-c0x00ffffff-no-rj",
      "isVerified": true,
      "profileUrl": "https://www.youtube.com/@TheDiaryOfACEO",
      "isCreator": true,
      "isArtist": false
    },
    "videoUrl": "https://www.youtube.com/watch?v=ZxXruY7llcc",
    "replyCount": 12
  },
  {
    "inputUrl": "https://www.youtube.com/watch?v=missing0001",
    "error": "PAGE_UNAVAILABLE"
  }
]
```

✳️ Let us know if you'd like additional fields or comment replies support!

***

### Usage

1. **Create an Apify account** and navigate to the actor.
2. **Configure your input** using the Apify interface or API.
3. **Run the actor** and track its progress.
4. **Download the output** in your preferred format (JSON, CSV, Excel).

***

### Limitations & Notes

- Supply individual video URLs: `watch?v=...`, `youtu.be/...`, `shorts/...` or `embed/...`. Channels, searches, playlists without a video and service pages are unsupported and produce `INVALID_URL` records.
- Duplicate URLs are processed once after trimming surrounding whitespace.
- The scraper works on publicly visible comments only.
- **YouTube rate limits** may apply with large volumes or frequent runs.
- Be mindful of **YouTube’s Terms of Service** when scraping and storing user-generated data.
- Rate-limited – Free users can make only a few requests per day. **Contact us if you need higher or custom limits!**

***

### Works Best With

Combine this actor with other tools for full content intelligence:

✅ Best Use Case Scenario

- Gather video URLs from search results (e.g., using YouTube Search Scraper).
- Feed the URLs into **YouTube Comments Scraper** to collect discussion data.
- Use this to analyze viewer sentiment, feedback, and engagement patterns.

***

### Other Recommended Scrapers

- 🐦 [X (Twitter) Posts Search](https://apify.com/scraper_one/x-posts-search) — Find posts/tweets based on keywords, hashtags, and more
- 🐦 [X (Twitter) Post Replies Scraper](https://apify.com/scraper_one/x-post-replies-scraper) — Scrap replies of multiple X (Twitter) posts
- 🐦 [X (Twitter) Profile Posts Scraper](https://apify.com/scraper_one/x-profile-posts-scraper) — Scrap posts by specified X profiles/users
- 📘 [Facebook Posts Search](https://apify.com/scraper_one/facebook-posts-search) — Discover Facebook posts for a given topic or page
- 📘 [Facebook Comments Scraper](https://apify.com/scraper_one/facebook-comments-scraper) — Extract comments from public Facebook posts
- 📘 [Facebook Reactions Scraper](https://apify.com/scraper_one/facebook-reactions-scraper) — Extract reactions from public Facebook posts
- 📘 [Facebook Posts Scraper](https://apify.com/scraper_one/facebook-posts-scraper) — Scrap posts from Facebook pages, groups etc.
- 💬 [YouTube Search Scraper](https://apify.com/scraper_one/youtube-search-scraper) — Extract search results from YouTube
- 💬 [YouTube Comments Scraper](https://apify.com/scraper_one/youtube-comments-scraper) — Extract comments from YouTube videos
- 🎬 [YouTube Downloader](https://apify.com/scraper_one/yt-downloader) — Download youtube videos

### Support & Contact

✉️ Need help or want to suggest a feature? **Open an issue** or contact us at **scraper1one@gmail.com**.

# Actor input Schema

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

List of video URLs to process

## `resultsLimit` (type: `integer`):

Maximum number of replies to retrieve per video (between 1 and 500). If not set, only a few of the first replies will be returned.

## Actor input object example

```json
{
  "videoUrls": [
    "https://www.youtube.com/watch?v=ZxXruY7llcc",
    "https://www.youtube.com/shorts/0LI9Gf-bk5I"
  ],
  "resultsLimit": 20
}
```

# 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=ZxXruY7llcc",
        "https://www.youtube.com/shorts/0LI9Gf-bk5I"
    ],
    "resultsLimit": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("scraper_one/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=ZxXruY7llcc",
        "https://www.youtube.com/shorts/0LI9Gf-bk5I",
    ],
    "resultsLimit": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("scraper_one/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=ZxXruY7llcc",
    "https://www.youtube.com/shorts/0LI9Gf-bk5I"
  ],
  "resultsLimit": 20
}' |
apify call scraper_one/youtube-comments-scraper --silent --output-dataset

```

## MCP server setup

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