# Youtube Video Comments (`mohamedgb00714/youtube-video-comments`) Actor

Scrapes public comments from any YouTube video.

- **URL**: https://apify.com/mohamedgb00714/youtube-video-comments.md
- **Developed by:** [mohamed el hadi msaid](https://apify.com/mohamedgb00714) (community)
- **Categories:** Videos, Social media, Automation
- **Security:** Full permissions
- **Stats:** 9 total users, 0 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## 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 Video Comments Scraper

**Effortlessly extract public comments from any YouTube video.**

This Apify Actor allows you to quickly and reliably scrape public comments from a **single YouTube video URL**. Whether you're a market researcher, data analyst, content creator, or simply need to gather feedback, our **YouTube Video Comments Scraper** provides you with structured, clean data in minutes.

#### What can this Actor do for you?

- **Extract all public comments:** Get every publicly available comment associated with a YouTube video.
- **Target specific videos:** Simply provide the YouTube video URL you wish to scrape.
- **Receive structured data:** Output includes comment text, author details, like count, reply count, and more.
- **Export in various formats:** Download your scraped data in convenient formats like JSON, CSV, or Excel.
- **Fast and reliable:** Optimized for performance to deliver results quickly and consistently.
- **Compliant with YouTube's public data policies:** Designed to scrape publicly available information responsibly.

#### Why choose this YouTube Comments Scraper?

- **User-friendly:** Simple input configuration makes it easy to get started, even for non-technical users.
- **Scalable:** Leverage Apify's robust infrastructure to handle data collection without worrying about technical complexities.
- **Accurate and up-to-date:** We continuously monitor and update the scraper to adapt to changes on YouTube, ensuring high data quality.

### Use Cases

- **Sentiment analysis:** Understand public opinion and sentiment around specific topics or products.
- **Market research:** Gather insights into consumer preferences and trends.
- **Competitor analysis:** Monitor discussions related to your competitors' content.
- **Content feedback:** Collect feedback on your own videos to improve engagement.
- **Academic research:** Collect data for studies on online communication and social media.

### Input

Provide the URL of the YouTube video you want to scrape in the `videoUrl` field.

**Example Input:**

```json
{
    "videoUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
}
```

### Output Example

Each scraped comment will be stored in the dataset with a structure similar to this:

```json
{
    "commentId": "UgyT30oD_Ss3mHzubS14AaABAg",
    "content": "Awesome! Saving money while getting powerful video tools is a win. Excited to try this free n8n + FFmpeg setup!",
    "publishedTime": "3 days ago",
    "replyLevel": 0,
    "author": {
        "channelId": "UCtMpKUfXW04aYesCJTciBaA",
        "displayName": "@newtrendcomputernetworksll6970",
        "avatar": "https://yt3.ggpht.com/ytc/AIdro_n4xuOvsBFoViQDqlUEkoYTqIEhh0rfLrM0AG1ixBQ0IF0=s88-c-k-c0x00ffffff-no-rj",
        "isVerified": false,
        "isCurrentUser": false,
        "isCreator": false,
        "isArtist": false,
        "channelUrl": "/@newtrendcomputernetworksll6970"
    },
    "likeCount": "1",
    "likeCountA11y": "0 likes",
    "replyCount": "",
    "replyCountA11y": "0 replies",
    "creatorThumbnailUrl": "https://yt3.ggpht.com/VgfXncXCcd4t6GSVU17HExo9rrGhZ7hjlDAb8pgSla3SWkDLRVdjTwTvtMDUxhRI0HLw2Kq7d_Q=s88-c-k-c0x00ffffff-no-rj",
    "likeButtonA11y": "Like this comment along with 0 other people",
    "heartActiveTooltip": "❤ by @mahmutthedev",
    "avatarImage": "https://yt3.ggpht.com/ytc/AIdro_n4xuOvsBFoViQDqlUEkoYTqIEhh0rfLrM0AG1ixBQ0IF0=s88-c-k-c0x00ffffff-no-rj",
    "avatarAccessibilityText": "@newtrendcomputernetworksll6970",
    "readMoreTrackingParams": "CF8Qr7QGIhMI7_bc85-pjgMVchkGAB0Oyiix",
    "key": "EhpVZ3lUMzBvRF9TczNtSHp1YlMxNEFhQUJBZyAoKAE%3D"
}
```

# Actor input Schema

## `videoUrl` (type: `string`):

The URL of the YouTube video from which to scrape comments. Only one URL can be processed at a time.

## Actor input object example

```json
{
  "videoUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
}
```

# 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 = {
    "videoUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
};

// Run the Actor and wait for it to finish
const run = await client.actor("mohamedgb00714/youtube-video-comments").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 = { "videoUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ" }

# Run the Actor and wait for it to finish
run = client.actor("mohamedgb00714/youtube-video-comments").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 '{
  "videoUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
}' |
apify call mohamedgb00714/youtube-video-comments --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,mohamedgb00714/youtube-video-comments"
        }
    }
}
```

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/3QcXUJoiWWmacNEGA/builds/ZQVyBubT2SXkVxfXw/openapi.json
