# Instagram Post, Comments & Likes Scraper (`toolzerhub/instagram-post-comments-likes-scraper`) Actor

Six ways to read one Instagram post: by URL, by numeric media ID, an extended app-shape record, its comments, the replies to one comment, and its likers. Paging is automatic up to Max results on every list mode.

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

## Pricing

from $5.10 / 1,000 results

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?

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 Post, Comments & Likes Scraper

Take one Instagram post and read it properly — the post record itself, its comments, the replies under a comment, and who liked it. Paste the URL; you don't need to find an ID first. No login, no cookies.

### Pick a mode

| Mode | Give it | Returns |
|---|---|---|
| Get post by URL | **postUrl** | The post record |
| Get post by ID | **postId** | Same record, from the numeric media ID |
| Extended post details | **code** | A fuller record, from the link or its shortcode |
| List post comments | **code** | One row per comment, paged |
| Comment replies | **commentId** | One row per reply, paged |
| Post likes | **code** | One row per liker, paged |

**postUrl** and **code** both accept a full `instagram.com/p/…`, `/reel/…` or `/tv/…` link — paste the address bar and the shortcode is taken out of it for you. A bare shortcode works too.

### Input

| Field | Notes |
|---|---|
| **sortBy** | `recent` or `popular` — comment order |
| **Max results** | Per post. `0` removes the bound. |
| **Resume from** | Continuation value from an earlier run's log |

### Output

`source_identifier` · `code` · `like_count` · `comment_count` · `taken_at`

### Questions

**How do I get replies to a specific comment?**
Run List post comments first, find the comment, copy its `id`, and put that in **commentId**. There is no way to go straight from a post URL to one comment's replies — the reply endpoint identifies the comment, not the post.

**The like count says 40,000 but I got far fewer likers.**
Those are two different things. `like_count` is the number Instagram displays. The Post likes mode reads the liker list, which Instagram truncates heavily — you get the portion it serves, not everyone. Use `like_count` for the number and the liker rows for the sample.

**Which mode should I default to?**
Get post by URL. Extended post details returns more fields from a different Instagram surface, so reach for it when the plain record is missing something you need — not as the starting point.

**Nothing came back for a post that exists.**
Deleted posts and posts on accounts that went private both return no row rather than an error. So does a mistyped shortcode. The run finishes successfully either way.

**Can I pass several posts at once?**
One post per run. `source_identifier` labels every row with the post it came from, so scheduled runs merge cleanly into one sheet.

### The rest of the family

[Instagram Posts, Reels & Reposts Scraper](https://apify.com/toolzerhub/instagram-posts-reels-scraper) — get a whole account's posts, then bring the interesting ones here.
[Instagram Profile Scraper](https://apify.com/toolzerhub/instagram-profile-scraper) — the accounts behind the comments and likes.
[Instagram Scraper - All In One](https://apify.com/toolzerhub/instagram-all-in-one-scraper) — every mode in this family.

### Support

Questions, bugs, or feature requests: **contact@toolzerhub.com**

Browse the rest: [apify.com/toolzerhub](https://apify.com/toolzerhub)

# Actor input Schema

## `scraperType` (type: `string`):

Choose the dataset for this run, then fill in the section for that mode below.

## `postUrl` (type: `string`):

Full Instagram post, reel, or TV URL, copied from the address bar.

## `postId` (type: `string`):

The post's numeric media ID. Most people won't have this on hand — paste the post's URL into "Get post by URL" instead, or convert a shortcode to one with the Post actor's "Convert shortcode to media ID" mode.

## `code` (type: `string`):

Paste the post's Instagram link (instagram.com/p/..., /reel/..., or /tv/...), or just the code at the end of it.

## `commentId` (type: `string`):

The id of the comment to read replies for. Run "List post comments" first and copy the `id` field of the comment you want from its output.

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

Order to read a post's comments in.

## `maxItems` (type: `integer`):

The maximum number of records to save per identifier or search term. A value of 0 removes the bound and the run continues until the source has no more to give.

## `cursor` (type: `string`):

A continuation value from an earlier run — the value the run log prints when it stops. The run continues from there instead of the top. Leave it empty to start at the top. Applies only to a single identifier or search term; a multi-account run uses it for the first one only.

## Actor input object example

```json
{
  "scraperType": "postByUrl",
  "postUrl": "https://www.instagram.com/p/DcBr7X4SL3h/",
  "postId": "3963642343152205281",
  "code": "DcBr7X4SL3h",
  "commentId": "17962178040160246",
  "sortBy": "recent",
  "maxItems": 25
}
```

# Actor output Schema

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

Every record collected during this run

# 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 = {
    "scraperType": "postByUrl",
    "postUrl": "https://www.instagram.com/p/DcBr7X4SL3h/",
    "postId": "3963642343152205281",
    "code": "DcBr7X4SL3h",
    "commentId": "17962178040160246",
    "maxItems": 25
};

// Run the Actor and wait for it to finish
const run = await client.actor("toolzerhub/instagram-post-comments-likes-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 = {
    "scraperType": "postByUrl",
    "postUrl": "https://www.instagram.com/p/DcBr7X4SL3h/",
    "postId": "3963642343152205281",
    "code": "DcBr7X4SL3h",
    "commentId": "17962178040160246",
    "maxItems": 25,
}

# Run the Actor and wait for it to finish
run = client.actor("toolzerhub/instagram-post-comments-likes-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 '{
  "scraperType": "postByUrl",
  "postUrl": "https://www.instagram.com/p/DcBr7X4SL3h/",
  "postId": "3963642343152205281",
  "code": "DcBr7X4SL3h",
  "commentId": "17962178040160246",
  "maxItems": 25
}' |
apify call toolzerhub/instagram-post-comments-likes-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,toolzerhub/instagram-post-comments-likes-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/Zp1gUHTTreywokK3Q/builds/6EX3w3BqwjePMD1qc/openapi.json
