# 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, 2 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 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 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

Download the OpenAPI definition: https://api.apify.com/v2/actors/RqAEHrxMtIWwxLrfq/builds/mnRbYeJQno1bU5bpT/openapi.json
