# CrowdPull Instagram Scraper — Places & More (`crowdpull/instagram-scraper`) Actor

Scrape Instagram profiles, posts, reels, comments, hashtag search results, hashtag posts, place search results, place feeds, and tagged mentions. No login required for core profile and post modes, with diagnostics for empty or partial sources.

- **URL**: https://apify.com/crowdpull/instagram-scraper.md
- **Developed by:** [Crowd Pull](https://apify.com/crowdpull) (community)
- **Categories:** Social media, Lead generation, Marketing
- **Stats:** 14 total users, 1 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## CrowdPull Instagram Scraper

Scrape public Instagram profiles, posts, reels, direct post URLs, comments, hashtag search results, hashtag feeds, place search results, place feeds, and tagged mentions with a single Apify actor.

The actor is designed to mirror the CrowdPull Facebook actors:

- HTTP-first, not browser-first
- structured Apify schemas and PPR event names
- optional `Smart Scrape` dedup caches for recurring monitoring
- explicit “no login” vs “session cookie” mode boundaries

### Modes

#### No login required

- `profiles` — profile metadata like full name, bio, follower counts, verification, category, links, highlight count, and profile images
- `posts` — recent profile posts and reels, plus optional profile metadata row
- `postUrls` — scrape individual post or reel URLs through Instagram’s embed payload

#### Session cookie required

- `comments` — full comment bodies, usernames, timestamps, likes, and child comment counts require `sessionCookie`
- `searchPlaces` — search Instagram places/locations by keyword and return location metadata rows
- `placePosts` — scrape place metadata plus recent public posts for Instagram location IDs or place URLs

#### Public fallback, better with `sessionCookie`

- `searchHashtags` — tries Instagram's public popular-search surface when logged out, with fuller results when `sessionCookie` is provided
- `hashtagPosts` — falls back to public popular-search media when logged out, with fuller hashtag feed coverage when `sessionCookie` is provided
- `mentions` — best-effort on public profile data, but availability improves with `sessionCookie`

### Core Features

- Public profile and post extraction without login for the main modes
- Reels, videos, images, and carousels from the same actor
- Profile rows with follower/following/post counts
- Place search rows with location IDs, names, slugs, addresses, cities, coordinates, and media counts
- Rich post rows with captions, hashtags, mentions, tagged users, coauthors, locations, music metadata, pinned state, engagement counts, and media URLs
- Date filtering with ISO or relative inputs like `7d`, `30d`, `6m`, `1y`, or `14 days`
- Smart Scrape caches for recurring runs
- Source-by-source diagnostics so empty or partial results are explained instead of silently returning nothing
- Continues past individual bad usernames, URLs, or hashtags instead of aborting the whole batch
- Remote-ready pricing events that map directly to visible profile, post, comment, hashtag, and Smart Scrape actions
- Optional Apify Residential Proxy support for more stable pagination

### Input Examples

#### Profile posts

```json
{
  "mode": "posts",
  "usernames": ["nasa", "natgeo"],
  "maxPosts": 20,
  "includeProfile": true,
  "enableDedup": true,
  "refreshWindowDays": 7
}
```

#### Direct post URLs

```json
{
  "mode": "postUrls",
  "postUrls": [
    { "url": "https://www.instagram.com/p/C5_2_NORRg3/" }
  ]
}
```

#### Authenticated comments

```json
{
  "mode": "comments",
  "postUrls": [
    { "url": "https://www.instagram.com/p/C5_2_NORRg3/" }
  ],
  "maxComments": 100,
  "sessionCookie": "sessionid=..."
}
```

#### Instagram place feed

```json
{
  "mode": "placePosts",
  "placeUrls": [
    { "url": "https://www.instagram.com/explore/locations/212988663/detroit-michigan/" }
  ],
  "maxPosts": 10,
  "sessionCookie": "sessionid=..."
}
```

### Smart Scrape

Enable `enableDedup` to persist a per-source cache of post IDs:

- `posts` caches by username
- `postUrls` caches by URL
- `hashtagPosts` caches by hashtag
- `searchPlaces` caches place result IDs by search term
- `placePosts` caches by location ID
- `mentions` caches by username

Use `refreshWindowDays` to re-fetch recent cached posts so likes and comment counts stay current.

### Output

- Results are written to the default dataset
- Run-level and source-level diagnostics are written to the default key-value store
- Diagnostics help distinguish `succeeded`, `partial`, `empty`, and `failed` sources in larger batch runs

### Notes

- Instagram’s private web endpoints rate limit aggressively; residential proxies improve consistency for deeper pagination
- Full comment extraction still requires a valid `sessionCookie`
- Instagram place search and place feeds currently require a valid `sessionCookie`
- Logged-out hashtag and mention fallbacks come from Instagram's public surfaces, so they are less complete and more volatile than authenticated results
- Private, removed, region-restricted, or otherwise withheld Instagram sources can still return empty results

### Build

```bash
npm install
npm run build
```

# Actor input Schema

## `mode` (type: `string`):

Choose what you want to scrape.

## `usernames` (type: `array`):

Instagram usernames without @. Used by profiles, posts, and mentions modes.

## `directUrls` (type: `array`):

Full Instagram profile URLs. Used by profiles, posts, and mentions modes.

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

Full post or reel URLs. Used by postUrls and comments modes.

## `searchTerms` (type: `array`):

Keywords used in searchHashtags mode. For example: nature, fitness, ecommerce.

## `hashtags` (type: `array`):

Hashtags without #. Used by hashtagPosts mode.

## `placeSearchTerms` (type: `array`):

Keywords used in searchPlaces mode. For example: detroit, miami beach, soho.

## `locationIds` (type: `array`):

Instagram location IDs used by placePosts mode.

## `placeUrls` (type: `array`):

Full Instagram place/location URLs. Used by placePosts mode and converted into location IDs automatically.

## `maxPosts` (type: `integer`):

Maximum number of posts to extract per profile, hashtag, place, or mention source. Set to 0 for unlimited.

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

Maximum number of comments per post in comments mode. Set to 0 for unlimited.

## `onlyPostsNewerThan` (type: `string`):

Only keep posts newer than this date. Supports ISO dates (2026-01-01) or relative durations like 7d, 30d, 8w, 6m, 1y, or '14 days'.

## `includeProfile` (type: `boolean`):

In posts mode, push the profile metadata row before the post rows.

## `mediaTypes` (type: `array`):

Optional media type filter for posts mode.

## `sessionCookie` (type: `string`):

Optional for core public modes. Required for comments, searchPlaces, and placePosts. Hashtag search, hashtag posts, and mentions still attempt logged-out public fallbacks when possible. Paste either the raw sessionid value or 'sessionid=...'.

## `scrollDelay` (type: `integer`):

Delay between page requests in milliseconds. Increase this if you hit Instagram rate limits.

## `maxEmptyPages` (type: `integer`):

Stop after this many consecutive empty or duplicate-heavy pages.

## `enableDedup` (type: `boolean`):

Persist a per-source cache of post IDs and skip old posts in future runs.

## `refreshWindowDays` (type: `integer`):

Re-scrape recent cached posts from the last N days so likes and comments stay fresh. Set 0 to never re-scrape cached posts.

## `proxyConfig` (type: `object`):

Residential proxies are recommended for heavier Instagram pagination.

## Actor input object example

```json
{
  "mode": "posts",
  "usernames": [
    "nasa"
  ],
  "directUrls": [
    {
      "url": "https://www.instagram.com/nasa/"
    }
  ],
  "postUrls": [
    {
      "url": "https://www.instagram.com/p/C5_2_NORRg3/"
    }
  ],
  "placeUrls": [
    {
      "url": "https://www.instagram.com/explore/locations/212988663/detroit-michigan/"
    }
  ],
  "maxPosts": 3,
  "maxComments": 50,
  "includeProfile": true,
  "mediaTypes": [
    "image",
    "video",
    "carousel",
    "reel"
  ],
  "scrollDelay": 1500,
  "maxEmptyPages": 4,
  "enableDedup": false,
  "refreshWindowDays": 0,
  "proxyConfig": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `runSummary` (type: `string`):

No description

## `sourceDiagnostics` (type: `string`):

No description

# 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 = {
    "usernames": [
        "nasa"
    ],
    "directUrls": [
        {
            "url": "https://www.instagram.com/nasa/"
        }
    ],
    "postUrls": [
        {
            "url": "https://www.instagram.com/p/C5_2_NORRg3/"
        }
    ],
    "placeUrls": [
        {
            "url": "https://www.instagram.com/explore/locations/212988663/detroit-michigan/"
        }
    ],
    "maxPosts": 3,
    "maxComments": 50,
    "mediaTypes": [
        "image",
        "video",
        "carousel",
        "reel"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("crowdpull/instagram-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 = {
    "usernames": ["nasa"],
    "directUrls": [{ "url": "https://www.instagram.com/nasa/" }],
    "postUrls": [{ "url": "https://www.instagram.com/p/C5_2_NORRg3/" }],
    "placeUrls": [{ "url": "https://www.instagram.com/explore/locations/212988663/detroit-michigan/" }],
    "maxPosts": 3,
    "maxComments": 50,
    "mediaTypes": [
        "image",
        "video",
        "carousel",
        "reel",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("crowdpull/instagram-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 '{
  "usernames": [
    "nasa"
  ],
  "directUrls": [
    {
      "url": "https://www.instagram.com/nasa/"
    }
  ],
  "postUrls": [
    {
      "url": "https://www.instagram.com/p/C5_2_NORRg3/"
    }
  ],
  "placeUrls": [
    {
      "url": "https://www.instagram.com/explore/locations/212988663/detroit-michigan/"
    }
  ],
  "maxPosts": 3,
  "maxComments": 50,
  "mediaTypes": [
    "image",
    "video",
    "carousel",
    "reel"
  ]
}' |
apify call crowdpull/instagram-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/7ayRICLwZlVBu5APh/builds/S34h2Sogc8J1kIbVT/openapi.json
