scraping-instagram-profile-data

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Scraping Instagram Profile Data

抓取Instagram主页数据

Bulk profile export for any set of Instagram usernames. Returns account-level stats and optional recent post data.
批量导出任意Instagram用户名集合的主页数据。返回账号级统计数据及可选的近期帖子数据。

Prerequisites

前提条件

  • APIFY_TOKEN
    environment variable set
  • Optional: Apify MCP server installed
  • 已设置
    APIFY_TOKEN
    环境变量
  • 可选:已安装Apify MCP服务器

Inputs

输入参数

ParameterTypeRequiredDefaultNotes
startUrls
array
[]
Instagram URLs — profiles, hashtags, locations, audio pages, reels
until
stringOptionalScrape posts until this date (YYYY-MM-DD)
maxItems
numberOptionalUnlimitedMaximum posts to return
customMapFunction
stringOptionalJavaScript function to transform each output object
参数类型是否必填默认值说明
startUrls
数组
[]
Instagram链接——主页、话题标签、地点、音频页面、短视频
until
字符串可选抓取帖子的截止日期(格式:YYYY-MM-DD)
maxItems
数字可选无限制返回的最大帖子数量
customMapFunction
字符串可选用于转换每个输出对象的JavaScript函数

Workflow

工作流程

Progress:
- [ ] Step 1: Normalize username list
- [ ] Step 2: Run instagram-scraper
- [ ] Step 3: Poll for SUCCEEDED
- [ ] Step 4: Deliver profile dataset
Progress:
- [ ] Step 1: Normalize username list
- [ ] Step 2: Run instagram-scraper
- [ ] Step 3: Poll for SUCCEEDED
- [ ] Step 4: Deliver profile dataset

Step 2: Run the Actor

步骤2:运行Actor

Recommended — run_actor.js (handles waiting, output, and file saving automatically):
bash
undefined
推荐方式 — run_actor.js(自动处理等待、输出和文件保存):
bash
undefined

Quick answer (prints table to chat)

Quick answer (prints table to chat)

node scripts/run_actor.js
--actor "apidojo~instagram-scraper"
--input '{"param": "value"}'
node scripts/run_actor.js
--actor "apidojo~instagram-scraper"
--input '{"param": "value"}'

Save as CSV

Save as CSV

node scripts/run_actor.js
--actor "apidojo~instagram-scraper"
--input '{"param": "value"}'
--output YYYY-MM-DD_results.csv --format csv
node scripts/run_actor.js
--actor "apidojo~instagram-scraper"
--input '{"param": "value"}'
--output YYYY-MM-DD_results.csv --format csv

Save as JSON

Save as JSON

node scripts/run_actor.js
--actor "apidojo~instagram-scraper"
--input '{"param": "value"}'
--output YYYY-MM-DD_results.json --format json
> `APIFY_TOKEN` must be set in environment or `.env` file.

**If Apify MCP is available:**
Tool: apify:run-actor Actor: "apidojo~instagram-scraper" Input: { "usernames": ["handle1", "handle2"], "includeRecentPosts": false }

**REST API fallback:**
```bash
curl -X POST \
  "https://api.apify.com/v2/acts/apidojo~instagram-scraper/runs?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"usernames": ["handle1", "handle2"]}'
Save
id
as
RUN_ID
. Poll until
status = SUCCEEDED
:
bash
curl "https://api.apify.com/v2/actor-runs/$RUN_ID?token=$APIFY_TOKEN" | grep '"status"'
Fetch results:
bash
curl "https://api.apify.com/v2/actor-runs/$RUN_ID/dataset/items?token=$APIFY_TOKEN&format=json"
node scripts/run_actor.js
--actor "apidojo~instagram-scraper"
--input '{"param": "value"}'
--output YYYY-MM-DD_results.json --format json
> `APIFY_TOKEN`必须在环境变量或`.env`文件中设置。

**如果Apify MCP可用:**
Tool: apify:run-actor Actor: "apidojo~instagram-scraper" Input: { "usernames": ["handle1", "handle2"], "includeRecentPosts": false }

**REST API备选方案:**
```bash
curl -X POST \
  "https://api.apify.com/v2/acts/apidojo~instagram-scraper/runs?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"usernames": ["handle1", "handle2"]}'
保存
id
RUN_ID
,轮询直到
status = SUCCEEDED
bash
curl "https://api.apify.com/v2/actor-runs/$RUN_ID?token=$APIFY_TOKEN" | grep '"status"'
获取结果:
bash
curl "https://api.apify.com/v2/actor-runs/$RUN_ID/dataset/items?token=$APIFY_TOKEN&format=json"

Step 3: Handle Edge Cases

步骤3:处理边缘情况

  • Private accounts: Returns profile stats but no posts — flag
    isPrivate: true
    .
  • Account not found: Handle may be renamed or deactivated — note in output.
  • Business vs personal accounts: Business accounts expose contact info; personal accounts do not.
  • 私有账号:返回主页统计数据但无帖子——标记
    isPrivate: true
  • 账号未找到:账号可能已更名或停用——在输出中注明。
  • 商业账号vs个人账号:商业账号会显示联系信息;个人账号则不会。

Output Format

输出格式

undefined
undefined

Instagram Profile Dataset

Instagram Profile Dataset

Accounts requested: N | Returned: N | Private: N | Not found: N
UsernameFollowersFollowingPostsBio (truncated)BusinessVerified
.....................
Available fields: username, fullName, followersCount, followingCount, postsCount, biography, isVerified, isBusinessAccount, businessCategory, externalUrl, profilePicUrl
undefined
Accounts requested: N | Returned: N | Private: N | Not found: N
UsernameFollowersFollowingPostsBio (truncated)BusinessVerified
.....................
Available fields: username, fullName, followersCount, followingCount, postsCount, biography, isVerified, isBusinessAccount, businessCategory, externalUrl, profilePicUrl
undefined

Troubleshooting

故障排除

Missing accounts: Username changed or account deactivated since list was compiled. No engagement data: Engagement is per-post; use
includeRecentPosts: true
for post-level data.
账号缺失:列表编译后用户名已更改或账号已停用。 无互动数据:互动数据是基于单条帖子的;如需帖子级数据,请设置
includeRecentPosts: true