# Instagram Comment Scraper - Get ALL Comments (`claredigital/ig-comment-scraper`) Actor

Extract ALL comments from Instagram posts & reels - not just the first 24. Most scrapers have broken pagination and fail. This one works. Full data: username, replies, likes, timestamps, verified status.

Residential proxy support.

Handles posts with 10,000+ comments.

- **URL**: https://apify.com/claredigital/ig-comment-scraper.md
- **Developed by:** [Tim Shea](https://apify.com/claredigital) (community)
- **Categories:** Social media
- **Stats:** 39 total users, 3 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $10.00 / 1,000 comment-scrapeds

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 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 Comment Scraper Pro

Extract comments from Instagram posts and reels - even without login cookies.

### Why This Scraper?

Most Instagram scrapers on Apify fail because they:
- Make direct API calls that Instagram blocks
- Require complex cookie setup
- Only return ~24 comments
- Break when Instagram changes their API

**This scraper is different.** It uses **network interception** - capturing Instagram's own responses as the page loads naturally. This approach:

- Looks like normal browser behavior to Instagram
- Works with OR without cookies
- Handles Instagram's frequent API changes gracefully
- Gets ALL comments through UI interaction

### Features

| Feature | Without Cookies | With Cookies |
|---------|----------------|--------------|
| Comments per post | ~24 | Unlimited |
| Reply threads | Limited | Full access |
| Rate limits | Stricter | More lenient |

- **Network Interception** - Captures data from Instagram's own responses
- **DOM Interaction** - Clicks "load more" buttons like a real user
- **Stealth Mode** - Browser fingerprint randomization, anti-detection headers
- **Multiple Extraction Methods** - Page data, GraphQL, REST API fallbacks
- **Residential Proxies** - Enabled by default for best results

### Quick Start

#### Without Cookies (Basic)

Just provide the post URLs:

```json
{
  "postUrls": [
    "https://www.instagram.com/p/ABC123/",
    "https://www.instagram.com/reel/XYZ789/"
  ]
}
````

This will scrape up to ~24 comments per post.

#### With Cookies (Full Access)

For unlimited comments, provide your Instagram session cookies:

```json
{
  "postUrls": ["https://www.instagram.com/p/ABC123/"],
  "cookies": "[your cookies here]",
  "maxComments": 0,
  "includeReplies": true
}
```

##### How to Get Cookies

**Option A: EditThisCookie Extension (Easiest)**

1. Install [EditThisCookie](https://chrome.google.com/webstore/detail/editthiscookie/fngmhnnpilhplaeedifhccceomclgfbg) for Chrome
2. Log into Instagram in your browser
3. Click the EditThisCookie icon
4. Click "Export" (copies JSON to clipboard)
5. Paste into the "cookies" field

**Option B: Browser DevTools**

1. Log into Instagram
2. Open DevTools (F12 or Cmd+Option+I)
3. Go to Application > Cookies > instagram.com
4. Copy `sessionid` and `csrftoken` values
5. Format as: `sessionid=YOUR_VALUE; csrftoken=YOUR_VALUE`

### Input Options

| Field | Required | Default | Description |
|-------|----------|---------|-------------|
| `postUrls` | Yes | - | Instagram post/reel URLs to scrape |
| `cookies` | No | - | Instagram session cookies for full access |
| `maxComments` | No | 0 | Max comments per post (0 = unlimited) |
| `includeReplies` | No | true | Also fetch reply threads |
| `maxRepliesPerComment` | No | 0 | Max replies per comment (0 = unlimited) |
| `delayBetweenRequests` | No | 2000 | Delay in ms between pagination |
| `proxyConfiguration` | No | Residential | Proxy settings |

### Output Format

#### Post Summary

```json
{
  "postUrl": "https://www.instagram.com/p/ABC123/",
  "postShortcode": "ABC123",
  "totalComments": 1547,
  "scrapedComments": 1547,
  "scrapedAt": "2026-01-24T15:30:00Z",
  "comments": [...]
}
```

#### Individual Comment

```json
{
  "_type": "comment",
  "id": "17912345678901234",
  "text": "This is amazing!",
  "timestamp": "2026-01-20T10:15:00Z",
  "username": "user_handle",
  "userId": "987654321",
  "isVerified": false,
  "likeCount": 42,
  "replyCount": 3,
  "parentCommentId": null,
  "postUrl": "https://www.instagram.com/p/ABC123/",
  "postShortcode": "ABC123"
}
```

#### Reply

```json
{
  "_type": "reply",
  "id": "17912345678901235",
  "text": "Thanks!",
  "timestamp": "2026-01-20T10:20:00Z",
  "username": "post_author",
  "userId": "123456789",
  "isVerified": true,
  "likeCount": 15,
  "parentCommentId": "17912345678901234",
  "postUrl": "https://www.instagram.com/p/ABC123/",
  "postShortcode": "ABC123"
}
```

### Pricing

**$2.00 per 1,000 comments**

- Pay only for successfully scraped comments
- Failed runs don't cost anything
- Replies count as separate items

### Troubleshooting

#### "Only getting ~24 comments"

This is expected without cookies. Instagram limits unauthenticated access. To get all comments:

1. Provide valid session cookies (see "How to Get Cookies" above)
2. Make sure both `sessionid` AND `csrftoken` are included

#### "0 comments scraped"

1. **Post might be private** - This scraper only works on public posts
2. **Post might be deleted** - Check if the URL still works in your browser
3. **Cookies might be expired** - Get fresh cookies from Instagram
4. **IP might be blocked** - Try enabling residential proxies

#### "Request failed" or timeout errors

Instagram may be rate limiting or blocking requests. Try:

1. Increase `delayBetweenRequests` to 5000+
2. Enable residential proxies
3. Process fewer posts per run
4. Wait and try again later

#### Cookies not working

The scraper accepts multiple cookie formats:

- **JSON array**: `[{"name": "sessionid", "value": "xxx"}, ...]`
- **Cookie string**: `sessionid=xxx; csrftoken=yyy`

Make sure you include both `sessionid` AND `csrftoken`.

### How It Works

Unlike other scrapers that make direct API calls (which Instagram blocks), this scraper:

1. **Navigates to the post** like a normal browser
2. **Intercepts network responses** - captures comment data from Instagram's own GraphQL and REST API responses
3. **Clicks "load more" buttons** - triggers pagination through normal UI interaction
4. **Extracts embedded data** - parses comments from the initial page HTML

This approach is more resilient to Instagram's anti-bot measures because it mimics real user behavior.

### Use Cases

- **Brand monitoring** - Track what people say about your brand
- **Competitor analysis** - Analyze engagement on competitor posts
- **Influencer research** - Evaluate comment quality and engagement
- **Sentiment analysis** - Feed comments into NLP models
- **Lead generation** - Find engaged users in your niche

### Limitations

- Only works on **public** posts and accounts
- Rate limited by Instagram (~200 requests/hour)
- Cookie sessions expire and need to be refreshed periodically
- Cannot access comments on private accounts without being a follower

### Legal & Ethical Use

This scraper extracts publicly available data only. By using this scraper, you agree to:

- Comply with Instagram's Terms of Service
- Not use data for harassment, spam, or illegal purposes
- Respect user privacy and applicable data protection laws
- Not scrape private accounts without authorization

### Support

Having issues? Open an issue with:

1. Your input configuration (without cookies/secrets)
2. The error message
3. The post URL you tried to scrape

Average response time: < 24 hours

### Changelog

#### v2.0.0 (2026-01-28)

- Complete rewrite using network interception
- Works without cookies (limited to ~24 comments)
- Enhanced stealth with fingerprint randomization
- Better error messages and troubleshooting tips
- Automatic residential proxy fallback

#### v1.0.0 (2026-01-24)

- Initial release

# Actor input Schema

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

Instagram post or reel URLs to scrape comments from

## `cookies` (type: `string`):

Your Instagram session cookies. REQUIRED for more than 24 comments. Get them from browser DevTools > Application > Cookies > instagram.com. Copy all cookies as JSON or use the 'EditThisCookie' extension.

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

Maximum comments to scrape per post. Set to 0 for unlimited.

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

Also scrape reply threads for each comment

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

Maximum replies to fetch per comment. Set to 0 for unlimited.

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

Residential proxies are recommended for best results. Instagram blocks datacenter IPs.

## `delayBetweenRequests` (type: `integer`):

Delay between pagination requests. Higher = safer but slower. Instagram rate limits at ~200 requests/hour.

## Actor input object example

```json
{
  "postUrls": [
    "https://www.instagram.com/p/EXAMPLE/"
  ],
  "maxComments": 0,
  "includeReplies": true,
  "maxRepliesPerComment": 0,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  },
  "delayBetweenRequests": 2000
}
```

# 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.instagram.com/p/EXAMPLE/"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("claredigital/ig-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 = {
    "postUrls": ["https://www.instagram.com/p/EXAMPLE/"],
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("claredigital/ig-comment-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.instagram.com/p/EXAMPLE/"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call claredigital/ig-comment-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Instagram Comment Scraper - Get ALL Comments",
        "description": "Extract ALL comments from Instagram posts & reels - not just the first 24. Most scrapers have broken pagination and fail. This one works. Full data: username, replies, likes, timestamps, verified status. \n\nResidential proxy support.     \n \nHandles posts with 10,000+ comments.",
        "version": "2.0",
        "x-build-id": "wjmfxeqMbVaZuJXyZ"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/claredigital~ig-comment-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-claredigital-ig-comment-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/claredigital~ig-comment-scraper/runs": {
            "post": {
                "operationId": "runs-sync-claredigital-ig-comment-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/claredigital~ig-comment-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-claredigital-ig-comment-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": "Instagram post or reel URLs to scrape comments from",
                        "items": {
                            "type": "string"
                        }
                    },
                    "cookies": {
                        "title": "Instagram Cookies",
                        "type": "string",
                        "description": "Your Instagram session cookies. REQUIRED for more than 24 comments. Get them from browser DevTools > Application > Cookies > instagram.com. Copy all cookies as JSON or use the 'EditThisCookie' extension."
                    },
                    "maxComments": {
                        "title": "Max Comments Per Post",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Maximum comments to scrape per post. Set to 0 for unlimited.",
                        "default": 0
                    },
                    "includeReplies": {
                        "title": "Include Replies",
                        "type": "boolean",
                        "description": "Also scrape reply threads for each comment",
                        "default": true
                    },
                    "maxRepliesPerComment": {
                        "title": "Max Replies Per Comment",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Maximum replies to fetch per comment. Set to 0 for unlimited.",
                        "default": 0
                    },
                    "proxyConfiguration": {
                        "title": "Proxy Configuration",
                        "type": "object",
                        "description": "Residential proxies are recommended for best results. Instagram blocks datacenter IPs."
                    },
                    "delayBetweenRequests": {
                        "title": "Delay Between Requests (ms)",
                        "minimum": 500,
                        "maximum": 10000,
                        "type": "integer",
                        "description": "Delay between pagination requests. Higher = safer but slower. Instagram rate limits at ~200 requests/hour.",
                        "default": 2000
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
