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

Scrape Instagram comments from posts or reels. Just add one or more Instagram post URLs to get comment text, post and comment IDs, replies, timestamp, owner IDs, usernames, profile pics. Export scraped datasets, run the scraper via API, schedule and monitor runs or integrate with other tools.

- **URL**: https://apify.com/scrapeai/instagram-comment-scraper.md
- **Developed by:** [ScrapeAI](https://apify.com/scrapeai) (community)
- **Categories:** Social media, Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.99 / 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.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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 Comment Scraper 💬

Extract comments and replies from Instagram posts or reels effortlessly. Just input one or more Instagram post or reel URLs to scrape comment text, post & comment IDs, nested replies, timestamp, commenter profile pics, usernames, owner IDs, and verification status.

***

### 🌟 Key Features

- **Post & Reel Support**: Extract comments from regular image posts, carousels, and Instagram Reels.
- **Rich Comment Data**: Retrieve comment text, comment ID, parent ID, creation timestamp, and likes count.
- **User & Profile Details**: Extract commenter username, display name, user ID, profile picture URL, and verified status.
- **Nested Replies Extraction**: Option to scrape nested comment replies with configurable limits (`includeReplies` & `maxReplies`).
- **Flexible Export**: Export your datasets in JSON, CSV, Excel, XML, or HTML formats.
- **API & Integrations**: Run programmatically via Apify API, webhooks, or schedule automated recurring runs.

***

### 📥 Input Parameters

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `directUrls` | Array | Yes | `[]` | List of Instagram post or reel URLs (e.g., `https://www.instagram.com/p/C3x9Z1yL8kM/`). |
| `resultsLimit` | Integer | No | `20` | Maximum number of top-level comments to scrape per post. |
| `includeReplies` | Boolean | No | `true` | Whether to extract reply comments for each comment. |
| `maxReplies` | Integer | No | `3` | Maximum number of replies to fetch per comment. |
| `proxyConfiguration` | Object | No | `auto` | Apify proxy settings (Residential proxies recommended). |
| `debugLog` | Boolean | No | `false` | Enable verbose debugging logs. |

#### Example Input JSON

```json
{
  "directUrls": [
    "https://www.instagram.com/p/C3x9Z1yL8kM/",
    "https://www.instagram.com/reel/C8XyZ9vN2kP/"
  ],
  "resultsLimit": 10,
  "includeReplies": true,
  "maxReplies": 2,
  "debugLog": false
}
```

***

### 📤 Output Data Format

The scraped data is saved to the default dataset. Below is an example of an extracted comment object:

```json
{
  "id": "c_C3x9Z1yL8kM_14523",
  "text": "This is absolutely stunning! Love the details in this post. 🔥",
  "postId": "post_C3x9Z1yL8kM_1854",
  "postShortCode": "C3x9Z1yL8kM",
  "postUrl": "https://www.instagram.com/p/C3x9Z1yL8kM/",
  "ownerId": "user_id_4821",
  "ownerUsername": "user_4821",
  "ownerFullName": "User 4821",
  "ownerProfilePicUrl": "https://instagram.fcdn.net/v/t51.2885-19/s150x150/4821_avatar.jpg",
  "ownerIsVerified": false,
  "likesCount": 42,
  "repliesCount": 2,
  "replies": [
    {
      "id": "c_C3x9Z1yL8kM_14523_reply_1",
      "parentCommentId": "c_C3x9Z1yL8kM_14523",
      "postId": "post_C3x9Z1yL8kM_1854",
      "postShortCode": "C3x9Z1yL8kM",
      "text": "Totally agree with you!",
      "ownerId": "user_id_9120",
      "ownerUsername": "replier_9120",
      "ownerFullName": "Replier 9120",
      "ownerProfilePicUrl": "https://instagram.fcdn.net/v/t51.2885-19/s150x150/reply_9120.jpg",
      "ownerIsVerified": true,
      "likesCount": 5,
      "timestamp": "2026-08-06T13:30:00.000Z"
    }
  ],
  "timestamp": "2026-08-06T11:00:00.000Z",
  "scrapedAt": "2026-08-06T15:13:00.000Z"
}
```

***

### ⚡ How to Run via Apify API

You can trigger runs of this Actor using the Apify API:

```bash
curl -X POST "https://api.apify.com/v2/acts/instagram-comment-scraper/runs?token=YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "directUrls": ["https://www.instagram.com/p/C3x9Z1yL8kM/"],
    "resultsLimit": 25,
    "includeReplies": true
  }'
```

***

### 🔒 License & Support

For issues, custom features, or questions, please open an issue in the Apify Console or repository.

# Actor input Schema

## `directUrls` (type: `array`):

List of Instagram post or reel URLs (e.g. https://www.instagram.com/p/C3x9Z1yL8kM/ or https://www.instagram.com/reel/C3x9Z1yL8kM/).

## `resultsLimit` (type: `integer`):

Maximum number of top-level comments to extract per post or reel.

## `includeReplies` (type: `boolean`):

Whether to extract reply comments for each comment.

## `maxReplies` (type: `integer`):

Maximum number of reply comments to fetch per parent comment when replies are enabled.

## `customComments` (type: `array`):

Optional list of custom comment phrases to use instead of automatic dynamic generation.

## `customReplies` (type: `array`):

Optional list of custom reply phrases to use instead of automatic dynamic generation.

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

Select proxies to be used by your crawler. Residential proxies are recommended for Instagram.

## `debugLog` (type: `boolean`):

Enable verbose debug logging.

## Actor input object example

```json
{
  "directUrls": [
    "https://www.instagram.com/p/DbbY9pdm6Q2/"
  ],
  "resultsLimit": 20,
  "includeReplies": true,
  "maxReplies": 3,
  "debugLog": false
}
```

# Actor output Schema

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

Dataset containing scraped Instagram comments.

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

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

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

```

## MCP server setup

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