instagram

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Bright Data - Instagram

Bright Data - Instagram

Four datasets: profiles, posts, reels, comments. Three routes into them. Pick by what the user has and wants. The SDK lines were verified on 2026-09-11 against
brightdata-sdk
2.5.2; the CLI and MCP lines follow
@brightdata/cli
0.4.1 and
@brightdata/mcp
4.1.0.
Datasetdataset_idMethods
Profiles
gd_l1vikfch901nx3by4
collect_by_url
,
discover_by_user_name
Posts
gd_lk5ns7kz21pck8jpis
collect_by_url
,
discover_by_url
(a profile URL: its recent posts)
Reels
gd_lyclm20il4r5helnj
collect_by_url
,
discover_by_url
,
discover_by_url_all_reels
Comments
gd_ltppn085pokosxh13
collect_by_url
四个数据集:个人资料、帖子、Reels、评论。共有三条调用路径。根据用户拥有的信息和需求进行选择。SDK 相关命令已于 2026-09-11 基于
brightdata-sdk
2.5.2 验证;CLI 和 MCP 相关命令遵循
@brightdata/cli
0.4.1 和
@brightdata/mcp
4.1.0。
数据集dataset_id方法
个人资料
gd_l1vikfch901nx3by4
collect_by_url
,
discover_by_user_name
帖子
gd_lk5ns7kz21pck8jpis
collect_by_url
,
discover_by_url
(个人资料 URL:其最近的帖子)
Reels
gd_lyclm20il4r5helnj
collect_by_url
,
discover_by_url
,
discover_by_url_all_reels
评论
gd_ltppn085pokosxh13
collect_by_url

Pick your route

选择调用路径

You haveYou wantRoute
a profile URLthe account's recent postsCLI
bdata pipelines run gd_lk5ns7kz21pck8jpis discover_by_url <url> --num_of_posts N
or SDK
client.search.instagram.posts(url, num_of_posts=N)
.
collect_by_url
with a profile URL returns
It is not a post URL
a profile URLthe account's recent reelsCLI
bdata pipelines run gd_lyclm20il4r5helnj discover_by_url <url> --num_of_posts N
or SDK
client.search.instagram.reels(url, num_of_posts=N, timeout=420)
a profile URLthe profileCLI
bdata pipelines run gd_l1vikfch901nx3by4 collect_by_url <url>
or SDK
client.scrape.instagram.profiles(url)
a username, no URLthe profileCLI
bdata pipelines run gd_l1vikfch901nx3by4 discover_by_user_name --user_name nasa
or SDK
client.search.instagram.profiles("nasa")
a post URLthat postCLI
bdata pipelines run gd_lk5ns7kz21pck8jpis collect_by_url <url>
or SDK
client.scrape.instagram.posts(url)
a reel URLthat reelCLI
bdata pipelines run gd_lyclm20il4r5helnj collect_by_url <url>
or SDK
client.scrape.instagram.reels(url)
a post or reel URLits commentsCLI
bdata pipelines run gd_ltppn085pokosxh13 collect_by_url <url>
or SDK
client.scrape.instagram.comments(url)
. One credit per comment
no terminal (hosted assistant)any of the aboveMCP
run_scraper
with the dataset id and method above (see MCP below)
Every route is an asynchronous job on the API: trigger, poll, return. Expect one to three minutes per call. One credit per record; 5,000 credits are free each month. Always pass
num_of_posts
on a discovery call: without it the number of posts collected, and billed, has no limit.
你拥有你需要路径
个人资料 URL账号最近的帖子CLI
bdata pipelines run gd_lk5ns7kz21pck8jpis discover_by_url <url> --num_of_posts N
或 SDK
client.search.instagram.posts(url, num_of_posts=N)
。对个人资料 URL 使用
collect_by_url
会返回
It is not a post URL
个人资料 URL账号最近的 ReelsCLI
bdata pipelines run gd_lyclm20il4r5helnj discover_by_url <url> --num_of_posts N
或 SDK
client.search.instagram.reels(url, num_of_posts=N, timeout=420)
个人资料 URL个人资料CLI
bdata pipelines run gd_l1vikfch901nx3by4 collect_by_url <url>
或 SDK
client.scrape.instagram.profiles(url)
用户名,没有 URL个人资料CLI
bdata pipelines run gd_l1vikfch901nx3by4 discover_by_user_name --user_name nasa
或 SDK
client.search.instagram.profiles("nasa")
帖子 URL该帖子CLI
bdata pipelines run gd_lk5ns7kz21pck8jpis collect_by_url <url>
或 SDK
client.scrape.instagram.posts(url)
Reel URL该 ReelCLI
bdata pipelines run gd_lyclm20il4r5helnj collect_by_url <url>
或 SDK
client.scrape.instagram.reels(url)
帖子或 Reel URL其评论CLI
bdata pipelines run gd_ltppn085pokosxh13 collect_by_url <url>
或 SDK
client.scrape.instagram.comments(url)
。每条评论消耗 1 个积分
没有终端(托管助手)以上任意一项MCP
run_scraper
,配合顶部表格中的数据集 ID 和方法(参见下方 MCP 部分)
所有路径在 API 上都是异步任务:触发、轮询、返回。每次调用预计需要 1 至 3 分钟。每条记录消耗 1 个积分;每月免费提供 5,000 个积分。发现类调用务必传入
num_of_posts
:如果不传,采集和计费的帖子数量将不受限制。

