# Instagram Post Scraper (`clappi/instagram-posts-scraper`) Actor

Scrape Instagram Posts and Reels with combined Instagram + Facebook metrics. Get views, likes, comments from both platforms when content is cross-posted — all with built-in authentication, no cookies required.

- **URL**: https://apify.com/clappi/instagram-posts-scraper.md
- **Developed by:** [Clappi](https://apify.com/clappi) (community)
- **Categories:** Social media, Videos, Automation
- **Features:** Limited permissions
- **Stats:** 455 total users, 51 monthly users, 100.0% runs succeeded, 2 bookmarks
- **User rating**: 4.46 out of 5 stars

## Pricing

from $1.70 / 1,000 posts

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

## Instagram Posts Scraper

Scrape Instagram post and reel metrics at scale. Get views, likes, comments, captions, media details, and optional combined Instagram + Facebook metrics.

### Input

| Field | Type | Description |
|-------|------|-------------|
| `postUrls` | array | Instagram post/reel URLs |
| `includeFacebookMetrics` | boolean | Enable to get combined IG + FB metrics for cross-posted content (slower) |

#### Example Input

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

### Output

Each post includes:

```json
{
  "url": "https://www.instagram.com/reel/ABC123/",
  "originalUrl": "https://www.instagram.com/share/reel/Tok3n/",
  "shortcode": "ABC123",
  "mediaId": "1234567890123456789",
  "author": "username",
  "authorId": "12345678",
  "authorUrl": "https://www.instagram.com/username/",
  "caption": "Amazing content! #viral",
  "views": 150000,
  "likes": 5000,
  "comments": 200,
  "isVideo": true,
  "thumbnailUrl": "https://...",
  "datePosted": "2024-01-15T10:30:00.000Z",
  "status": "available",
  "scrapedAt": "2024-01-20T12:00:00.000Z"
}
```

### Supported URLs

- `https://www.instagram.com/p/SHORTCODE/` - Posts
- `https://www.instagram.com/reel/SHORTCODE/` - Reels
- `https://www.instagram.com/tv/SHORTCODE/` - IGTV
- `https://www.instagram.com/share/...` - Share links (resolved to the canonical post URL)

For share links, `url` holds the resolved canonical post URL (the one actually scraped) and `originalUrl` holds the exact link you submitted. For non-share links the two are identical.

### Facebook Metrics

When `includeFacebookMetrics` is enabled, the scraper includes combined metrics from Instagram and Facebook for eligible cross-posted content. If enhanced metrics are temporarily unavailable, standard post metrics are still returned.

### Use Cases

- **Content Analysis** - Track post performance metrics
- **Competitor Research** - Monitor competitor content engagement
- **Influencer Vetting** - Verify engagement rates and content quality
- **Cross-Platform Analytics** - Get combined Instagram + Facebook metrics
- **Portfolio Building** - Collect content data for reporting

### Cost Estimation

This scraper is optimized for efficiency. Scraping 100 posts typically costs less than $0.10 in platform usage.

# Actor input Schema

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

List of Instagram post URLs to scrape. Supports posts, reels, and IGTV.

## `includeFacebookMetrics` (type: `boolean`):

Include combined Instagram + Facebook metrics for eligible cross-posted content. Standard metrics are returned if enhanced metrics are unavailable.

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

Optional advanced session configuration.

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

Optional proxy settings. Use Apify Proxy or custom proxies.

## Actor input object example

```json
{
  "postUrls": [
    "https://www.instagram.com/reel/DR5fmMgEjWs/",
    "https://www.instagram.com/p/DP1ewP1EbyD/"
  ],
  "includeFacebookMetrics": false,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# 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/reel/DR5fmMgEjWs/",
        "https://www.instagram.com/p/DP1ewP1EbyD/"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("clappi/instagram-posts-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/reel/DR5fmMgEjWs/",
        "https://www.instagram.com/p/DP1ewP1EbyD/",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("clappi/instagram-posts-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 '{
  "postUrls": [
    "https://www.instagram.com/reel/DR5fmMgEjWs/",
    "https://www.instagram.com/p/DP1ewP1EbyD/"
  ]
}' |
apify call clappi/instagram-posts-scraper --silent --output-dataset

```

## MCP server setup

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