# Instagram Comment Scraper (`herus13/instagram-comment-scraper`) Actor

Extract comments from any public Instagram post or reel, or from a profile's recent posts. Every row carries comment.text, comment.owner_username, comment.like_count, comment.reply_count, comment.created_at and the comment.parent_id that rebuilds reply threads. Export JSON, CSV or Excel.

- **URL**: https://apify.com/herus13/instagram-comment-scraper.md
- **Developed by:** [herus13](https://apify.com/herus13) (community)
- **Categories:** Social media, Developer tools, Automation
- **Features:** Limited permissions
- **Stats:** 145 total users, 17 monthly users, 93.9% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.80 / 1,000 comment scrapeds

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

The Instagram Comment Scraper extracts comments from public Instagram posts and reels. Point it at a post URL or a username and every comment comes back with its text, author, like count, reply count, timestamp, and the parent comment ID that links a reply to the thread it belongs to.

### What you get

One row per comment, exactly as a JSON export returns it.

```json
{
  "comment": {
    "pk": "17919229620205994",
    "text": "Those are my initials too 👽",
    "created_at": "2026-08-03T02:31:51Z",
    "like_count": 0,
    "reply_count": 0,
    "parent_id": null,
    "owner_username": "an_instagram_user",
    "owner_is_verified": false
  },
  "post_shortcode": "Dbdo4gTupuE",
  "post_url": "https://www.instagram.com/p/Dbdo4gTupuE/",
  "scraped_at": "2026-08-03T09:12:00+00:00",
  "_meta": {"author": "https://apify.com/herus13", "status": "ok", "message": null}
}
```

`_meta` is run metadata, not scraped data. A target that fails appears as a row with only `_meta` (status `failed`, the reason in `message`); those rows are never charged.

The table and CSV views flatten `comment` into columns of their own — `comment.text`, `comment.like_count` and the rest — so a spreadsheet gets one flat row per comment. Replies come back as rows of their own, with `parent_id` set to the `pk` of the comment they answer, so a thread can be rebuilt exactly rather than flattened into one undifferentiated list.

> The sample is a real captured row, trimmed to the fields the dataset view
> shows, with the commenter's handle replaced by a placeholder: a private
> individual's username does not belong in public documentation. The post
> owners named elsewhere (`nike`, `zara`) are public brand accounts.

### What it costs

| Event | Free | Bronze | Silver | Gold+ |
|---|---|---|---|---|
| Comment scraped (`comment-scraped`) | $0.0025 | $0.0022 | $0.002 | $0.0018 |
| Actor Start (`apify-actor-start`) | $0.005 | $0.005 | $0.005 | $0.005 |

You pay per comment delivered, not for time. A thousand comments cost about $2.51 and five thousand about $12.51 on the Free tier ($1.81 and $9.01 from Gold upward), with the residential proxy included in those prices. A post that returns nothing is never charged.

### Input

| Field | Type | Required | Default | What it does |
|---|---|---|---|---|
| `targets` | array | yes | — | What to scrape, one entry per line. A post or reel URL (https://instagram.com/p/ABC123/) returns the comments on that post, and so does the bare id from that URL (DddlDOVRGLj) on its own. A username (nike) returns the comments on that profile's recent posts, as many posts as max_posts allows. Both forms can be mixed in one run, and every comment returned becomes one dataset row. Required. |
| `max_comments` | integer | no | `50` | How many comments to return for each post, from 1 to 1000. Default 50. Replies count towards the cap, and a higher cap makes a run longer and more expensive, so 50 to 200 per post is a good place to start. A post with fewer comments than the cap simply returns what it has. |
| `max_posts` | integer | no | `12` | For a username in targets, how many of that profile's recent posts to collect comments from, from 1 to 100. Default 12. A post or reel URL always uses just that post, so this setting does not change it. |
| `proxyUrls` | array | no | — | Leave empty and the run uses the residential proxy that comes included in the price of the run. To route the run through your own provider instead, add one gateway URL per entry, for example http://user:pass@host:port. Any provider that issues URLs works. When set, the run uses these first and switches to the included proxy if they stop working, so a broken proxy never fails the run. |

### How to run it

1. Open the actor on Apify Console.
2. Put your post and reel URLs, or usernames, into **Post URLs or Usernames**.
3. Set **Max Comments Per Post** — `50` by default — and, for usernames, **Max Posts Per Username**.
4. Run. Export JSON, CSV or Excel from the dataset.

```json
{
  "targets": ["https://www.instagram.com/p/Dbdo4gTupuE/", "nike"],
  "max_comments": 100,
  "max_posts": 5
}
```

Minimal input:

```json
{
  "targets": ["https://www.instagram.com/p/Dbdo4gTupuE/"]
}
```

Available as the MCP tool `herus13--instagram-comment-scraper` on mcp.apify.com and through the Apify API; send the same JSON.

### Why this scraper

- **Threads survive the export.** Every reply carries the ID of the comment it answers, so who replied to whom is still readable after the data leaves Instagram.
- **A post link or a handle.** Collect one campaign post, or walk a profile's recent posts, from the same input list.
- **Nothing to sign in with.** No Instagram account and no cookie are needed, so nothing of yours is exposed to the run.
- **Flat rows, ready for a spreadsheet.** One comment per row with a stable column set — no reshaping before a pivot table or a BI tool.
- **Residential proxy included** in the price of the run, with your own gateway URLs accepted when you prefer them.

### Use cases

- **Sentiment analysis on real audience reaction** — comments carry the unfiltered response to a post in a way like counts never do, and the text, author, like count and timestamp come back structured and ready to classify.
- **Thread reconstruction** — the parent comment ID on every reply lets a conversation be rebuilt rather than flattened, which matters whenever who was answering whom is part of the question.
- **Community management triage** — point it at your own recent posts and surface the comments with the most likes or replies, the ones worth a response, on a schedule.
- **Competitor audience research** — a competitor's comment section shows what their customers ask for and complain about, and which posts provoked a conversation instead of passive likes.
- **Campaign measurement** — re-read a campaign post every few hours and watch the comment section fill, with the text and the counts kept for each pass.

### FAQ

**Do I need an Instagram account?** No. The actor returns only what a public post's comment section shows to anyone, so there is nothing to sign in with and no credential to store.

**Are replies included?** Yes. A reply is its own row with `comment.parent_id` pointing at the `comment.pk` of the comment it answers, so full threads can be reassembled.

**How many comments can I get per post?** Up to `1000`, capped by **Max Comments Per Post** (default `50`). Posts with tens of thousands of comments are best started at 50 to 200 and raised once you have seen a run finish.

**Am I charged for posts that return nothing?** No. You pay per comment delivered; a post that is missing or private costs nothing and gets only a `_meta` row; an empty post gets no row; the run log names each one and why.

**Is a proxy included?** A residential proxy is included in the price of the run. To use your own, paste gateway URLs into **Your own proxy URLs**.

**What happens if my input is wrong?** The run stops before it scrapes anything, so no results are charged. Its status and log name each field that is wrong and say what to change — fix the input and run again.

**Is scraping Instagram comments legal?** This actor collects only publicly available data. You are responsible for complying with Instagram's terms and applicable laws, including GDPR and CCPA, and for not collecting personal data without a lawful basis.

### Related actors

- **[Instagram Post Scraper](https://apify.com/herus13/instagram-post-scraper)** — posts and reels by username or URL, with captions, likes, comments counts and media URLs.
- **[Instagram Profile Scraper](https://apify.com/herus13/instagram-profile-scraper)** — public profiles with biography, follower and following counts, verified and business flags, and recent posts.
- **[TikTok Profile Scraper](https://apify.com/herus13/tiktok-profile-scraper)** — public TikTok profiles by handle, for cross-platform social monitoring.

# Actor input Schema

## `targets` (type: `array`):

What to scrape, one entry per line. A post or reel URL (https://instagram.com/p/ABC123/) returns the comments on that post, and so does the bare id from that URL (DddlDOVRGLj) on its own. A username (nike) returns the comments on that profile's recent posts, as many posts as max_posts allows. Both forms can be mixed in one run, and every comment returned becomes one dataset row. Required.

## `max_comments` (type: `integer`):

How many comments to return for each post, from 1 to 1000. Default 50. Replies count towards the cap, and a higher cap makes a run longer and more expensive, so 50 to 200 per post is a good place to start. A post with fewer comments than the cap simply returns what it has.

## `max_posts` (type: `integer`):

For a username in targets, how many of that profile's recent posts to collect comments from, from 1 to 100. Default 12. A post or reel URL always uses just that post, so this setting does not change it.

## `proxyUrls` (type: `array`):

Leave empty and the run uses the residential proxy that comes included in the price of the run. To route the run through your own provider instead, add one gateway URL per entry, for example http://user:pass@host:port. Any provider that issues URLs works. When set, the run uses these first and switches to the included proxy if they stop working, so a broken proxy never fails the run.

## Actor input object example

```json
{
  "targets": [
    "https://www.instagram.com/p/Dbdo4gTupuE/"
  ],
  "max_comments": 50,
  "max_posts": 12
}
```

# Actor output Schema

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

Instagram comments with text, author, likes, replies, timestamp, and post context. Each row also carries \_meta: run metadata, not scraped data.

# 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 = {
    "targets": [
        "https://www.instagram.com/p/Dbdo4gTupuE/"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("herus13/instagram-comment-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 = { "targets": ["https://www.instagram.com/p/Dbdo4gTupuE/"] }

# Run the Actor and wait for it to finish
run = client.actor("herus13/instagram-comment-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 '{
  "targets": [
    "https://www.instagram.com/p/Dbdo4gTupuE/"
  ]
}' |
apify call herus13/instagram-comment-scraper --silent --output-dataset

```

## MCP server setup

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