Setup gate (run first)

身份验证前置检查(首先运行)

Run
node <agent-onboarding skill folder>/scripts/check-auth.mjs --for instagram
. Exit
0
means ready. Any other exit, a missing CLI, or a missing login is the
agent-onboarding
skill's job. These datasets need no zone, only the key.
For the SDK route:
pip install brightdata-sdk
. The SDK reads the token from
BRIGHTDATA_API_TOKEN
or
BRIGHTDATA_API_KEY
, then from a
.env
file found by searching upward from its own install folder, then from the CLI's stored login. After
bdata login
nothing else is needed.
运行
node <agent-onboarding skill folder>/scripts/check-auth.mjs --for instagram
。 退出码为
0
表示已就绪。任何其他退出码、CLI 缺失或未登录,都属于
agent-onboarding
skill 的处理范围。这些数据集不需要 zone,只需要 API key。
对于 SDK 路径:执行
pip install brightdata-sdk
。SDK 会先从
BRIGHTDATA_API_TOKEN
或
BRIGHTDATA_API_KEY
读取 token,然后从其自身安装目录向上搜索并找到的
.env
文件中读取,最后从 CLI 保存的登录信息中读取。执行
bdata login
后,无需再进行其他操作。

CLI: run a dataset by id

CLI:通过 ID 运行数据集

