# Instagram Scraper - Posts, Profiles & Reels (`titan_network/dataclawd-instagram-data-collector`) Actor

Scrape Instagram profiles, posts, reels, comments, followers, hashtags, locations, search, and more through 36 API endpoints with automatic pagination. Powered by Titan Network.

- **URL**: https://apify.com/titan\_network/dataclawd-instagram-data-collector.md
- **Developed by:** [Titan Network](https://apify.com/titan_network) (community)
- **Categories:**
- **Stats:** 2 total users, 1 monthly users, 37.5% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.26 / 1,000 item collecteds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#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 Scraper - Posts, Profiles & Reels

This **Instagram scraper** collects public profiles, posts, reels, comments, followers, following, hashtags, locations, and search results through the **Dataclawd API**. Choose a task or endpoint, collect one or more targets with automatic `endCursor` / `maxId` pagination, and receive one Dataset row for each returned item.

It covers **36 endpoints** for user information, profiles, posts, reels, followers, following, post comments and likers, hashtags, search, explore, locations, music, and media/user ID conversion.

> Powered by Dataclawd API · Not affiliated with Instagram / Meta, Inc.

### What you can scrape

- Public Instagram profiles, posts, reels, comments, followers, following, tagged posts, and reposts.
- Hashtags, places, location feeds, explore sections, music information, and user or media ID conversions.
- User, hashtag, place, and combined search results through the available endpoints.

### Use cases

- Research public creator profiles and their posts, reels, comments, followers, or following.
- Monitor public hashtag, location, and explore content for market or content research.
- Build structured datasets from public Instagram search and endpoint results.

### FAQ

**How does pagination work?** The Actor follows `endCursor` or `maxId` automatically when `paginationParam` is `auto`; use `maxItems`, `maxPages`, or `startCursor` to control or resume collection.

**Can I collect multiple targets?** Yes. Add parameter objects to `targets`; the Actor processes each target in sequence.

**Where do credentials come from?** Dataclawd API credentials are configured by the publisher. Some Instagram endpoints also depend on Dataclawd's backend Instagram session being available.

**What public data can I collect?** Collect only data you are authorized to collect from the public endpoint responses listed below; availability can vary by endpoint and platform state.

### Quick start

1. Open the Actor's **Input** tab.
2. Pick a **task** (采集任务), e.g. `userPosts` — the endpoint is selected automatically.
3. Fill **userId** (numeric Instagram user ID — use the `idUserId` endpoint to convert a username to an ID, e.g. `instagram` → `25025320`).
4. Optionally set `count` (items per page), `maxItems` / `maxPages` to control volume, or add multiple objects to **targets** to batch-collect several users.
5. Click **Run** and open the **Dataset** tab when it finishes — every collected item is one row with the raw JSON in the `data` field.

### Input

| Field | Type | Default | Description |
| --- | --- | --- | --- |
| `task` | enum | — | **Recommended.** Collection intent, auto-maps to an endpoint (see Tasks below). Leave empty only if you set `endpoint` explicitly. |
| `endpoint` | enum | `auto` | Advanced. `auto` = resolve from `task`; or set an explicit endpoint to override. |
| `userId` | string | — | Instagram numeric user ID. Needed by `user*` list endpoints (posts/reels/followers/...). |
| `username` | string | — | Instagram username without `@` (e.g. `instagram`). Used by profile / ID-conversion endpoints. |
| `shortcode` | string | — | Post/reel shortcode (the part after `/p/` or `/reel/` in a post URL), e.g. `C4PYiJQubeR`. Needed by `post*` endpoints. |
| `url` | string | — | Full post/reel URL (alternative to `shortcode`). |
| `q` | string | — | Search keyword. Needed by `hashtag*` / `search*` endpoints. |
| `type` | enum | `blended` | Search type: `blended` / `users` / `hashtags` / `places`. |
| `count` | integer | `12` | Items per page (IG commonly uses 12 / 30). |
| `locationPk` | string | — | Instagram location ID. Needed by `location*` endpoints. |
| `lat` / `lng` | string | — | Coordinates for `directory*` endpoints. |
| `tab` | enum | `ranked` | Location posts tab: `ranked` (top) / `recent`. |
| `countryCode` / `cityId` / `page` | string/int | — | Directory endpoints (`directoryCities` / `directoryLocations`). |
| `musicId` | string | — | Music ID. Needed by `musicInfo`. |
| `sectionId` | string | — | Explore section ID (optional for `explore*`). |
| `maxId` | string | *(empty)* | Start cursor for search/hashtag/explore/music endpoints. |
| `targets` | array of object | *(empty)* | Batch mode: each element is a param set, collected one after another. |
| `proxyUrl` | string | *(empty)* | Proxy used by Dataclawd's server when fetching Instagram. |
| `httpMethod` | enum | `GET` | Dataclawd Instagram endpoints are GET-only; `POST` usually returns `endpoint_not_found`. |
| `maxItems` | integer | `100` | Stop after this many items in total (max 100 000). |
| `maxPages` | integer | `10` | Max pages per target (max 100). |
| `startCursor` | string | *(empty)* | Start from a previous cursor (`endCursor` / `maxId`). |
| `itemsPath` | string | *(empty)* | Dot-path to the item list. Leave empty for auto-detection (largest array). |
| `nextCursorPath` | string | *(empty)* | Dot-path to the next-page cursor. Leave empty for auto-detection (`end_cursor` / `max_id` / `profile_grid_items_cursor` ...). |
| `paginationParam` | enum | `auto` | Query param used for paging: `auto` (per endpoint), `endCursor`, `maxId`, or `none`. |

#### Endpoints

#### Tasks

Pick a `task` and the Actor selects the endpoint for you. Fill the params below (`username` / `userId` / `shortcode` / `q` …).

| Task | Endpoint | Required params |
| --- | --- | --- |
| `userInfo` 用户资料 | `userInfo` | `username` or `userId` |
| `userPosts` 用户帖子 | `userPosts` | `userId` |
| `userReels` 用户 Reels | `userReels` | `userId` |
| `userFollowers` 用户粉丝 | `userFollowers` | `userId` |
| `userFollowing` 用户关注 | `userFollowing` | `userId` |
| `postDetail` 帖子详情 | `postDetail` | `shortcode` or `url` |
| `postComments` 帖子评论 | `postComments` | `shortcode` or `url` |
| `postLikers` 帖子点赞 | `postLikers` | `shortcode` or `url` |
| `hashtagTop` Hashtag 热门 | `hashtagTop` | `q` |
| `hashtagRecent` Hashtag 最新 | `hashtagRecent` | `q` |
| `search` 综合搜索 | `search` | `q` |
| `searchUsers` 搜索用户 | `searchUsers` | `q` |
| `searchPlaces` 搜索地点 | `searchPlaces` | `q` |
| `locationFeeds` 地点帖子 | `locationFeeds` | `locationPk` |
| `explore` 探索页 | `exploreSection` | — |

**ID conversion** — `idUserId`, `idUsername`, `idMediaId`, `idMediaShortcode`
**User** — `userInfo`, `userProfile`, `userProfile2`, `userWebProfile`, `userPosts`, `userPosts2`, `userReels`, `userTagged`, `userReposts`, `userRelatedProfiles`, `userFollowers`, `userFollowing`
**Post** — `postDetail`, `postComments`, `postTopComments`, `postLikers`, `postDownloadLink`, `postVideoUrl`
**Hashtag** — `hashtagInfo`, `hashtagRecent`, `hashtagTop`
**Search** — `search`, `searchUsers`, `searchHashtags`, `searchPlaces`
**Explore** — `exploreSection`, `exploreSections`
**Location / directory** — `locationFeeds`, `locationInfo2`, `directoryCities`, `directoryLocations`
**Music** — `musicInfo`

### Output (Dataset — one row per collected item)

| Field | Description |
| --- | --- |
| `platform` | Always `instagram`. |
| `endpoint` | The endpoint that produced this row. |
| `status` | `completed` (data collected) or `failed` (request-level failure). |
| `target` | Human-readable target summary, e.g. `userId=25025320`. |
| `page` | Page number this item came from (1-based). |
| `itemIndex` | Sequential index within the run (1-based). |
| `cursor` | Cursor used to fetch that page (`-1` = first page). |
| `data` | **The collected item** — the raw JSON returned by Dataclawd (an IG media / user / comment object). |
| `errorStage` | Where a failure happened: `connect_failed` / `server_error` / `auth_error` / `rate_limited` / `request_error` / `parse_error` / `empty_result`. |
| `errorCode` | HTTP status code (if any), e.g. `429`. |
| `error` | Error message on failed rows. |

> Note: some Instagram endpoints require Dataclawd's own Instagram session to be logged in. If Dataclawd's backend is logged out / rate-limited, the API returns `login_required` / "Please wait a few minutes" style payloads; the Actor writes them as `failed` rows with the original message in `error` (best-effort collection still works for endpoints that are available).

#### Run status & status message

While running, the Actor's **status message** is updated periodically (`开始采集 …` → `采集 … 中：已写入 n 条` → `完成：…`). The run **succeeds** (`SUCCEEDED`) as soon as **at least one item** is collected. If every target fails or returns nothing, the run ends `FAILED` with an explanatory message. Billing happens only for `completed` rows.

### How to verify the results

1. **Run status**: the run is `SUCCEEDED` when at least one item was written; the status message shows live progress.
2. **Per-item state**: open the run's **Dataset** — every collected item has `status=completed` with the raw JSON in `data`; failed rows explain why (`errorStage` / `errorCode` / `error`).
3. **Spot-check against the API**: re-run one target in the Dataclawd API Console and compare with the row's `data`.
4. **Billing**: only `completed` rows carry the `item-collected` pay-per-event charge.

> Developer note: for automated checks (run status, row schema, optional Dataclawd API replay), use `python3 tools/verify_output.py --run <RUN_ID> [--api]`.

### Pricing

Pay-per-event (PPE): **one `item-collected` event per successfully collected item**. Failed rows do **not** carry this event.

> Publishing note: define an `item-collected` event with your price in the Actor's **Monetization** tab. The platform's built-in synthetic event `apify-default-dataset-item` is charged automatically per default-dataset item when PPE is enabled; set its price to `0` if you don't want a per-item base fee.

### Configuration (publisher)

The following environment variables are configured on the Actor's version settings and are not visible to end users:

- `DATACLAWD_API_HOST` — Dataclawd API base URL (e.g. `https://api.dataclawd.example`).
- `DATACLAWD_API_KEY` — Dataclawd API key (sent as `X-API-Key`).

### Disclaimer

This Actor is not affiliated with, endorsed by, or sponsored by Instagram or Meta, Inc. Collect only data you are authorized to collect, and comply with Instagram's Terms of Service, the Dataclawd service terms, and applicable law.

***

### 中文简介

本 Actor 通过 **Dataclawd API** 批量采集 Instagram 数据（**36 个端点**）：用户资料/帖子/Reels/粉丝/关注、帖子详情/评论/点赞/下载与视频链接、Hashtag 信息/最新/热门、搜索（用户/标签/地点/综合）、探索板块、地点帖子与城市目录、音乐信息，以及用户/媒体 ID 转换。选定采集端点、自动按 `endCursor`/`maxId` 游标分页、自动提取条目列表（最大数组启发式；`itemsPath`/`nextCursorPath` 可显式指定），并把每条数据以 JSON 写入 Apify 默认 Dataset（成功行同时也是按事件计费的计费事件）。

- **输入**：`endpoint`（采集端点，必填）、`userId`（user\* 列表端点，可用 `idUserId` 由用户名换 ID）、`username`/`shortcode`/`url`/`q`/`locationPk`/`musicId`（各端点对应主体）、`count`（每页条数）、`targets`（批量目标列表，可选）、`maxItems`/`maxPages`（采集量控制）、`maxId`/`startCursor`（续采）、`itemsPath`/`nextCursorPath`（高级：显式指定提取路径与游标路径）、`paginationParam`（分页参数，auto 时 user/post 用 `endCursor`、search/hashtag 用 `maxId`）。
- **输出**：每行包含 `platform`、`endpoint`、`status`（`completed`/`failed`）、`target`、`page`、`itemIndex`、`cursor` 和采集到的原始数据 `data`；失败行带 `errorStage`（`connect_failed`/`server_error`/`auth_error`/`rate_limited`/`request_error`/`parse_error`/`empty_result`）、`errorCode`、`error`。运行中实时进度通过 Apify 状态消息展示，至少采到 1 条即运行成功（`SUCCEEDED`），全部失败/空结果则运行失败（`FAILED`）。
- **注意**：部分 Instagram 端点需要 Dataclawd 后端自身已登录 Instagram；若后端登出/被限流，API 会返回 `login_required` 或 "Please wait a few minutes" 之类的负载，Actor 会将其作为 `failed` 行写入并保留原始错误信息。
- **计费**：按事件计费（PPE），每条成功采集计一个 `item-collected` 事件；失败行不计费（发布时需在 Console Monetization 中配置该事件及价格）。
- **验证数据**：`status=completed` 即成功采集（数据在 `data` 字段）；开发时可运行 `python3 tools/verify_output.py --run <RUN_ID>` 校验。
- **免责声明**：本 Actor 与 Instagram / Meta, Inc. 无任何附属关系。请仅采集你被授权采集的数据，并遵守 Instagram 服务条款、Dataclawd 服务条款与当地法律。

# Actor input Schema

## `task` (type: `string`):

要采集的 Instagram 数据场景。选一个即可，Actor 会自动映射到对应端点；参数填在下方对应字段（username/userId/shortcode/q 等）。留空则须在「高级选项」里手动指定 endpoint。 / The Instagram data scenario to collect. Choose one and the Actor maps it to the corresponding endpoint automatically; fill in the parameters in the matching fields below (username/userId/shortcode/q, etc.). Leave empty to manually specify the endpoint in "Advanced options".

## `endpoint` (type: `string`):

高级选项：默认 auto（按「采集任务 task」自动选择端点）；也可手动指定具体端点覆盖 task。 / Advanced options: defaults to auto (the endpoint is selected automatically based on the "Collection task" field); you can also manually specify a concrete endpoint to override task.

## `userId` (type: `string`):

Instagram 数字用户 ID（user\* 多数端点必填）。可用 idUserId 端点由用户名获取。 / Instagram numeric user ID (required by most user\* endpoints). Use the idUserId endpoint to obtain it from a username.

## `username` (type: `string`):

Instagram 用户名（不含 @），例如 instagram。部分端点按用户名查询。 / Instagram username without @, e.g. instagram. Some endpoints query by username.

## `shortcode` (type: `string`):

帖子/Reel 短码（帖子 URL 中 /p/ 或 /reel/ 后的部分），例如 C4PYiJQubeR。post\* 端点需要。 / Post/Reel shortcode (the part after /p/ or /reel/ in the post URL), e.g. C4PYiJQubeR. Required by post\* endpoints.

## `url` (type: `string`):

帖子/Reel 完整 URL（与 shortcode 二选一），例如 https://www.instagram.com/reel/C4PYiJQubeR/。 / Full post/Reel URL (alternative to shortcode), e.g. https://www.instagram.com/reel/C4PYiJQubeR/.

## `q` (type: `string`):

hashtag\* / search\* 端点必填，例如 nature、instagram。 / Required for hashtag\* / search\* endpoints, e.g. nature, instagram.

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

search 系列端点类型：blended（综合）/ users / hashtags / places。 / Type for search endpoints: blended (general) / users / hashtags / places.

## `count` (type: `integer`):

每页返回条数（IG 常用 12/30）。 / Number of items returned per page (12/30 is common on IG).

## `locationPk` (type: `string`):

Instagram 地点 ID（location\_pk），location\* 端点需要。 / Instagram location ID (location\_pk), required by location\* endpoints.

## `lat` (type: `string`):

纬度（directory 端点按坐标搜索时用）。 / Latitude (used when searching by coordinates in directory endpoints).

## `lng` (type: `string`):

经度（directory 端点按坐标搜索时用）。 / Longitude (used when searching by coordinates in directory endpoints).

## `tab` (type: `string`):

location/feeds 端点：ranked（热门）/ recent（最新）。 / For location/feeds endpoints: ranked (top) / recent (latest).

## `countryCode` (type: `string`):

directory/cities 端点国家代码，例如 US。 / Country code for directory/cities endpoints, e.g. US.

## `cityId` (type: `string`):

directory/locations 端点城市 ID。 / City ID for directory/locations endpoints.

## `page` (type: `integer`):

directory 端点分页页码（从 1 开始）。 / Pagination page number for directory endpoints (starts from 1).

## `musicId` (type: `string`):

音乐 ID（musicInfo 端点需要）。 / Music ID (required by the musicInfo endpoint).

## `sectionId` (type: `string`):

explore 系列端点板块 ID（可选）。 / Section ID for explore endpoints (optional).

## `maxId` (type: `string`):

search/hashtag/explore/music 系列端点的起始分页游标（max\_id）。留空从第一页开始。 / Starting pagination cursor (max\_id) for search/hashtag/explore/music endpoints. Leave empty to start from the first page.

## `targets` (type: `array`):

批量采集：每个元素是一组参数（覆盖上面各字段），Actor 会逐个目标采集。例如 \[{"userId":"25025320"},{"userId":"44196397"}]。 / Batch collection: each element is a set of parameters (overriding the fields above), and the Actor collects each target one by one. For example \[{"userId":"25025320"},{"userId":"44196397"}].

## `proxyUrl` (type: `string`):

Dataclawd 服务端请求 Instagram 时使用的代理地址。 / Proxy address used by the Dataclawd server when requesting Instagram.

## `httpMethod` (type: `string`):

调用 Dataclawd 端点使用的 HTTP 方法（Instagram 端点在 Dataclawd 后端仅支持 GET）。 / HTTP method used to call the Dataclawd endpoint (Instagram endpoints support only GET on the Dataclawd backend).

## `maxItems` (type: `integer`):

整个运行最多写入 Dataset 的条目数，达到即停止。 / Maximum number of items written to the Dataset for the whole run; stops when reached.

## `maxPages` (type: `integer`):

每个目标最多翻页次数（防止无限翻页）。 / Maximum number of pages per target (prevents infinite pagination).

## `startCursor` (type: `string`):

从指定游标开始翻页（续采上次未完成的数据）。留空从第一页开始。 / Start paginating from the specified cursor (to resume previously incomplete data). Leave empty to start from the first page.

## `itemsPath` (type: `string`):

点号路径，指定响应中条目列表的位置。留空则自动探测（最大数组）。 / Dot path specifying the location of the item list in the response. Leave empty to auto-detect (the largest array).

## `nextCursorPath` (type: `string`):

点号路径，指定响应中下一页游标的位置。留空自动探测（endCursor/maxId/end\_cursor/max\_id/profile\_grid\_items\_cursor 等）。 / Dot path specifying the location of the next-page cursor in the response. Leave empty to auto-detect (endCursor/maxId/end\_cursor/max\_id/profile\_grid\_items\_cursor, etc.).

## `paginationParam` (type: `string`):

翻页时使用的查询参数：auto 按端点自动选择（user/post 用 endCursor，search/hashtag 用 maxId）；none 不翻页。 / Query parameter used for pagination: auto chooses by endpoint (endCursor for user/post, maxId for search/hashtag); none disables pagination.

## Actor input object example

```json
{
  "task": "userPosts",
  "endpoint": "auto",
  "userId": "25025320",
  "type": "blended",
  "count": 12,
  "tab": "ranked",
  "page": 1,
  "targets": [],
  "httpMethod": "GET",
  "maxItems": 5,
  "maxPages": 1,
  "paginationParam": "auto"
}
```

# Actor output Schema

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

Dataset of collected Instagram records — one item per record.

# 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 = {
    "task": "userPosts",
    "endpoint": "auto",
    "userId": "25025320",
    "targets": [],
    "maxItems": 5,
    "maxPages": 1
};

// Run the Actor and wait for it to finish
const run = await client.actor("titan_network/dataclawd-instagram-data-collector").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 = {
    "task": "userPosts",
    "endpoint": "auto",
    "userId": "25025320",
    "targets": [],
    "maxItems": 5,
    "maxPages": 1,
}

# Run the Actor and wait for it to finish
run = client.actor("titan_network/dataclawd-instagram-data-collector").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 '{
  "task": "userPosts",
  "endpoint": "auto",
  "userId": "25025320",
  "targets": [],
  "maxItems": 5,
  "maxPages": 1
}' |
apify call titan_network/dataclawd-instagram-data-collector --silent --output-dataset

```

## MCP server setup

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

```

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/Duv6VGKUGvcKI6FKh/builds/NaNOAK0Zp8pPdYyYW/openapi.json
