# Social Media Comments Scraper (`scrapeforge/social-comments-scraper`) Actor

Extract comments and replies from Facebook, Instagram, LinkedIn, and YouTube posts in one run. Automatically detects the platform from each URL and returns a unified, consistent output. Ideal for social listening, brand monitoring, and audience research. Export to JSON, CSV, or Excel.

- **URL**: https://apify.com/scrapeforge/social-comments-scraper.md
- **Developed by:** [ScrapeForge](https://apify.com/scrapeforge) (community)
- **Categories:** Agents, Social media, MCP servers
- **Stats:** 2 total users, 2 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.50 / 1,000 youtube comments

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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

### Social Media Comments Scraper

Extract comments from **Facebook, Instagram, LinkedIn, and YouTube** posts with a single Actor. Paste the post URLs — you can mix platforms in the same run — and the Actor automatically detects each social network and returns its comments in one consistent, unified format. Export to JSON, CSV, or Excel with no coding required.

### Use cases

- **Social listening** — Monitor what audiences say under your posts and your competitors' across several networks at once.
- **Reputation management** — Spot negative comments, complaints, or emerging crises close to real time.
- **Audience research** — Understand who comments, which topics drive the most conversation, and in what tone.
- **Reporting & insights** — Collect structured comment datasets for social listening reports, market research, or coverage analysis.
- **Competitive benchmarking** — Compare conversation volume and sentiment across brands or campaigns.
- **AI analysis** — Feed sentiment, classification, or summarization models with clean, normalized comments.

### Features

- **Four platforms, one Actor** — Facebook, Instagram, LinkedIn, and YouTube in the same run.
- **Automatic platform detection** — Paste any post URL and the Actor identifies the network and handles it accordingly.
- **Comments and replies** — Download comments and, optionally, the replies to each one.
- **Configurable sorting** — Choose most relevant or most recent on YouTube and LinkedIn.
- **Per-post limits** — Control how many comments and replies to fetch per post to fine-tune volume and cost.
- **Unified output** — Every comment shares the same schema, regardless of the source platform.
- **Run summary** — Each run saves a summary with per-platform counts.

### Input

| Field | Description | Default |
|-------|-------------|---------|
| **Post URLs** | List of post URLs. You can mix platforms. | — |
| **Max comments per post** | Maximum top-level comments per post. `0` = all. | `0` |
| **Max replies per comment** | Maximum replies per comment. `0` = do not fetch replies. Not available on Instagram. | `0` |
| **YouTube sort order** | `top` (most relevant) or `newest` (most recent). | `top` |
| **LinkedIn sort order** | `date` (most recent) or `relevance` (most relevant). | `date` |

Supported URL formats:
- **Facebook**: `facebook.com/.../posts/...`, `/reel/...`, `fb.watch/...`
- **Instagram**: `instagram.com/p/...`, `/reel/...`, `/tv/...`
- **LinkedIn**: `linkedin.com/posts/...`, `linkedin.com/feed/update/urn:li:activity:...`
- **YouTube**: `youtube.com/watch?v=...`, `youtu.be/...`, `/shorts/...`

#### Input example

```json
{
    "postUrls": [
        "https://www.youtube.com/watch?v=VIDEO_ID",
        "https://www.instagram.com/p/POST_ID/",
        "https://www.linkedin.com/posts/user_activity-123",
        "https://www.facebook.com/page/posts/123"
    ],
    "maxCommentsPerPost": 100,
    "maxRepliesPerComment": 10,
    "youtubeSortBy": "newest",
    "linkedinSortBy": "date"
}
````

### Output

Each comment is a dataset item with a unified schema across platforms. Replies are returned as their own items with `isReply: true` and the `parentCommentId` of their parent comment.

```json
{
    "platform": "youtube",
    "postUrl": "https://www.youtube.com/watch?v=VIDEO_ID",
    "commentId": "Ugxxxxxxxxxxxx",
    "parentCommentId": null,
    "isReply": false,
    "text": "Great content, congrats!",
    "publishedAt": "2 days ago",
    "likeCount": 42,
    "replyCount": 3,
    "reactions": {},
    "author": {
        "id": "UCxxxxxxxxxxxx",
        "name": "Author name",
        "username": "",
        "profileUrl": "https://www.youtube.com/channel/UCxxxxxxxxxxxx",
        "avatarUrl": "https://...",
        "isVerified": true
    },
    "extra": {},
    "scrapedAt": "2026-07-07T12:00:00.000Z"
}
```

- **platform** — the comment's social network (`facebook`, `instagram`, `linkedin`, `youtube`).
- **text / publishedAt** — the comment's content and date. On YouTube the date is relative ("2 days ago"); on the other platforms it is ISO 8601.
- **likeCount / replyCount / reactions** — the comment's interaction metrics.
- **author** — author details (name, username, profile, avatar, verified status).
- **extra** — platform-specific fields (e.g., author type on LinkedIn, or whether a YouTube comment is pinned).

When it finishes, the Actor saves a `RUN_SUMMARY` record with the total number of comments, per-platform counts, and any URLs that could not be processed.

### Pricing

This Actor charges **per event**, with an independent price per platform: each Facebook, Instagram, LinkedIn, or YouTube comment or reply has its own rate, plus a small charge when the run starts. You only pay for the comments actually downloaded.

### FAQ

**Can I mix platforms in a single run?**
Yes. Put Facebook, Instagram, LinkedIn, and YouTube URLs together in `Post URLs`; each one is processed with the right handling.

**Does it download replies to comments?**
Yes, optionally. Adjust `Max replies per comment`. Instagram does not allow downloading replies to comments.

**How many comments can I get per post?**
As many as you want: use `Max comments per post` to cap the volume (and cost), or leave it at `0` to fetch all available.

**What happens if a URL is invalid or not recognized?**
It is skipped and recorded in the run summary; the rest of the URLs are processed normally.

**Can I schedule recurring runs?**
Yes. Use Apify's built-in scheduler to run the Actor daily, weekly, or on a custom schedule, and integrate the results with Google Sheets, Slack, webhooks, or other tools.

### Disclaimer

This Actor is an unofficial tool and is not affiliated with, endorsed by, or sponsored by Meta, LinkedIn, Google/YouTube, or their affiliates. All product names, trademarks, and registered trademarks are the property of their respective owners. Use this Actor responsibly and in compliance with each platform's Terms of Service and applicable data protection regulations.

# Actor input Schema

## `postUrls` (type: `array`):

List of post URLs. You can mix platforms: Facebook (facebook.com/.../posts/..., /reel/...), Instagram (/p/..., /reel/...), LinkedIn (/posts/..., /feed/update/urn:li:activity:...) and YouTube (watch?v=..., youtu.be/..., /shorts/...).

## `maxCommentsPerPost` (type: `integer`):

Maximum number of top-level comments per post. 0 = all available.

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

Maximum number of replies to download per comment. 0 = do not download replies. Supported on Facebook, LinkedIn, and YouTube. Instagram does not allow downloading replies to comments.

## `youtubeSortBy` (type: `string`):

Sort order for YouTube comments.

## `linkedinSortBy` (type: `string`):

Sort order for LinkedIn comments.

## `proxy` (type: `object`):

Proxy configuration. We recommend keeping Apify Proxy enabled for better stability.

## Actor input object example

```json
{
  "postUrls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "maxCommentsPerPost": 0,
  "maxRepliesPerComment": 0,
  "youtubeSortBy": "top",
  "linkedinSortBy": "date",
  "proxy": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `comments` (type: `string`):

Dataset with all extracted comments and replies, normalized across platforms

## `runSummary` (type: `string`):

Per-platform counts and any skipped URLs for this run

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

// Run the Actor and wait for it to finish
const run = await client.actor("scrapeforge/social-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 = { "postUrls": ["https://www.youtube.com/watch?v=dQw4w9WgXcQ"] }

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

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Social Media Comments Scraper",
        "description": "Extract comments and replies from Facebook, Instagram, LinkedIn, and YouTube posts in one run. Automatically detects the platform from each URL and returns a unified, consistent output. Ideal for social listening, brand monitoring, and audience research. Export to JSON, CSV, or Excel.",
        "version": "0.1",
        "x-build-id": "DepOZRChpWjCNsPAC"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/scrapeforge~social-comments-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-scrapeforge-social-comments-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/scrapeforge~social-comments-scraper/runs": {
            "post": {
                "operationId": "runs-sync-scrapeforge-social-comments-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/scrapeforge~social-comments-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-scrapeforge-social-comments-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "postUrls"
                ],
                "properties": {
                    "postUrls": {
                        "title": "Post URLs",
                        "type": "array",
                        "description": "List of post URLs. You can mix platforms: Facebook (facebook.com/.../posts/..., /reel/...), Instagram (/p/..., /reel/...), LinkedIn (/posts/..., /feed/update/urn:li:activity:...) and YouTube (watch?v=..., youtu.be/..., /shorts/...).",
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxCommentsPerPost": {
                        "title": "Max comments per post",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Maximum number of top-level comments per post. 0 = all available.",
                        "default": 0
                    },
                    "maxRepliesPerComment": {
                        "title": "Max replies per comment",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Maximum number of replies to download per comment. 0 = do not download replies. Supported on Facebook, LinkedIn, and YouTube. Instagram does not allow downloading replies to comments.",
                        "default": 0
                    },
                    "youtubeSortBy": {
                        "title": "YouTube: comment sort order",
                        "enum": [
                            "top",
                            "newest"
                        ],
                        "type": "string",
                        "description": "Sort order for YouTube comments.",
                        "default": "top"
                    },
                    "linkedinSortBy": {
                        "title": "LinkedIn: comment sort order",
                        "enum": [
                            "date",
                            "relevance"
                        ],
                        "type": "string",
                        "description": "Sort order for LinkedIn comments.",
                        "default": "date"
                    },
                    "proxy": {
                        "title": "Proxy configuration",
                        "type": "object",
                        "description": "Proxy configuration. We recommend keeping Apify Proxy enabled for better stability.",
                        "default": {
                            "useApifyProxy": true
                        }
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