bash
bdata pipelines run gd_l1vikfch901nx3by4 collect_by_url "https://www.instagram.com/nasa/" --pretty
bdata pipelines run gd_lk5ns7kz21pck8jpis collect_by_url "https://www.instagram.com/p/Dc1W1uFj-CW/" --format csv -o posts.csv
bdata pipelines run gd_lyclm20il4r5helnj collect_by_url "https://www.instagram.com/reel/DcMXl1IPNtB/" --pretty
bdata pipelines run gd_ltppn085pokosxh13 collect_by_url "https://www.instagram.com/p/Dc1W1uFj-CW/" --pretty
bdata pipelines run gd_lk5ns7kz21pck8jpis discover_by_url "https://www.instagram.com/nasa/" --num_of_posts 5 --pretty
bdata pipelines info <dataset_id> <method>
lists a method's input fields; each one is a
--<field> <value>
flag.
--format json|csv|ndjson|jsonl
,
-o FILE
,
--timeout SECONDS
(default 600). Typical times: profile 50s, post 40s, reel 25s, comments 10s.
bash
bdata pipelines run gd_l1vikfch901nx3by4 collect_by_url "https://www.instagram.com/nasa/" --pretty
bdata pipelines run gd_lk5ns7kz21pck8jpis collect_by_url "https://www.instagram.com/p/Dc1W1uFj-CW/" --format csv -o posts.csv
bdata pipelines run gd_lyclm20il4r5helnj collect_by_url "https://www.instagram.com/reel/DcMXl1IPNtB/" --pretty
bdata pipelines run gd_ltppn085pokosxh13 collect_by_url "https://www.instagram.com/p/Dc1W1uFj-CW/" --pretty
bdata pipelines run gd_lk5ns7kz21pck8jpis discover_by_url "https://www.instagram.com/nasa/" --num_of_posts 5 --pretty
bdata pipelines info <dataset_id> <method>
会列出某个方法的输入字段;每个字段对应一个
--<field> <value>
标志。支持
--format json|csv|ndjson|jsonl
、
-o FILE
、
--timeout SECONDS
(默认 600)。典型耗时:个人资料 50 秒,帖子 40 秒,Reel 25 秒,评论 10 秒。

SDK: recent posts of an account

SDK:账号最近的帖子

python
from brightdata import SyncBrightDataClient

with SyncBrightDataClient(auto_create_zones=False) as client:
    result = client.search.instagram.posts("https://www.instagram.com/nasa/", num_of_posts=5)
    for post in result.data:
        print(post["likes"], post["num_comments"], post["url"])
