# Instagram Scraper (`admo-solutions/instagram-scraper`) Actor

Scrape Instagram profiles, posts, reels, comments, hashtags, and places by parsing public pages through Apify proxy. No API, no browser, no login required. Honest caps for logged-out data.

- **URL**: https://apify.com/admo-solutions/instagram-scraper.md
- **Developed by:** [Admo Solutions](https://apify.com/admo-solutions) (community)
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 96.6% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.50 / 1,000 instagram results

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/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 Scraper

Scrape Instagram profiles, posts, reels, comments, hashtags, and places by parsing **public pages** through Apify proxy. No Instagram API, no browser, no login required.

### Features

- **Profiles** — username/URL → details (followers, bio, verified, approximate posts count)
- **Posts & Reels** — captions, media, likes, comments count, date, location (nullable)
- **Comments** — text, author, likes, date (first embedded page per post)
- **Hashtags** — volume (approximate), popular media; each item detail-fetched for exact stats
- **Places** — name, lat/lng, category, media count (address unavailable logged-out)
- **Retry ladder** — full-browser headers, rate-limit-shell detection, 429 backoff, datacenter → residential
- **Date filter** — only posts newer than X (dropped posts not charged)
- **Honest failures** — explicit error rows, never fabricated data
- **Any Apify output format** — JSON, CSV, Excel, XML; run via REST API, schedule runs, or use webhooks and MCP

### Honest caps (logged-out public pages)

| Capability | Cap |
|---|---|
| Profile post list | first grid page only (~12; no pagination without API) |
| Comments | first embedded page (~13 per post; `commentsCount` shows true total) |
| Hashtag feed | popular reels grid (~12), per-item stats via detail fetch |
| Hashtag / profile counts | parsed from formatted strings (`3.9B`, `32K`) — approximate |
| Place address / place-by-name search | unavailable → `address: null` / honest error row |
| Mentions mode | removed (needs search API) |

### Pricing

**$3.50 per 1,000 results** (pay-per-event). One result = one row (post, comment, profile, hashtag, place). Minimum $0.05/run.

### Input

| Field | Type | Default | Description |
|---|---|---|---|
| `startUrls` | array | \[] | Profile/post/hashtag/place URLs |
| `searchQueries` | array | \[] | Keywords for discovery |
| `searchType` | enum | `hashtag` | `hashtag` | `profile` | `place` |
| `contentToScrape` | enum | `posts` | `posts` | `reels` | `comments` | `details` |
| `resultsLimit` | int | 50 | Max results per URL (1–5000) |
| `onlyPostsNewerThan` | string | — | ISO date or relative (`7 days`) |
| `sessionCookie` | string (secret) | — | Instagram `sessionid` (reduces rate limiting) |
| `proxyConfiguration` | object | datacenter | Apify standard; `RESIDENTIAL` recommended for stability |
| `maxConcurrency` | int | 4 | 1–10 |
| `maxRequestRetries` | int | 4 | 0–10 |

### Output

One row per result. `type` ∈ `profile`, `post`, `comment`, `hashtag`, `place`, `error`. Error rows are pushed but never charged.

#### `profile` — details of a profile

| Field | Meaning |
|---|---|
| `type` | always `profile` |
| `id` | Instagram user ID |
| `username` | handle |
| `full_name` | display name |
| `bio` | biography text |
| `external_url` | website link |
| `followers`, `following` | exact counts from embedded JSON |
| `posts_count` | **approximate** (parsed from formatted `32K`) |
| `is_verified`, `is_private`, `is_business` | account flags |
| `profile_pic_url` | avatar URL |
| `url` | canonical profile URL |
| `fetched_at` | ISO 8601 fetch timestamp |

#### `post` — post or reel

| Field | Meaning |
|---|---|
| `type` | always `post` |
| `id` | media ID |
| `short_code`, `url` | shortcode and canonical `/p/` URL |
| `post_type` | `image`, `video`, `carousel` or `reel` |
| `caption` | caption text |
| `media_urls` | media URLs; carousel includes every slide |
| `likes` | like count (exact) |
| `comments_count` | **true total** comments on the post |
| `posted_at` | ISO 8601 publish time (UTC) |
| `location` | geotag name; **null** when ungeotagged |
| `tagged_users` | tagged usernames; **null** when absent |
| `fetched_at` | ISO 8601 fetch timestamp |

#### `comment` — first embedded page per post (~13)

| Field | Meaning |
|---|---|
| `type` | always `comment` |
| `id` | comment ID |
| `post_id`, `post_url` | post the comment belongs to |
| `text` | comment body |
| `author`, `author_username` | display name and handle |
| `likes` | comment like count |
| `created_at` | ISO 8601 time (UTC) |
| `fetched_at` | ISO 8601 fetch timestamp |

#### `hashtag` — details mode

| Field | Meaning |
|---|---|
| `type` | always `hashtag` |
| `name` | tag name without `#` |
| `media_count` | **approximate** (parsed from formatted `3.9B`) |
| `related_hashtags` | **always null** when logged out |
| `url` | canonical tag URL |
| `fetched_at` | ISO 8601 fetch timestamp |

#### `place` — details mode

| Field | Meaning |
|---|---|
| `type` | always `place` |
| `id` | location ID |
| `name`, `slug` | place name and URL slug |
| `address`, `city` | **always null** when logged out |
| `lat`, `lng` | coordinates (exact) |
| `category` | place category |
| `media_count` | media count (exact) |
| `fetched_at` | ISO 8601 fetch timestamp |

#### `error` — honest failure, never charged

| Field | Meaning |
|---|---|
| `type` | always `error` |
| `error_code` | `rate_limited`, `login_required`, `private_account`, `not_found`, `http_error`, `invalid_input` |
| `message` | human-readable detail |
| `input` | target URL/query that failed |
| `fetched_at` | ISO 8601 fetch timestamp |

### Usage

```bash
apify run -a admo-solutions/instagram-scraper
```

Or via API with `{"startUrls": [{"url": "https://www.instagram.com/natgeo/"}], "contentToScrape": "posts"}`.

# Actor input Schema

## `startUrls` (type: `array`):

Instagram profile, post, reel, hashtag, or place URLs. Take priority over search queries.

## `searchQueries` (type: `array`):

Keywords for discovery. Comma-separated words allowed.

## `searchType` (type: `string`):

How searchQueries are interpreted: hashtag tags, profile usernames, or place names (place-by-name unsupported logged-out → error row).

## `contentToScrape` (type: `string`):

What to extract: post/reel rows, comment rows, or entity details (profile/hashtag/place).

## `resultsLimit` (type: `integer`):

Maximum results (rows) per URL or query. 1–5000.

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

ISO date (YYYY-MM-DD) or relative (7 days, 2 weeks). UTC.

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

Instagram sessionid cookie; attached to page fetches to reduce rate limiting.

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

Apify standard. Default: datacenter rotation. Use RESIDENTIAL group for reliability against rate limiting.

## `maxConcurrency` (type: `integer`):

How many targets to fetch in parallel. 1–10.

## `maxRequestRetries` (type: `integer`):

Retry attempts per page fetch on rate limits/errors before an honest error row. 0–10.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.instagram.com/natgeo/"
    }
  ],
  "searchType": "hashtag",
  "contentToScrape": "posts",
  "resultsLimit": 50,
  "proxyConfiguration": {
    "useApifyProxy": true
  },
  "maxConcurrency": 4,
  "maxRequestRetries": 4
}
```

# Actor output Schema

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

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

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

```

## MCP server setup

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