# Instagram Post Scraper (`codenest/instagram-post-scraper`) Actor

Scrape thousands of Instagram posts in just minutes with full metadata - usernames, captions, reactions, comments, media URLs (images/videos/reels), thumbnails, and upload timestamps from any public profile.

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

## Pricing

Pay per event + usage

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 Post Scraper - Ultimate Profile-Based Content Extractor

**Effortlessly scrape and download Instagram posts, reels, and stories from any profile with our powerful **Instagram Post Scraper**! This Apify actor enables bulk extraction of posts, complete metadata, engagement metrics, and comprehensive profile information.**

---

### 📋 Overview

Need to archive Instagram content, analyze viral trends, or repurpose posts? This **Instagram Post Scraper** delivers:

- 📱 **Profile-Based Scraping** - Extract posts from any Instagram profile/page
- 🎬 **Multi-Format Support** - Download images, videos, and reels
- 📊 **Rich Engagement Data** - Reactions, comments, descriptions, timestamps
- ⚡ **High Performance** - Concurrent scraping with customizable limits
- 🔍 **Complete Profile Metadata** - Bio, followers, following, profile photos
- 🌐 **Proxy Support** - Built-in Apify proxy integration for reliable scraping

Perfect for social media managers 📈, content creators 🎭, marketers 📊, and data analysts 🔬!

---

### ⭐ Core Capabilities of Instagram Post Scraper

#### 🎯 Profile Extraction
- **Multiple Profile Support** - Scrape from 4+ Instagram profiles simultaneously
- **Complete Profile Data** - Bio, follower counts, profile/cover photos
- **Verification Status** - Detect verified accounts automatically
- **Rich Metadata** - Full name, bio, posts count, and more

#### 📱 Post Data Mastery
- **Downloadable Media URLs** - Direct CDN links for all posts
- **Engagement Metrics** - Reactions, comments (formatted K/M/B)
- **Content Descriptions** - Captions and hashtags
- **Temporal Data** - Upload timestamps and durations
- **Thumbnail Extraction** - High-quality cover images for videos/reels
- **Media Type Detection** - Auto-identifies images vs. videos vs. reels

#### ⚡ Technical Features
- **Concurrency Control** - Adjustable parallel processing (1-10 threads)
- **Maximum Posts Limit** - Set per-profile extraction limits (max 60+)
- **Proxy Configuration** - Built-in Apify proxy support
- **Session Management** - Optional session persistence
- **JSON Output** - Clean structured data with optional file export
- **Error Resilience** - Individual profile failures don't stop batch
- **Headless Mode** - Efficient browser automation

---

### ⚙️ Input Configuration

Simply enter Instagram profile URLs, configure limits, and click "Start". Input looks like this:

```json
{
  "headless": true,
  "maxReels": 60,
  "profileUrls": [
    "https://www.instagram.com/nba/",
    "nasa",
    "https://www.instagram.com/natgeo/",
    "wwe"
  ],
  "outputFile": "reels_data.json",
  "proxyConfiguration": {
    "useApifyProxy": true
  },
  "sessionId": ""
}
````

#### 📝 Input Specifications

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `profileUrls` | Array | ✅ Yes | - | Instagram profile URLs or usernames to scrape |
| `maxReels` | Integer | ❌ No | 60 | Maximum posts to extract per profile |
| `headless` | Boolean | ❌ No | true | Run browser in headless mode |
| `outputFile` | String | ❌ No | "reels\_data.json" | Output filename for JSON export |
| `proxyConfiguration.useApifyProxy` | Boolean | ❌ No | true | Enable Apify proxy rotation |
| `sessionId` | String | ❌ No | "" | Session ID for cookie persistence |

***

### 📤 Output Structure

Your **Instagram Post Scraper** produces comprehensive output with profile metadata and post data:

```json
[
  {
    "profile_url": "https://www.instagram.com/nba",
    "scraped_at": "2026-07-08T16:32:02.308231Z",
    "profile_metadata": {
      "username": "nba",
      "full_name": "NBA",
      "biography_clean": "Watch NBA Summer League action in Las Vegas: 7/9-7/19 on Prime and ESPN platforms!",
      "followers_count": 88388725,
      "following_count": 1306,
      "posts_count": 104801,
      "profile_pic_url_hq": "https://scontent...",
      "is_verified": true,
      "page_title": "NBA (@nba) • Instagram photos and videos"
    },
    "total_posts_scraped": 60,
    "posts": [
      {
        "posts num ": 1,
        "version": "1.0",
        "title": "The @emirates NBA Cup 2026 Group Draw results!",
        "author_name": "nba",
        "author_url": "https://www.instagram.com/nba/",
        "author_id": "20824486",
        "media_id": "3931329204505918355",
        "provider_name": "Instagram",
        "provider_url": "https://www.instagram.com",
        "type": "rich",
        "width": 658,
        "height": null,
        "html": "<blockquote class=\"instagram-media\" ... >",
        "thumbnail_url": "https://scontent...",
        "thumbnail_width": 1080,
        "thumbnail_height": 1440,
        "post_url": "https://www.instagram.com/p/DaO4xUZsbuT/",
        "shortcode": "DaO4xUZsbuT",
        "post_downloadable_url": "",
        "reactions": "170553",
        "comments": "1115",
        "views": "",
        "upload_time": "2026-07-01T01:56:34Z"
      }
    ]
  }
]
```

#### 📖 Output Field Documentation

**🔹 Profile Metadata**
| Field | Description |
|-------|-------------|
| `username` | Instagram username |
| `full_name` | Display name on profile |
| `biography_clean` | Profile bio/description (cleaned) |
| `followers_count` | Total followers (integer) |
| `following_count` | Total following (integer) |
| `posts_count` | Total posts count (integer) |
| `profile_pic_url_hq` | High-resolution profile picture URL |
| `is_verified` | Boolean indicating verified status |
| `page_title` | Full page title with username |

**🔹 Post Data**
| Field | Description |
|-------|-------------|
| `posts num` | Sequential post number (1-∞) |
| `post_url` | Direct Instagram post URL |
| `shortcode` | Unique post shortcode identifier |
| `post_downloadable_url` | Direct media download URL (if video) |
| `title` | Post caption/description |
| `author_name` | Content creator username |
| `author_id` | Instagram author ID |
| `media_id` | Unique media identifier |
| `thumbnail_url` | High-quality cover image |
| `reactions` | Like/reaction count (formatted) |
| `comments` | Comment count (formatted) |
| `views` | View count (for videos/reels) |
| `upload_time` | ISO 8601 timestamp of upload |
| `type` | Content type (rich/video/image) |

***

### 🎨 Key Features of This Instagram Post Scraper

#### 📊 Engagement Analytics

- **Reaction Metrics** - Like and engagement data formatted with K/M/B
- **Comment Analysis** - Track audience interaction
- **Cross-Profile Comparison** - Analyze performance across multiple creators
- **Temporal Analysis** - Track upload patterns and timing
- **View Counts** - For video content with formatted metrics

#### 🎬 Media Quality

- **Direct CDN Access** - Highest quality Instagram delivers
- **No Compression** - Preserves original video/image quality
- **Thumbnail Extraction** - High-resolution cover images
- **Media Type Detection** - Auto-identifies image vs. video vs. reel
- **Multi-Format Support** - Handles all Instagram post types

#### 🔍 Profile Intelligence

- **Follower Insights** - Growth metrics and audience size
- **Verification Status** - Authenticity detection
- **Rich Bio Data** - Complete profile information
- **Post Count Analysis** - Content volume tracking

#### 🌐 Proxy & Security

- **Built-in Proxy Support** - Apify proxy rotation for reliability
- **Session Management** - Cookie persistence for consistent scraping
- **Rate Limiting** - Smart request throttling
- **Headless Mode** - Efficient resource usage

***

### 💡 Use Cases for Instagram Post Scraper

- **📱 Social Media Managers** - Archive client content
- **📊 Competitor Analysis** - Track engagement and content strategies
- **🎬 Content Curators** - Gather trending posts for repurposing
- **🔬 Researchers** - Study viral content patterns and engagement
- **📈 Marketing Analysts** - Benchmark performance metrics
- **🤖 AI Trainers** - Build datasets for image/video understanding models
- **📚 Educators** - Create case studies from successful content
- **💰 Influencer Marketing** - Analyze potential partnerships
- **🖼️ Digital Archivists** - Preserve cultural and historical content

***

### ✨ Why Choose Our Instagram Post Scraper?

- **⚡ Blazing Fast** - Concurrent scraping with optimized browser automation
- **🎯 100% Accurate** - Preserves all metadata without alteration
- **🔄 Regular Updates** - Adapts to Instagram platform changes automatically
- **📦 Complete Data** - Everything from profile info to media URLs
- **🛡️ Production Ready** - Battle-tested with thousands of profiles
- **💰 Cost Efficient** - Optimized to minimize compute time and resources
- **🔒 Privacy Focused** - No personal data stored or shared

***

### ⚠️ Limitations

- Only works with public Instagram profiles (non-private content)
- Some profiles may have rate limiting or access restrictions
- Extremely high concurrency (15+) may trigger Instagram security
- Requires valid profile URLs or usernames
- Stories content requires separate scraping solution

***

### 📧 Need Custom Features for Your Instagram Post Scraper?

Want **higher concurrency limits**, **specific metadata fields**, **custom output formats**, **enhanced filtering**, **advanced analytics**, or **targeted hashtag scraping**?

✉️ Email **<codenest2.0@gmail.com>** for tailored enterprise solutions!

***

# Actor input Schema

## `profileUrls` (type: `array`):

Enter one or more Instagram profile URLs to scrape. Example: https://www.instagram.com/nba/reels/

## `maxReels` (type: `integer`):

Maximum number of reels to try to scrape per profile. The scraper will keep scrolling until this target is met or no more reels are available. Default is 50.

## `headless` (type: `boolean`):

Run Playwright browser in headless mode (no visible window). Default is true.

## `outputFile` (type: `string`):

Name of the output JSON file. Default is reels\_data.json.

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

Select proxies to be used by the scraper.

## `sessionId` (type: `string`):

Optional: Your Instagram sessionid cookie value. Highly recommended to bypass login prompts.

## Actor input object example

```json
{
  "profileUrls": [],
  "maxReels": 50,
  "headless": true,
  "outputFile": "reels_data.json",
  "proxyConfiguration": {
    "useApifyProxy": true
  },
  "sessionId": ""
}
```

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("codenest/instagram-post-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 = {}

# Run the Actor and wait for it to finish
run = client.actor("codenest/instagram-post-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 '{}' |
apify call codenest/instagram-post-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Instagram Post Scraper",
        "description": "Scrape thousands of Instagram posts in just minutes with full metadata - usernames, captions, reactions, comments, media URLs (images/videos/reels), thumbnails, and upload timestamps from any public profile.",
        "version": "0.0",
        "x-build-id": "mnRbYeJQno1bU5bpT"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/codenest~instagram-post-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-codenest-instagram-post-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/codenest~instagram-post-scraper/runs": {
            "post": {
                "operationId": "runs-sync-codenest-instagram-post-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/codenest~instagram-post-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-codenest-instagram-post-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": [
                    "profileUrls"
                ],
                "properties": {
                    "profileUrls": {
                        "title": "Profile URLs",
                        "type": "array",
                        "description": "Enter one or more Instagram profile URLs to scrape. Example: https://www.instagram.com/nba/reels/",
                        "items": {
                            "type": "string"
                        },
                        "default": []
                    },
                    "maxReels": {
                        "title": "Maximum Reels to Scrape",
                        "minimum": 1,
                        "maximum": 1000,
                        "type": "integer",
                        "description": "Maximum number of reels to try to scrape per profile. The scraper will keep scrolling until this target is met or no more reels are available. Default is 50.",
                        "default": 50
                    },
                    "headless": {
                        "title": "Headless Browser",
                        "type": "boolean",
                        "description": "Run Playwright browser in headless mode (no visible window). Default is true.",
                        "default": true
                    },
                    "outputFile": {
                        "title": "Output File Name",
                        "type": "string",
                        "description": "Name of the output JSON file. Default is reels_data.json.",
                        "default": "reels_data.json"
                    },
                    "proxyConfiguration": {
                        "title": "Proxy configuration",
                        "type": "object",
                        "description": "Select proxies to be used by the scraper.",
                        "default": {
                            "useApifyProxy": true
                        }
                    },
                    "sessionId": {
                        "title": "Session ID Cookie (sessionid)",
                        "type": "string",
                        "description": "Optional: Your Instagram sessionid cookie value. Highly recommended to bypass login prompts.",
                        "default": ""
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
