# Instagram Scraped (`apificasion/instagram-scraped`) Actor

Best app for Instagram scraping

- **URL**: https://apify.com/apificasion/instagram-scraped.md
- **Developed by:** [Nalintha Alwis](https://apify.com/apificasion) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 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 — Apify Actor

A production-ready **Apify Actor** that scrapes public Instagram data using a headless Playwright browser. Handles profiles, posts, hashtags, comments, and followers/following lists.

***

### 🚀 Features

| Feature | Description |
|---|---|
| **Profiles** | Username, full name, bio, website, follower/following/post counts, verified status |
| **Posts** | Caption, likes, comments count, media URLs (image/video), timestamp, location |
| **Hashtags** | Top & recent posts for any hashtag |
| **Comments** | All visible comments on a post (username, text, timestamp) |
| **Followers/Following** | List of followers or accounts a user follows *(requires session cookies)* |
| **Media Download** | Optionally download images/videos to Apify Key-Value store |
| **Date Filtering** | Filter posts by `dateFrom` / `dateTo` |
| **Proxy Support** | Works with Apify Residential Proxies or custom proxies |
| **Stealth** | Browser fingerprint injection, navigator.webdriver override, randomised delays |

***

### 💰 Pay-Per-Event (PPE) Pricing

This Actor uses Apify's **Pay-Per-Event (PPE)** monetization model. You **only pay for data successfully delivered** — there are no charges for browser compute hours, proxy wait times, initialization, or failed requests.

#### Event Pricing Breakdown

| Event Identifier | Description | Unit Price (USD) | Price per 1,000 Items |
|---|---|---|---|
| `scrape-profile` | Complete Instagram Profile (bio, stats, verified badge, avatar, business info) | **$0.005** | **$5.00** |
| `scrape-post` | Instagram Post (captions, media URLs, likes, timestamps, location) | **$0.003** | **$3.00** |
| `scrape-hashtag` | Hashtag Explore Overview (metadata, post counts, URLs) | **$0.005** | **$5.00** |
| `scrape-comment` | Post Comment (commenter username, comment text, timestamp) | **$0.001** | **$1.00** |
| `scrape-follower` | Follower or Following Account Record (username, full name, avatar) | **$0.002** | **$2.00** |

#### Why Pay-Per-Event?

- **Zero Idle Costs**: Never pay for browser spin-up time, navigation lags, or idle worker instances.
- **Pay Strictly on Success**: Charges trigger exclusively when valid items are extracted and pushed to the dataset.
- **Budget Protection**: Set a **Max total charge (USD)** limit in Apify Console or API. If your limit is reached, the run terminates safely without overcharges.

#### Example Cost Scenarios

| Use Case | Estimated Output | Calculation | Total Cost |
|---|---|---|---|
| Profile audit for 200 creators | 200 profiles | 200 × $0.005 | **$1.00** |
| Scrape 1,000 posts from a hashtag | 1,000 posts | 1,000 × $0.003 | **$3.00** |
| Scrape 2,000 comments on a brand post | 2,000 comments | 2,000 × $0.001 | **$2.00** |
| Extract 1,500 followers of a competitor | 1,500 followers | 1,500 × $0.002 | **$3.00** |

***

### ⚠️ Legal & Ethical Notice

This actor is intended for scraping **publicly available** data only. Use responsibly:

- Do **not** scrape private accounts
- Respect Instagram's [Terms of Service](https://help.instagram.com/581066165581870)
- Comply with GDPR, CCPA, and other applicable privacy regulations
- Do not use scraped data to harass or harm individuals
- Consider rate limits — use `requestDelay` and low `maxConcurrency` settings

# Actor input Schema

## `scrapeType` (type: `string`):

Choose what type of Instagram data to scrape.

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

List of Instagram usernames to scrape (used for: profiles, posts, followers).

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

List of hashtags to scrape (without the # symbol). Used when scrapeType is 'hashtags'.

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

List of Instagram post URLs to scrape comments from. Used when scrapeType is 'comments'.

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

Maximum number of results to return per input item. Use 0 for unlimited.

## `sessionCookies` (type: `array`):

Paste your Instagram session cookies as a JSON array of cookie objects to enable authenticated scraping. Helps bypass rate limits and access more data. Leave empty for unauthenticated scraping.

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

Configure proxy server usage. Residential proxies are strongly recommended for Instagram.

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

Maximum number of browser tabs opened simultaneously. Keep low (1-3) to avoid blocks.

## `requestDelay` (type: `integer`):

Minimum delay in milliseconds between requests to avoid rate limiting.

## `includeFollowers` (type: `boolean`):

When scraping profiles, also scrape their followers list.

## `includeFollowing` (type: `boolean`):

When scraping profiles, also scrape who they follow.

## `downloadMedia` (type: `boolean`):

Download post images and videos to the Key-Value store.

## `dateFrom` (type: `string`):

Filter posts published on or after this date (ISO 8601 format, e.g. 2024-01-01).

## `dateTo` (type: `string`):

Filter posts published on or before this date (ISO 8601 format, e.g. 2024-12-31).

## Actor input object example

```json
{
  "scrapeType": "profiles",
  "usernames": [
    "instagram",
    "natgeo"
  ],
  "hashtags": [
    "travel",
    "photography"
  ],
  "postUrls": [
    "https://www.instagram.com/p/XXXXXXXXX/"
  ],
  "resultsLimit": 50,
  "sessionCookies": [
    {
      "name": "sessionid",
      "value": "YOUR_SESSION_ID",
      "domain": ".instagram.com"
    },
    {
      "name": "ds_user_id",
      "value": "YOUR_USER_ID",
      "domain": ".instagram.com"
    }
  ],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  },
  "maxConcurrency": 2,
  "requestDelay": 2000,
  "includeFollowers": false,
  "includeFollowing": false,
  "downloadMedia": false
}
```

# Actor output Schema

## `dataset` (type: `string`):

JSON items endpoint containing all scraped Instagram profiles, posts, hashtags, comments, or followers.

## `downloadCsv` (type: `string`):

Direct download link for all scraped records in CSV format.

## `downloadJson` (type: `string`):

Direct download link for clean JSON records without internal metadata.

## `downloadExcel` (type: `string`):

Direct download link for Microsoft Excel spreadsheet export.

# 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": [
        "instagram"
    ],
    "hashtags": [
        "travel"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("apificasion/instagram-scraped").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": ["instagram"],
    "hashtags": ["travel"],
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("apificasion/instagram-scraped").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 '{
  "usernames": [
    "instagram"
  ],
  "hashtags": [
    "travel"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call apificasion/instagram-scraped --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,apificasion/instagram-scraped"
        }
    }
}
```

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/3CJ5dlPWmTu8riTOG/builds/UF9ZLh5wICZcAee2a/openapi.json
