# Instagram Comments Scraper - Cheaper (`xtracto/instagram-post-comments-scraper`) Actor

Fetch comments for any public Instagram post / reel / IGTV — author, text, like count, reply count, timestamp — with automatic pagination. No login required, Fast Http only scraper.

- **URL**: https://apify.com/xtracto/instagram-post-comments-scraper.md
- **Developed by:** [Xtractoo](https://apify.com/xtracto) (community)
- **Categories:** Social media
- **Stats:** 1 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.80 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## Instagram Post Comments Scraper

Pull all public comments from any Instagram post, reel, or IGTV in bulk — comment text, author, like count, reply count, timestamp — with automatic pagination through hundreds of comments. No login or API key required.

### Why use this actor

- **No account / no login required** — just give it a shortcode or post URL.
- **Far beyond the 12-comment web preview** — paginates through the full comments section via cursor, so you can pull hundreds or thousands of comments per post.
- **Bulk input** — pass a list of posts in one run; each comment streams in as its own dataset row, tagged with the post shortcode for easy joining.
- **Stable JSON output** — every row carries `_input`, `_mediaId`, `_source`, and `_scrapedAt` envelope fields so you can join results back to your input list.
- **Rich author info** — comment author username, full name, verified status, and profile picture URL included inline.
- **Datacenter proxy friendly** — works from cheap DC IPs, no residential proxy needed.
- **Automatic retries** — transient failures retry with exponential backoff; private posts or deleted posts return structured `_error` records.

### How it works

1. You provide a list of Instagram posts (shortcode like `DYSM8J5yzSj` or full URL like `https://www.instagram.com/p/DYSM8J5yzSj/`).
2. The actor decodes each shortcode to its internal media ID, then walks the post's comments via cursor pagination, streaming each comment as its own dataset row.
3. Pagination stops when `maxComments` is reached or the post runs out of comments.

You do not need to manage scrapers, browsers, or rotating IPs — all handled internally.

### Input

```json
{
  "posts": [
    "https://www.instagram.com/p/DYSM8J5yzSj/",
    "DYP-BHSPCfn"
  ],
  "maxComments": 50,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": ["DATACENTER"]
  }
}
````

| Field | Type | Description |
|---|---|---|
| `posts` | array | List of Instagram posts. Each entry can be a shortcode (e.g. `DYSM8J5yzSj`) or a full URL on `/p/`, `/reel/`, or `/tv/`. Bulk input is supported. |
| `maxComments` | integer | Max top-level comments per post. Pagination is automatic. Default `50`. Set to `0` for unlimited (walks the entire comments section). |
| `proxyConfiguration` | object | Apify Proxy settings. Datacenter proxy works fine. |

### Output

Input: `DYSM8J5yzSj`

One dataset row per comment:

```json
{
  "_input": "DYSM8J5yzSj",
  "_mediaId": "3896233537988932771",
  "_source": "S1-primary",
  "_scrapedAt": "2026-05-18T18:27:08.557199+00:00",
  "id": "18125377714533878",
  "text": "Incredible!",
  "createdAt": 1779128299,
  "likeCount": 0,
  "replyCount": null,
  "hasMoreHeadChildren": null,
  "user": {
    "id": "80110440628",
    "username": "canadianstudentliving",
    "fullName": null,
    "isVerified": false,
    "profilePicUrl": "https://scontent.cdninstagram.com/v/t51.82787-19/..."
  }
}
```

| Field | Type | Description |
|---|---|---|
| `_input` | string | The post shortcode or URL exactly as you supplied it. |
| `_mediaId` | string | Instagram's internal media ID (decoded from the shortcode). Stable; use it to join comments to a post detail record. |
| `_source` | string | Internal tag for the path used (`S1-primary`). |
| `_scrapedAt` | string | ISO-8601 UTC timestamp when this comment was scraped. |
| `id` | string | Comment's stable numeric ID. |
| `text` | string | The comment body. Plain text including emojis (no HTML). |
| `createdAt` | integer | Unix epoch seconds when the comment was posted. |
| `likeCount` | integer | Number of likes the comment has received. |
| `replyCount` | integer|null | Number of replies to this comment. `null` when not exposed by Instagram. |
| `hasMoreHeadChildren` | boolean|null | `true` if Instagram has trimmed nested replies (more available than shown). |
| `user` | object | Comment author profile: `id`, `username`, `fullName`, `isVerified`, `profilePicUrl`. |

#### Error envelope

Posts that don't exist, are private, or fail to fetch return a structured error instead of crashing the run:

```json
{
  "_input": "https://www.instagram.com/p/this-does-not-exist/",
  "_mediaId": "0",
  "_error": "fetch_failed",
  "_errorDetail": "NotFound graphql PolarisPostCommentsContainerQuery",
  "_source": "S1-primary",
  "_scrapedAt": "2026-05-18T18:30:00.000000+00:00"
}
```

| `_error` value | When |
|---|---|
| `invalid_input` | The shortcode could not be parsed from the input string. |
| `fetch_failed` | The post does not exist, is private, or Instagram rate-limited the request. Retry with proxy rotation. |

### Pricing

This actor is billed per result: **$6.00 per 1,000 comments** (Tier 4 — Instagram requires warm-page token harvesting and the GraphQL query ID rotates every 2–4 weeks, so the actor needs active maintenance). Each comment returned = 1 result. Error envelope records are not billed.

### Other Sosmed Actors

| Platform | Actor | Best for |
|---|---|---|
| Instagram | [Instagram Post Detail Scraper](https://apify.com/xtracto/instagram-post-detail-scraper) | The post itself — caption, media URLs, like count, owner |
| Instagram | [Instagram Account Scraper](https://apify.com/xtracto/instagram-account-scraper) | Profile metadata for an IG handle |
| Instagram | [Instagram Account Posts Scraper](https://apify.com/xtracto/instagram-account-posts-scraper) | Paginated post timeline for a user |
| YouTube | [YouTube Video Comments Scraper](https://apify.com/xtracto/youtube-video-comments-scraper) | Comments tree for any YouTube video |
| Reddit | [Reddit Post Detail Scraper](https://apify.com/xtracto/reddit-post-detail-scraper) | Reddit post body + comment thread |
| Facebook | [Facebook Post Detail Scraper](https://apify.com/xtracto/facebook-post-detail) | FB post text + reactions + share counts |
| Threads | [Threads Account Replies Scraper](https://apify.com/xtracto/threads-account-replies-scraper) | A user's reply chain on Threads |

Browse the full catalog at [apify.com/xtracto](https://apify.com/xtracto).

### Notes

- **Top-level comments only.** Each row is a top-level comment. The `replyCount` field tells you how many replies a comment has, but the replies themselves are not flattened into the dataset.
- **Pagination is automatic** via Instagram's cursor. The actor stops when it hits `maxComments` or the post has no more comments.
- **Rate limiting.** Heavy concurrent runs against one IP can trigger Instagram's anti-abuse. Use Apify Proxy and keep concurrency modest (≤ 5 parallel posts) for best reliability.
- **Private posts** return `_error: "fetch_failed"`. The actor cannot bypass account privacy settings.
- **Deleted posts** return the same error envelope. Filter on `_error` to triage failures.
- **Comments disabled** posts return zero rows (no error). If you got `0` comments on a known-popular post, the author likely disabled comments.
- **Counters are eventually-consistent.** Like counts on individual comments may lag the live UI by a few minutes.

# Actor input Schema

## `posts` (type: `array`):

List of Instagram posts to fetch comments for. Each entry can be a shortcode (e.g. `DYSM8J5yzSj`) or a full URL (`https://www.instagram.com/p/DYSM8J5yzSj/`, `/reel/`, or `/tv/`). Bulk input is supported.

## `maxComments` (type: `integer`):

Maximum top-level comments to return per post. Pagination is handled automatically via cursor. Set to 0 for unlimited (walks the whole comments section).

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

Apify Proxy settings. Datacenter proxy works for the anonymous path.

## Actor input object example

```json
{
  "posts": [
    "https://www.instagram.com/p/DYSM8J5yzSj/",
    "DYP-BHSPCfn"
  ],
  "maxComments": 50,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "DATACENTER"
    ]
  }
}
```

# 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 = {
    "posts": [
        "https://www.instagram.com/p/DYSM8J5yzSj/",
        "DYP-BHSPCfn"
    ],
    "maxComments": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("xtracto/instagram-post-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 = {
    "posts": [
        "https://www.instagram.com/p/DYSM8J5yzSj/",
        "DYP-BHSPCfn",
    ],
    "maxComments": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("xtracto/instagram-post-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 '{
  "posts": [
    "https://www.instagram.com/p/DYSM8J5yzSj/",
    "DYP-BHSPCfn"
  ],
  "maxComments": 50
}' |
apify call xtracto/instagram-post-comments-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Instagram Comments Scraper - Cheaper",
        "description": "Fetch comments for any public Instagram post / reel / IGTV — author, text, like count, reply count, timestamp — with automatic pagination. No login required, Fast Http only scraper.",
        "version": "1.0",
        "x-build-id": "ofmtfG7vu8kWAbAnA"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/xtracto~instagram-post-comments-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-xtracto-instagram-post-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/xtracto~instagram-post-comments-scraper/runs": {
            "post": {
                "operationId": "runs-sync-xtracto-instagram-post-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/xtracto~instagram-post-comments-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-xtracto-instagram-post-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": [
                    "posts"
                ],
                "properties": {
                    "posts": {
                        "title": "Instagram posts",
                        "type": "array",
                        "description": "List of Instagram posts to fetch comments for. Each entry can be a shortcode (e.g. `DYSM8J5yzSj`) or a full URL (`https://www.instagram.com/p/DYSM8J5yzSj/`, `/reel/`, or `/tv/`). Bulk input is supported.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxComments": {
                        "title": "Max comments per post",
                        "minimum": 0,
                        "maximum": 5000,
                        "type": "integer",
                        "description": "Maximum top-level comments to return per post. Pagination is handled automatically via cursor. Set to 0 for unlimited (walks the whole comments section).",
                        "default": 50
                    },
                    "proxyConfiguration": {
                        "title": "Proxy configuration",
                        "type": "object",
                        "description": "Apify Proxy settings. Datacenter proxy works for the anonymous path.",
                        "default": {
                            "useApifyProxy": true,
                            "apifyProxyGroups": [
                                "DATACENTER"
                            ]
                        }
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
