# Instagram Comments Scraper (`opspilot.cc/instagram-comments-scraper`) Actor

💬 Instagram Comments Scraper | Every comment on a post, with the brand's replies flagged Paste post URLs (or bare shortcodes) and get one row per comment: author, likes, reply count, timestamp, country, hashtags — plus an `isFromPostOwner` flag so you can separate the brand's own replies from real…

- **URL**: https://apify.com/opspilot.cc/instagram-comments-scraper.md
- **Developed by:** [wang wei](https://apify.com/opspilot.cc) (community)
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.005 / actor start

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

## 💬 Instagram Comments Scraper

> Every comment on a post, with the brand's own replies flagged — one clean row per comment.

### ✨ What you get

One dataset row per comment:

| Field | What it is |
|---|---|
| `commentId` | identifier |
| `postShortcode` / `url` | which post the comment belongs to |
| `text` / `isTextOnly` | comment body; `isTextOnly: false` marks emoji-only reactions so sentiment tools can skip them |
| `likeCount` / `replyCount` | engagement on the comment itself |
| `username` / `userId` / `isVerified` | who wrote it |
| **`isFromPostOwner`** | `true` when the account itself wrote it — separates brand replies from customer feedback |
| `createdAt` / `createdAtUtc` / `ipCountry` | timing and geography |
| `hashtags` | hashtags detected in the comment |

The run summary adds per-post stats: how many comments came from customers vs the account, how many were emoji-only, median likes, median replies, the post's own reported comment total, and the top comment.

### 💼 Use cases

- **Hearing only the customer, not your own replies** — a post with 522 reported comments is mostly a mix of fan reactions and brand replies. Filter `isFromPostOwner = false` and you get the customer voice alone, which is the only version worth putting in front of a product team.
- **Deciding which post launch actually landed** — run `sortBy: popular` across the posts from a launch and compare median comment likes and median replies. A post with 30 comments and a median of 40 likes on them did more work than a post with 200 comments nobody replied to.
- **Finding out where your buyers sit** — `ipCountry` on every comment row turns a thread into a geographic read. One run over up to 100 post URLs tells you which markets are actually talking about the product.
- **Building the answer bank from questions that keep repeating** — comments carry `hashtags` and free text, so the same objection appearing under 12 different posts is a pattern you can route into a pinned reply or an FAQ page.

### ✅ Who this is for

- **In-house social and community managers**— who need the raw voice under a post without a listening platform subscription, and who can filter the brand's own replies out in one predicate.
- **Support leads** who want to know which complaints are showing up in public — a complaint that appears under four posts is an escalation, not a ticket.
- **Agencies pitching social content**— to clients who need per-post comment statistics (median likes, median replies, customer-vs-account split) rather than a vanity dashboard screenshot.
- **Consumer brands running launch or UGC campaigns**— who must know whether the conversation under a creator's post is positive, negative, or simply absent.

### ❌ Who this is NOT for

- **A complete comment archive** — this returns what you asked for, capped at `maxCommentsPerPost` (1–200, default 50), while the summary still prints the post's own reported total. When a post reports 522 and you hold 50 rows, the other 472 are unfetched, not non-existent. Raise the cap and re-run if the thread matters.
- **Sentiment or text analysis on the raw dump** — emoji-only reactions are kept with empty text and `isTextOnly: false`. Run them through a text model unfiltered and they dilute every score.
- **Reading a reply as evidence of a reply thread** — nested threads are flattened, so a comment showing `replyCount: 3` with no matching child rows means you stopped paging early, not that nobody replied. Count rows as rows, not as conversations.
- **Audience or follower research** — a commenter is not a follower. This Actor tells you who spoke under a post; it does not enumerate an account's followers, and the `ipCountry` on a comment is the commenter's location, not a demographic profile.
- **Any platform other than Instagram** — post URLs and `/reel/<code>/` shortcodes only. TikTok, YouTube and X comments are different endpoints with different shapes; use the matching scraper.

### 🚀 Quick start

1. Open the Actor and press **Start** (defaults pull the comments of one public post).
2. Paste post URLs — `https://www.instagram.com/p/<code>/`, `/reel/<code>/` or a bare shortcode all work.
3. Filter the dataset on `isFromPostOwner = false` to get customer feedback only.

### 📥 Input parameters

| Parameter | Type | Default | What it does |
|---|---|---|---|
| `postUrls` | list | one public post | Post URLs or shortcodes, one per line, up to 100 posts per run. |
| `maxCommentsPerPost` | number | `50` | 1–200 comments per post. A run-wide request budget (12 free / 40 paid) also caps total upstream calls; see Billing. |
| `sortBy` | select | `recent` | `recent` for timeline analysis, `popular` to see what resonated. |

### 📤 Output

- **Dataset** — one row per comment (or a notice when nothing was collected)
- **SUMMARY** — per-post comment statistics, request counts and warnings

### ⚙️ How it works

1. Each input is reduced to the post shortcode (profile URLs are rejected rather than misread as posts).
2. Comments are paged through Instagram's own pagination until the cap or the end of the thread.
3. Field names are normalised (`comment_like_count` → `likeCount`) and rows without an id are dropped.
4. Emoji-only comments and account replies are flagged, not discarded — you decide what to do with them.

### 💰 Billing

**Billed per run.** A single `apify-actor-start` charge applies when the run begins, at the price shown on this Actor's page. A run that returns 300 rows costs the same as one that returns 3. There is no daily run cap.

**Free plan limit.** One run collects comments for **5 posts over 3 pages, 60 comments each**. That is a hard ceiling on the upstream cost, so it cannot be raised from the input form. A capped run still succeeds: it writes a `notice` row to the dataset, sets `appliedLimits.capped: true` in `SUMMARY`, and logs why. Any paid Apify plan lifts the cap to 100 posts over 12 pages and 200 comments each.

**Run-wide request budget.** On top of the per-item caps, every run has a fixed ceiling on upstream requests in total — **12 on the free plan, 40 on paid Apify plans** — shared by all accounts, keywords, hashtags or posts in that run, and counting retries. A single item can still walk all of its pages; only wide multi-item runs are compressed. Hitting the ceiling is reported, not hidden: the run still succeeds, delivers everything fetched so far, writes a `type: "notice"` row, and sets `SUMMARY.budgetExhausted: true` alongside `SUMMARY.maxRequestsPerRun` and `SUMMARY.upstreamRequests`.

The per-item figures above are upper bounds, not a promise for every run: when a run supplies the maximum number of items, the shared budget is reached first and fewer items are completed. `SUMMARY.upstreamRequests` reports exactly how many upstream requests were used.

### ❓ FAQ

**Does it include replies to comments?**
Each comment row carries a `replyCount`, and the thread is paged in order, so replies appear as their own rows. Nested reply threads are flattened rather than nested.

**Why are some comments empty?**
They are usually emoji-only reactions. They are kept (with `isTextOnly: false`) because they are still engagement data, but filter them out for text analysis.

**How do I tell customer comments from the brand's replies?**
Filter on `isFromPostOwner`. The run summary already gives you the split per post.

**What does "post reports 522" mean in the summary?**
That is the comment count Instagram shows for the post itself, while the collected rows are only what you asked for. The gap tells you how much is left to fetch.

**Can I run this on many posts at once?**
Yes, up to 100 post URLs per run. Requests are spaced out to respect Instagram's rate limits, and a failing post is reported in `warnings` without stopping the others.

### 📚 Resources

- Apify free plan: monthly credit covers usage, no separate daily cap

# Changelog

This Actor's version history is a separate document: https://apify.com/opspilot.cc/instagram-comments-scraper/changelog.md

# Actor input Schema

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

Accepts https://www.instagram.com/p/<code>/, /reel/<code>/ or the bare shortcode — one per line, up to 100 posts per run.

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

How many comments to collect per post. A run-wide request budget (12 free / 40 paid) also caps total upstream calls; see Billing.

## `sortBy` (type: `string`):

Recent for timeline analysis, popular to see what resonates.

## Actor input object example

```json
{
  "postUrls": [
    "https://www.instagram.com/p/DdG4RIxIPyf/"
  ],
  "maxCommentsPerPost": 50,
  "sortBy": "recent"
}
```

# Actor output Schema

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

One row per comment, or a single notice when nothing was collected.

## `summary` (type: `string`):

Per-post comment stats, owner vs customer split, request counts and warnings.

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("opspilot.cc/instagram-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 = {}

# Run the Actor and wait for it to finish
run = client.actor("opspilot.cc/instagram-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 '{}' |
apify call opspilot.cc/instagram-comments-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,opspilot.cc/instagram-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/jpCtnpzUhPfe4iSVF/builds/uxRALoUZIBdms8sVu/openapi.json
