# Instagram Mass Scraper & Follower (`klazmolabs/massscraper-follower`) Actor

This Apify Actor scrapes the follower list of any Instagram account your session can access, then optionally follows those users from your own Instagram account.

Use this to grab your Instagram Session ID:

https://chromewebstore.google.com/detail/cookie-editor/hlkenndednhfkekhgcdicdfddnkalmdm

- **URL**: https://apify.com/klazmolabs/massscraper-follower.md
- **Developed by:** [Klazmo Labs](https://apify.com/klazmolabs) (community)
- **Categories:** Social media, Automation, Lead generation
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $8.00 / 1,000 user followeds

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

## Instagram Follower Scraper + Auto Follow

Apify Actor that:

1. Takes a **target Instagram account** (username or profile URL)
2. Scrapes a list of **usernames that follow that account**
3. Optionally **follows those users** from your own Instagram session

Built to deploy on [Apify](https://apify.com) and monetize via the Apify Store (pay-per-event).

> **Important:** Automating follows can violate [Instagram’s Terms of Use](https://help.instagram.com/581066165581870) and may get accounts checkpointed or action-blocked. Use low daily limits, residential proxies, and `dryRun` while testing. You are responsible for how you use this Actor.

***

### Features

- Cookie-based auth (`sessionid`) — no password stored in the Actor
- Follower list pagination with a configurable cap
- Optional auto-follow with human-like delays and random jitter
- Skip private / already-following accounts
- **Dry run** mode (default) — scrape + preview without sending follows
- Apify Proxy support (RESIDENTIAL recommended)
- Dataset output + `SUMMARY` key-value record
- Pay-per-event hooks: `follower-scraped`, `user-followed`

***

### How to get your Instagram session cookie

1. Log into Instagram in Chrome / Firefox
2. Open DevTools → **Application** (Chrome) or **Storage** (Firefox) → **Cookies** → `https://www.instagram.com`
3. Copy the value of **`sessionid`**
4. Paste it into the Actor input field `sessionCookie`

Optional: export all cookies with a Cookie-Editor extension and paste the JSON / header into `sessionCookie` or `cookieHeader`.

Treat `sessionid` like a password. Anyone with it can use the account.

***

### Input

| Field | Required | Default | Description |
| --- | --- | --- | --- |
| `targetUsername` | ✅ | — | Username or profile URL to scrape followers from |
| `sessionCookie` | ✅ | — | `sessionid` value, full Cookie header, or Cookie-Editor JSON |
| `csrfToken` | ❌ | auto | Optional `csrftoken` |
| `cookieHeader` | ❌ | — | Optional full cookie string |
| `maxFollowers` | ❌ | `100` | Max followers to collect |
| `maxFollowsPerRun` | ❌ | `20` | Max follow actions (0 = scrape only) |
| `delayBetweenFollowsSeconds` | ❌ | `25` | Base delay between follows |
| `randomDelayVariationSeconds` | ❌ | `8` | ± jitter on delays |
| `dryRun` | ❌ | `true` | Scrape without following |
| `scrapeOnly` | ❌ | `false` | Force scrape-only |
| `skipPrivateAccounts` | ❌ | `true` | Skip private profiles when following |
| `skipAlreadyFollowing` | ❌ | `true` | Skip users you already follow/requested |
| `proxyConfiguration` | ❌ | RESIDENTIAL | Apify Proxy settings |

#### Example input

```json
{
  "targetUsername": "nike",
  "sessionCookie": "YOUR_SESSIONID_HERE",
  "maxFollowers": 100,
  "maxFollowsPerRun": 15,
  "delayBetweenFollowsSeconds": 30,
  "dryRun": false,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": ["RESIDENTIAL"]
  }
}
```

***

### Output

Each scraped follower is pushed to the dataset:

```json
{
  "targetUsername": "nike",
  "userId": "123456789",
  "username": "example_user",
  "fullName": "Example User",
  "isPrivate": false,
  "isVerified": false,
  "profileUrl": "https://www.instagram.com/example_user/",
  "followStatus": "followed",
  "followDetail": "Now following",
  "scrapedAt": "2026-07-27T18:00:00.000Z"
}
```

`followStatus` values: `scraped` | `followed` | `requested` | `skipped` | `failed` | `dry_run`

A `SUMMARY` object is saved to the default key-value store with totals for the run.

***

### Local development

```bash
npm install
## edit storage/key_value_stores/default/INPUT.json
npm start          # runs with tsx
npm test
npm run build
```

Deploy to Apify:

```bash
npx apify login
npx apify push
```

Or connect the GitHub repo in Apify Console → Actors → Create new → Link Git repository.

***

### Monetize on the Apify Store

1. Push / build the Actor on Apify
2. Open **Publication** → publish to the Store
3. Open **Monetization** → choose **Pay per event**
4. Create events (suggested starter prices — tune to your costs):

| Event name | When charged | Suggested price |
| --- | --- | --- |
| `follower-scraped` | Each follower saved to the dataset | ~$0.002–0.01 |
| `user-followed` | Each successful follow / request | ~$0.01–0.05 |
| `apify-actor-start` | Synthetic start event (optional) | ~$0.005 |

The Actor already calls:

```ts
await Actor.charge({ eventName: 'follower-scraped' });
await Actor.charge({ eventName: 'user-followed' });
```

5. Write a Store listing from this README (what it does, inputs, limits, ToS warning)
6. Set a free test allowance so buyers can try dry-run scrapes

#### Pricing tips

- Charge more for **follows** than for **scrapes** (follows burn session risk + compute time on delays)
- Recommend RESIDENTIAL proxy and keep default `maxFollowsPerRun` low
- Market as growth tooling for public accounts the buyer already has permission to engage with

***

### Troubleshooting HTTP 429

Instagram often returns **429** on the first request when:

- The Actor uses plain Node HTTP (TLS fingerprint) — fixed by running inside Playwright
- Proxy IP rotates every request while using a login cookie — fixed with sticky proxy sessions
- Datacenter proxies are used — switch to **RESIDENTIAL**
- The `sessionid` is old / from a different IP/country than usual

**What to do after rebuilding this version:**

1. Rebuild the Actor on Apify (Playwright image)
2. Use **Apify Proxy → RESIDENTIAL**, ideally a country close to the account
3. Paste a **fresh** `sessionid` from the browser you normally use
4. First run: `dryRun = true`, `maxFollowers = 20`, `maxFollowsPerRun = 0`
5. Avoid `maxFollowsPerRun = 200` — Instagram commonly action-blocks that

### Re-runs don't follow the same people

Turn **Remember followed users across runs** ON (default). The Actor stores successful follows in a named Key-Value Store (`instagram-follow-memory`) and skips them next time, continuing further down the follower list.

Use **Reset follow memory** if you want to start over.

***

### Safety limits (recommended)

| Account age | Max follows / day |
| --- | --- |
| New (< 1 month) | 10–20 |
| Mature | 20–40 |

Space runs across the day. If Instagram returns 403/429 or “action blocked”, stop and cool down for 24–48h.

***

### How it works (technical)

Uses Instagram’s web API with your browser session:

1. `GET /api/v1/users/web_profile_info/?username=…` → resolve target user id
2. `GET /api/v1/friendships/{id}/followers/` → paginate followers
3. `POST /api/v1/friendships/create/{id}/` → follow (when not dry-run)

Private target accounts only work if your session already follows them.

***

### License

ISC

# Actor input Schema

## `targetUsername` (type: `string`):

Account whose followers you want to collect. Example: nike  or  https://www.instagram.com/nike/

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

From Chrome: DevTools → Application → Cookies → https://www.instagram.com → copy the sessionid value. You can also paste a full Cookie header or Cookie-Editor JSON.

## `csrfToken` (type: `string`):

Usually auto-detected. Only fill if follows fail with CSRF errors.

## `cookieHeader` (type: `string`):

Optional. Paste a full document.cookie / Cookie header if you prefer that over sessionid alone.

## `dryRun` (type: `boolean`):

ON = scrape followers only, do not follow anyone. Turn OFF only when you are ready to send follow requests.

## `scrapeOnly` (type: `boolean`):

Force scrape-only mode even if Dry run is off.

## `maxFollowers` (type: `integer`):

How many follower usernames to collect from the target account.

## `maxFollowsPerRun` (type: `integer`):

Max follow actions this run. Use 0 to scrape only. Recommended: 10–20 for new accounts, 20–40 for mature ones.

## `delayBetweenFollowsSeconds` (type: `integer`):

Wait time between each follow. Higher is safer.

## `randomDelayVariationSeconds` (type: `integer`):

Adds +/- this many seconds to each delay so it looks less robotic.

## `skipPrivateAccounts` (type: `boolean`):

When following, skip private profiles.

## `skipAlreadyFollowing` (type: `boolean`):

Skip users Instagram reports as already following or requested.

## `rememberFollowedUsers` (type: `boolean`):

ON = save everyone this Actor successfully followed and skip them on the next run (so you don't keep following the same first people in the list).

## `resetFollowedMemory` (type: `boolean`):

Clear the saved list of already-followed users before this run.

## `followMemoryStoreName` (type: `string`):

Named Apify Key-Value Store used to remember followed users. Change only if you run multiple Instagram accounts and want separate memories.

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

Use Apify Proxy → RESIDENTIAL. Pick a proxy country close to where the Instagram account usually logs in. The Actor uses a sticky session so the same IP stays paired with your cookie.

## Actor input object example

```json
{
  "targetUsername": "instagram",
  "dryRun": true,
  "scrapeOnly": false,
  "maxFollowers": 100,
  "maxFollowsPerRun": 20,
  "delayBetweenFollowsSeconds": 25,
  "randomDelayVariationSeconds": 8,
  "skipPrivateAccounts": true,
  "skipAlreadyFollowing": true,
  "rememberFollowedUsers": true,
  "resetFollowedMemory": false,
  "followMemoryStoreName": "instagram-follow-memory",
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

## `followers` (type: `string`):

Dataset of scraped followers and follow outcomes

## `summary` (type: `string`):

Aggregated counts for the run

# 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 = {
    "targetUsername": "instagram",
    "dryRun": true,
    "maxFollowers": 100,
    "maxFollowsPerRun": 20,
    "delayBetweenFollowsSeconds": 25,
    "randomDelayVariationSeconds": 8,
    "rememberFollowedUsers": true,
    "followMemoryStoreName": "instagram-follow-memory",
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("klazmolabs/massscraper-follower").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 = {
    "targetUsername": "instagram",
    "dryRun": True,
    "maxFollowers": 100,
    "maxFollowsPerRun": 20,
    "delayBetweenFollowsSeconds": 25,
    "randomDelayVariationSeconds": 8,
    "rememberFollowedUsers": True,
    "followMemoryStoreName": "instagram-follow-memory",
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("klazmolabs/massscraper-follower").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 '{
  "targetUsername": "instagram",
  "dryRun": true,
  "maxFollowers": 100,
  "maxFollowsPerRun": 20,
  "delayBetweenFollowsSeconds": 25,
  "randomDelayVariationSeconds": 8,
  "rememberFollowedUsers": true,
  "followMemoryStoreName": "instagram-follow-memory",
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call klazmolabs/massscraper-follower --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/RectJqjTjwLThesD6/builds/jCgbkgcPQQA80kSgY/openapi.json
