> ## Documentation Index
> Fetch the complete documentation index at: https://docs.brightdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Fetch API

> 使用 Bright Data Fetch API 爬虫将任意公开 URL 转换为一条记录，同时包含 Markdown、纯文本、原始 HTML 和 JSON-LD。同步请求建议每次不超过 20 个 URL。

发送任意公开 URL，即可在一条记录中获得该网页的 Markdown、纯文本、原始 HTML 和 JSON-LD。Fetch API（原 Crawl API）是 [Web Unlocker API](/cn/products/web-unlocker/introduction) 在 Scraper API 中的对应产品：Bright Data 处理代理、CAPTCHA 和封锁，Fetch API 返回可直接用于 LLM 或解析器的网页内容。

<Tip>
  初次使用 Bright Data？[创建免费账户](https://www.bright.cn/?hs_signup=1\&utm_source=docs)，即可**每月获得 5,000 个免费积分**，无需信用卡。请参阅[免费套餐](/cn/general/account/billing-and-pricing/free-tier)。
</Tip>

## 工作原理

你向 Bright Data Fetch API 发送一个或多个 URL。Bright Data 获取每个网页，并为每个 URL 返回一条记录，其中包含所有输出格式。

```text theme={null}
Your app  -->  Bright Data API  -->  Markdown, text, HTML and JSON-LD
           POST /datasets/v3/scrape
           Authorization: Bearer YOUR_API_KEY
```

每个请求都使用 Fetch API 的 `dataset_id` `gd_m6gjtfmeh43we6cqc`，并以 NDJSON（默认）、JSON、JSON lines、CSV 和 Parquet 格式返回结果。见[输出格式](/cn/products/scrapers/scrapers-library/data-delivery#支持哪些输出格式)。

## 响应内容示例

Bright Data Fetch API 于 2026 年 10 月 19 日为 `https://example.com` 返回的单条记录。可在[快速开始](/cn/products/scrapers/fetch-api/quickstart)中亲自发送该请求。

```json theme={null}
{
  "markdown": "This domain is for use in documentation examples without needing permission. This is not a service; avoid relying on it for testing and monitoring purposes.",
  "url": "https://example.com/",
  "final_url": "https://example.com/",
  "html2text": "This domain is for use in documentation examples without needing permission. This is not a service; avoid relying on it for\ntesting and monitoring purposes.",
  "page_html": "<!doctype html><html lang=en><head><meta charset=utf-8>...<title>Example Domain</title>...</head><body><p>This domain is for use in documentation examples without needing permission. ...</p></body></html>\n",
  "page_title": "Example Domain",
  "country": null,
  "timestamp": "2026-10-19T18:10:21.213Z",
  "input": {
    "url": "https://example.com"
  }
}
```

此处的 `page_html` 值已截断。示例网页没有 JSON-LD，因此记录中没有 `ld_json` 字段。

## Fetch API 返回哪些格式？

<CardGroup cols={2}>
  <Card title="Markdown" icon="markdown" href="/cn/api-reference/scrapers/web-content-apis/fetch-api-collect-by-url#输出字段">
    `markdown` 保留标题、列表和链接，可直接用于 LLM 提示词或 RAG 索引。
  </Card>

  <Card title="纯文本" icon="align-left" href="/cn/api-reference/scrapers/web-content-apis/fetch-api-collect-by-url#输出字段">
    `html2text` 去除所有 HTML 标签，只保留可见文本。
  </Card>

  <Card title="原始 HTML" icon="code" href="/cn/api-reference/scrapers/web-content-apis/fetch-api-collect-by-url#输出字段">
    `page_html` 是完整的 HTML 源代码，包括标签、脚本和样式。
  </Card>

  <Card title="JSON-LD" icon="brackets-curly" href="/cn/api-reference/scrapers/web-content-apis/fetch-api-collect-by-url#输出字段">
    `ld_json` 包含网页的 schema.org 结构化元数据（如网页提供）。
  </Card>
</CardGroup>

每条记录还包含 `url`、`final_url`（重定向后的 URL）、`page_title` 和 `country`。

## 使用哪个数据集 ID

Fetch API 只有一个端点：按 URL 采集。每个请求都需要将该 ID 作为查询参数传入。

| 端点 | 数据集 ID |
| :- | :- |
| 按 URL 采集 | `gd_m6gjtfmeh43we6cqc` |

## 请求方式

Bright Data Scraper API 支持两种请求方式，请根据您的数据量和延迟需求选择。

| 方式 | 端点 | 适用场景 |
| :- | :- | :- |
| **同步** | `/scrape` | 实时查询，最多 20 个 URL |
| **异步** | [`/trigger`](/cn/products/scrapers/scrapers-library/async-requests) | 批量任务、20 个及以上 URL、生产环境管道 |

详见[了解同步与异步请求](/cn/concepts/sync-vs-async)。

两个端点都接受带 `input` 数组的对象，可附加 `limit_per_input` 和 `custom_output_fields`，在 `/trigger` 上还可附加 `deliver` 配置。也接受由输入组成的纯 JSON 数组，本页示例使用此格式。详见[请求体](/cn/api-reference/scrapers/synchronous-requests#请求体)。

## 功能与限制

| 功能 | 详情 |
| :- | :- |
| **输出格式** | NDJSON（默认）、JSON、JSON lines、CSV 和 Parquet（[各格式适用范围](/cn/products/scrapers/scrapers-library/data-delivery#支持哪些输出格式)） |
| **同步请求最大 URL 数** | 20 |
| **异步请求最大 URL 数** | 无限制，每个任务最多 1 GB 输入 |
| **数据新鲜度** | 实时（按需抓取） |
| **投递方式** | API 下载、[webhook](/cn/products/scrapers/scrapers-library/data-delivery)、[Amazon S3](/cn/products/scrapers/scrapers-library/data-delivery)、Snowflake、Azure、GCS（[全部目标](/cn/products/scrapers/scrapers-library/data-delivery)） |
| **计费** | 按成功记录计费（[查看价格](https://www.bright.cn/pricing/web-scraper)） |

## 常见问题

### Fetch API 与 Web Unlocker API 有什么区别？

两者都能解锁任意公开网页，区别在于调用方式和返回内容：

* **Web Unlocker API** 通过 `/request` 和 Web Unlocker 区域调用，返回目标网页的原始响应，可以原样返回或封装在 JSON 中。
* **Fetch API** 通过 `/datasets/v3/scrape` 或 `/datasets/v3/trigger` 和 `dataset_id` 调用，无需区域。每个 URL 返回一条记录，同时包含 Markdown、纯文本、原始 HTML 和 JSON-LD，并支持 Scraper API 的批量任务和[交付选项](/cn/products/scrapers/scrapers-library/data-delivery)。

### 网页是实时获取的吗？

是的。每个请求都会获取实时网页，不使用缓存副本。同步请求最多等待 1 分钟，之后返回 HTTP `202` 和 `snapshot_id`，并以异步方式继续。处理时间取决于目标网站的情况，因此 Bright Data Fetch API 不公布固定的响应时间。

### Fetch API 适用于哪些网站？

Fetch API 接受任意域名下的任意公开 URL。它不像 Instagram 或 Amazon 爬虫那样绑定某个平台，也不会解析价格、粉丝数等特定网站的字段。如果需要将这些字段作为结构化 JSON 获取，请使用[平台爬虫](/cn/products/scrapers/overview)。

## 后续步骤

<CardGroup cols={3}>
  <Card title="快速开始" icon="rocket" href="/cn/products/scrapers/fetch-api/quickstart">
    5 分钟内以 Markdown 获取第一个网页。
  </Card>

  <Card title="端点" icon="bolt" href="/cn/products/scrapers/fetch-api/send-first-request">
    国家定位、字段选择和批量请求。
  </Card>

  <Card title="API 参考" icon="code" href="/cn/api-reference/scrapers/web-content-apis/fetch-api-collect-by-url">
    端点规范、参数和响应结构。
  </Card>
</CardGroup>
