fetch
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseBright Data - Fetch
Bright Data - Fetch
One URL in, one page out, as markdown, HTML, or a screenshot. Nothing is parsed for you.
Every request is unblocked: IP rotation, browser fingerprints, cookies, CAPTCHA solving and automatic retries, from a country you choose. JavaScript rendering can be forced with the REST body's parameter. The CLI has no flag for it, so a CLI fetch cannot force rendering (a is still an image of the rendered page).
render-f screenshot输入一个 URL,输出一个页面,可采用 markdown、HTML 或截图格式。不会代你解析任何内容。
每次请求都会解除封锁,包括 IP 轮换、浏览器指纹、Cookie、CAPTCHA 识别以及自动重试,并可选择来源国家。可以通过 REST 请求正文中的 参数强制启用 JavaScript 渲染。CLI 没有对应的参数,因此 CLI fetch 无法强制执行渲染(使用 时,得到的仍是已渲染页面的图像)。
render-f screenshotThe call
调用方式
CLI. The command is , which runs Web Unlocker.
bdata scrapebdata scrape https://example.com/articleMarkdown is the default. A first tries to create and, when no default is set, stores it as the zone default, so a fresh login on a normal account needs no . It never overwrites a default you already set. A key from agent registration cannot create zones and its account has no , so run once. An account set up any other way carries its unlocker zone under another name ( from agent registration, from the MCP server, any name at all when a person made it by hand): find it by the entry whose is in , and pass that name. Override with , or , or .
bdata logincli_unlocker--zonecli_unlockerbdata config set default_zone_unlocker agent_unlockeragent_unlockermcp_unlocker"type""unblocker"bdata zones --json--zone <name>BRIGHTDATA_UNLOCKER_ZONEbdata config set default_zone_unlocker <name>If is not recognized, the CLI is not installed or npm's global directory is not on PATH; both fixes live in the skill's Install section.
bdataagent-onboardingREST. The same request, for any machine with no CLI.
POST https://api.brightdata.com/request
Authorization: Bearer $BRIGHTDATA_API_KEY
Content-Type: application/json
{"zone":"cli_unlocker","url":"https://example.com/article",
"format":"raw","data_format":"markdown"}cli_unlockerbdata loginunblockerformatdata_format"format":"raw""format":"json"For code the user keeps, the SDK wraps this same call in one line: . The skill owns that surface. The skill's covers the same one-POST shape and the KYC error codes. The full parameter list, including , and , is in Bright Data's Web Unlocker API docs.
const html = await client.scrapeUrl('https://example.com/article')brightdata-sdkscrapereferences/web-unlocker.mdrendercountrymethodCLI. 命令为 ,它会运行 Web Unlocker。
bdata scrapebdata scrape https://example.com/article默认格式为 Markdown。首次执行 时会尝试创建 ;如果尚未设置默认值,就将其保存为 zone 默认值,因此在普通账户上首次登录后无需指定 。它绝不会覆盖你已设置的默认值。通过 agent 注册获得的 key 无法创建 zone,且其账户中不存在 ,因此需要执行一次 。以其他方式设置的账户,其 unlocker zone 会使用其他名称(agent 注册生成的 、MCP server 生成的 ,或手动创建时的任意名称):在 中查找 为 的条目,并传入该名称。可以使用 、 或 覆盖该值。
bdata logincli_unlocker--zonecli_unlockerbdata config set default_zone_unlocker agent_unlockeragent_unlockermcp_unlockerbdata zones --json"type""unblocker"--zone <name>BRIGHTDATA_UNLOCKER_ZONEbdata config set default_zone_unlocker <name>如果系统无法识别 ,说明 CLI 未安装,或 npm 的全局目录不在 PATH 中;这两种情况的修复方法都位于 skill 的 Install 部分。
bdataagent-onboardingREST. 相同的请求,适用于任何未安装 CLI 的机器。
POST https://api.brightdata.com/request
Authorization: Bearer $BRIGHTDATA_API_KEY
Content-Type: application/json
{"zone":"cli_unlocker","url":"https://example.com/article",
"format":"raw","data_format":"markdown"}cli_unlockerbdata loginunblockerformatdata_format"format":"raw""format":"json"对于用户需要保留的代码,SDK 用一行封装了同一次调用:。 skill 负责这一接口。 skill 的 介绍了相同的单次 POST 请求格式以及 KYC 错误码。包括 、 和 在内的完整参数列表,请参阅 Bright Data 的 Web Unlocker API 文档。
const html = await client.scrapeUrl('https://example.com/article')brightdata-sdkscrapereferences/web-unlocker.mdrendercountrymethodFormats
格式
| Want | CLI | REST body | Note |
|---|---|---|---|
| Markdown (default) | | | For a model, an index, or a human |
| Raw HTML | | | When the user's own code parses it |
| Screenshot | | | Binary PNG. The CLI writes |
| Response metadata | | | Status and headers around the body |
One honest note on the markdown: links come back exactly as the page wrote them, so a relative link like stays relative and points nowhere once the text leaves the site. That is fine when the output feeds a model, an index or a RAG store. For a standalone document a person will read and click, resolve the links against the page URL first, and say that you did.
/pricingThe other flags that exist: , , , , , , and , which has no effect in the current CLI release.
--country <code>--async-o <path>--json--pretty--timing--mobile| 需求 | CLI | REST 请求正文 | 说明 |
|---|---|---|---|
| Markdown(默认) | | | 适用于模型、索引或人类阅读 |
| 原始 HTML | | | 当用户自己的代码需要解析它时使用 |
| 截图 | | | 二进制 PNG。除非通过 |
| 响应元数据 | | | 在正文外附加状态码和响应头 |
关于 markdown 有一点需要如实说明:链接会完全按页面原始写法返回,因此像 这样的相对链接仍保持相对形式,文本离开站点后将无法指向任何位置。当输出用于馈送模型、索引或 RAG 存储时,这样没有问题。如果输出是供人阅读并点击的独立文档,应先根据页面 URL 将这些链接解析为绝对地址,并说明你已执行此操作。
/pricing其他可用的参数包括:、、、、、 和 ,其中 在当前的 CLI 版本中不起作用。
--country <code>--async-o <path>--json--pretty--timing--mobile--mobileExample - one blocked article
示例 - 抓取一篇被阻止的文章
The ask: "my script gets a 403 on this URL, I just need the article text"
- One URL, and the page itself is the answer. Stay in this skill.
- The 403 is the reason to be here, not a problem to route around. Unblocking is the product.
- Text for a human or a model, so markdown, which is already the default.
bdata scrape https://www.example-news.com/2026/08/some-articleThen state the choice in one line the user can override with one word:
Fetched the page with Web Unlocker as markdown. Sayif you want the data fields pulled out instead, and I will use a maintained scraper.fields
需求:“我的脚本访问这个 URL 时收到 403,我只需要文章文本”
- 只有一个 URL,而且页面本身就是答案。请继续使用本 skill。
- 出现 403 正是使用此功能的原因,而不是需要另行绕开的问题。解除封锁正是本产品的核心能力。
- 需要获取供人或模型阅读的文本,因此选择 markdown,它已经是默认格式。
bdata scrape https://www.example-news.com/2026/08/some-article然后用一句话说明选择,用户只需说出一个词即可更改:
已使用 Web Unlocker 以 markdown 格式获取页面。如果你想改为提取数据字段,请说,届时我会使用维护中的 scraper。fields
When a fetch is refused
fetch 被拒绝时
Read the error first. A 403 from the target site is not on this list, because that is the ordinary case this skill exists to solve.
| The message contains | What it means |
|---|---|
| No zone resolved. Take the name of the |
| The resolved zone does not exist on this account, often |
Two other refusals are not this skill's to fix. A missing or dead key (, or 401) means the machine is not logged in. A few targets need KYC on the account before Bright Data will serve them: sites that block themselves in robots.txt such as Reddit, government sites, sites on Bright Data's blocked list, and targets its compliance policy does not permit. Most sites need none of this. Both belong to the skill, which carries the exact error codes. Send the user there, and never send anyone to KYC before a call has actually been refused.
No API key foundagent-onboarding先查看错误信息。目标站点返回的 403 不属于下表所列的拒绝情况,因为这正是本 skill 要解决的常见场景。
| 错误消息包含 | 含义 |
|---|---|
| 未解析出 zone。从 |
| 解析出的 zone 在当前账户中不存在;这常见于由 agent 注册创建的账户仍使用 |
另外两种拒绝情况不由本 skill 处理。key 缺失或失效( 或 401)表示机器尚未登录。某些目标站点需要先在账户上完成 KYC,Bright Data 才会提供抓取服务,例如在 robots.txt 中屏蔽自身的站点(如 Reddit)、政府网站、Bright Data 封禁列表中的站点,以及其合规政策不允许的目标站点。大多数站点都不需要上述处理。这两类问题均应交由 skill 处理,该 skill 包含具体的错误码。应将用户引导至该 skill;在调用真正被拒绝之前,绝不要引导用户去完成 KYC。
No API key foundagent-onboardingHandoff boundaries
任务转交边界
| The ask | Skill |
|---|---|
| Data fields, or many pages of one site | |
| The same site fetched twice with a parser in between | |
| A query with no URL | |
| Their own browser code, pointed at an unblocked browser | |
A fetch whose real purpose is pulling data fields out of the page is a scrape ask. Hand it over.
Never promise JavaScript rendering on a CLI markdown or HTML fetch; when a page needs it, use the REST call with . Never reach for a browser or a proxy because a page returned 403. That is what this one call already handles.
"render":"true"| 需求 | Skill |
|---|---|
| 提取数据字段,或抓取同一站点的多个页面 | |
| 对同一站点执行两次 fetch,中间使用解析器 | |
| 不含 URL 的查询 | |
| 用户自己的浏览器代码,指向一个已解除封锁的浏览器 | |
如果执行 fetch 的真正目的是从页面中提取数据字段,那么这属于 scrape 请求,应转交相应 skill。
绝不要承诺 CLI 的 markdown 或 HTML fetch 能够执行 JavaScript 渲染;页面需要渲染时,使用带有 的 REST 调用。不要因为页面返回 403 就转而使用 browser 或 proxy,因为这一次调用已经能够处理这种情况。
"render":"true"