Rules that are not in the SDK docstrings:
  • Always pass
    auto_create_zones=False
    .
    Left on, the client tries to create Web Unlocker and SERP zones on entry, which Instagram never uses and which fails with a 403 on accounts without a payment method (sdk-python#57).
  • Many URLs in one call is one job. Pass a list rather than looping.
  • Shapes:
    search.*
    calls always return a list in
    result.data
    .
    scrape.*
    calls with one URL return one record as a dict, several as a list.
  • Date window:
    start_date="08-01-2026", end_date="09-07-2026"
    , format
    MM-DD-YYYY
    .
    post_type="Post"
    keeps posts only,
    post_type="Reels"
    keeps reels only. The docstring's
    "Reel"
    returns an error row and no reels (sdk-python#59).
  • Reels discovery needs
    timeout=420
    .
    The 180-second default expires.
  • An empty window is a success with zero records: it arrives as a row whose
    error
    contains
    There are no public posts in the profile for the specified period
    . Match the message; a dead account uses the same
    error_code
    .
  • A dead account is a row with an
    error
    key
    and varying text, for example
    Sorry, this page isn't available.
    or
    Crawler error: Cannot read properties of null
    . The other rows in the same result are fine.
  • A timeout is
    result.success == False
    with
    result.status == "timeout"
    .
  • Collaborative posts carry the co-author's handle in
    user_posted
    , so a post fetched from
    nasa
    can say
    nasajohnson
    .
    coauthor_producers
    lists everyone.
  • reels_all(url)
    costs one credit per reel the account has ever posted.
    Check
    posts_count
    on the profile first. Comments cost one per comment; check
    num_comments
    on the post first.
  • Never hardcode a field list. The schema changes without notice. Read it with
    client.datasets.instagram_posts.get_metadata().fields
    , a dict keyed by field name. A post carries 34 to 36 of the 44 fields.
  • Big runs:
    posts_trigger
    ,
    posts_status
    ,
    posts_fetch
    . Keep the snapshot id; snapshots stay downloadable for 30 days.
The other seven SDK calls, each with a complete snippet, are in
references/sdk.md
.
python
from brightdata import SyncBrightDataClient

with SyncBrightDataClient(auto_create_zones=False) as client:
    result = client.search.instagram.posts("https://www.instagram.com/nasa/", num_of_posts=5)
    for post in result.data:
        print(post["likes"], post["num_comments"], post["url"])
SDK 文档字符串中未说明的规则:
  • 务必传入
    auto_create_zones=False
    。
    如果保持开启状态,客户端在初始化时会尝试创建 Web Unlocker 和 SERP zone,而 Instagram 从不使用这些资源;对于没有付款方式的账号,该操作会因 403 失败(sdk-python#57)。
  • 一次调用传入多个 URL 属于同一个任务。 应传入列表,而不是循环调用。
  • 返回结构:
    search.*
    调用始终在
    result.data
    中返回列表。
    scrape.*
    调用传入一个 URL 时,返回一条记录(dict);传入多个 URL 时,返回列表。
  • 日期范围:
    start_date="08-01-2026", end_date="09-07-2026"
    ,格式为
    MM-DD-YYYY
    。
    post_type="Post"
    仅保留帖子,
    post_type="Reels"
    仅保留 Reels。文档字符串中的
    "Reel"
    会返回错误行且没有 Reels(sdk-python#59)。
  • Reels 发现调用需要
    timeout=420
    。
    默认的 180 秒会超时。
  • 空时间范围是成功结果,零条记录: 它会表现为一行记录,其
    error
    包含
    There are no public posts in the profile for the specified period
    。应匹配该消息;失效账号使用相同的
    error_code
    。
  • 失效账号表现为带有
    error
    键的行,错误文本各不相同,例如
    Sorry, this page isn't available.
    或
    Crawler error: Cannot read properties of null
    。同一结果中的其他行仍然正常。
  • 超时表现为
    result.success == False
    且
    result.status == "timeout"
    。
  • 合作帖会在
    user_posted
    中携带共同作者的账号名,因此从
    nasa
    抓取的帖子可能显示为
    nasajohnson
    。
    coauthor_producers
    会列出所有共同作者。
  • reels_all(url)
    的费用为该账号历史上发布过的每条 Reel 1 个积分。
    先检查个人资料上的
    posts_count
    。评论每条消耗 1 个积分;先检查帖子上的
    num_comments
    。
  • 切勿硬编码字段列表。 Schema 可能在不通知的情况下发生变化。通过
    client.datasets.instagram_posts.get_metadata().fields
    读取,该字段为以字段名为键的 dict。一条帖子包含 44 个字段中的 34 至 36 个。
  • 大规模运行: 使用
    posts_trigger
    、
    posts_status
    、
    posts_fetch
    。保留快照 ID;快照在 30 天内可下载。
其他七个 SDK 调用的完整代码片段位于
references/sdk.md
。

MCP: no terminal

MCP:无需终端

The Bright Data MCP server reaches the same datasets through its scraper tools, which are on by default:
run_scraper
with a dataset id and method from the table at the top, and an input such as
[{"url": "https://www.instagram.com/nasa/"}]
.
discover_by_url
on the posts dataset gives an account's recent posts; pass
num_of_posts
in the input and
limit_per_input
.
search_scrapers
and
get_scraper_details
look the ids and fields up. The
brightdata-mcp
skill covers setup.
Bright Data MCP 服务器通过默认启用的抓取工具访问相同数据集:使用
run_scraper
,并传入顶部表格中的数据集 ID 和方法,输入示例为
[{"url": "https://www.instagram.com/nasa/"}]
。在帖子数据集上使用
discover_by_url
可获取账号最近的帖子;需在输入中传入
num_of_posts
和
limit_per_input
。可通过
search_scrapers
和
get_scraper_details
查找 ID 和字段。
brightdata-mcp
skill 涵盖安装配置。

Hand-offs

转交处理

  • Unsupported URL, or an Instagram page these datasets do not cover:
    scrape
    .
  • Need to find the profile or post URL first:
    search
    .
  • Other platforms:
    scrape
    .
  • 不支持的 URL,或这些数据集未覆盖的 Instagram 页面:使用
    scrape
    。
  • 需要先查找个人资料或帖子 URL:使用
    search
    。
  • 其他平台:使用
    scrape
    。

Docs

文档