# Comments Extractor — YouTube + Reddit, One Schema (+AI) (`scraper_pro_max/multi-platform-comments-extractor`) Actor

- **URL**: https://apify.com/scraper\_pro\_max/multi-platform-comments-extractor.md
- **Developed by:** [Александр Нестеров](https://apify.com/scraper_pro_max) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.70 / 1,000 comment-results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

### Comments Extractor — YouTube + Reddit, One Schema (+AI)

Extract comments from YouTube videos and Reddit posts into a single normalized schema — author, text, likes/score, reply count, posted date, and URLs — so you don't have to write separate parsers for each platform. An optional AI pass tags every comment with sentiment and an intent flag (spam/lead/complaint).

#### What it does

Give the actor a list of YouTube video URLs and/or Reddit post URLs. For each one it pulls the top-level comments (YouTube via its comment endpoint, Reddit via the Arctic Shift API) and maps them into one common row shape, so a downstream pipeline that consumes "comments" doesn't need platform-specific branching. Raw comment extraction is the core product; AI tagging is an add-on you switch on per run, not a separate actor.

#### Input

- **YouTube video URLs** (`youtubeUrls`) — full URLs or bare 11-character video IDs.
- **Reddit post URLs** (`redditUrls`) — post URLs in the `…/comments/<id>/…` form.
- **Max comments per video/post** (`maxCommentsPerContent`) — how many comments to pull from each item (default 50, 1–1000). You are charged per comment actually returned.
- **AI: tag sentiment + intent** (`enrichComments`) — boolean, off by default. When on, each comment gets a `sentiment` (positive/neutral/negative) and a `flag` (spam/lead/complaint/none).
- **Your OpenAI API key** (`openaiApiKey`) — optional, secret field. If you supply your own OpenAI-compatible key, the AI pass runs on your account and you pay your provider directly. Leave it empty and the actor still tags every comment: it falls back to a built-in classifier (a bundled key if configured, otherwise a free deterministic lexicon classifier) — enrichment always returns a value, it's never blocked on a missing key.
- **AI model** (`aiModel`) — optional override of the model used for AI tagging (default `gpt-4o-mini`); only applies when a key is available.
- **Proxy configuration** (`proxyConfiguration`) — Apify Proxy, defaults to RESIDENTIAL. Used for the YouTube path; Reddit's public API needs no proxy.

#### Output fields

One row per comment: `platform` (`youtube`/`reddit`), `content_url` (the source video/post), `comment_id`, `comment_url` (direct link to the comment), `author`, `author_url`, `text`, `likes` (YouTube like count / Reddit score), `reply_count`, `posted_at`, `sentiment`, `flag`, and `scraped_at`. `sentiment`/`flag` are populated only when AI tagging is switched on — otherwise they come back empty.

#### Pricing

Pay-per-result — you're charged one `comment-result` event per comment returned (unresolved/skipped items are not charged). See the Store pricing tab for the current per-comment rate.

#### Notes

- Reddit posts are fetched entirely via a public API — no login or proxy required for that side.
- YouTube goes through Apify Proxy (RESIDENTIAL by default).
- The AI add-on never blocks output: if no API key is present, comments still ship with a deterministic sentiment/flag rather than an error.
- TikTok, Instagram, and Facebook comments are not covered by this actor — only YouTube and Reddit.

# Actor input Schema

## `youtubeUrls` (type: `array`):

YouTube video URLs or 11-char IDs to pull comments from.

## `redditUrls` (type: `array`):

Reddit post URLs (…/comments/<id>/…) to pull comments from.

## `maxCommentsPerContent` (type: `integer`):

How many comments to pull from each video/post. You are charged per returned comment.

## `enrichComments` (type: `boolean`):

Add a sentiment (positive/neutral/negative) and intent flag (spam/lead/complaint) to each comment. Uses a batched, low-cost model. Off = raw comments only.

## `openaiApiKey` (type: `string`):

Optional: bring your own OpenAI-compatible API key for the AI pass (you pay your provider directly). Leave empty to use the built-in AI, or a free deterministic classifier if AI is unavailable.

## `aiModel` (type: `string`):

Override the model used for AI tagging (default gpt-4o-mini). Only used when an API key is available.

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

Used for YouTube (Reddit's open API needs none). Leave default RESIDENTIAL.

## Actor input object example

```json
{
  "youtubeUrls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "redditUrls": [],
  "maxCommentsPerContent": 50,
  "enrichComments": false,
  "aiModel": "",
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

## `results` (type: `string`):

Dataset of comments (platform, author, text, likes, reply\_count, posted\_at, comment\_url, content\_url, sentiment, flag).

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

// Run the Actor and wait for it to finish
const run = await client.actor("scraper_pro_max/multi-platform-comments-extractor").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 = {
    "youtubeUrls": ["https://www.youtube.com/watch?v=dQw4w9WgXcQ"],
    "redditUrls": [],
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("scraper_pro_max/multi-platform-comments-extractor").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 '{
  "youtubeUrls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "redditUrls": [],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call scraper_pro_max/multi-platform-comments-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,scraper_pro_max/multi-platform-comments-extractor"
        }
    }
}
```

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/GD13Wh1AXRqSSRnsZ/builds/WYgzRY1u3MG0MMWBw/openapi.json
