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

# 请求多种响应格式

> 网页抓取 API 支持在响应中检索多种数据类型

<Danger>
  核心版和高级版套餐已停止销售。请考虑迁移到一体化网络爬虫 API；[请点击此处查看指南](https://help.decodo.com/docs/cn/web-scraping-api-migration-guide).
</Danger>

为了提高效率,我们的 API 提供了在单个响应中请求多种格式的功能。

<Note>
  * 此功能适用于 **Web API Advanced 计划**。
  * 仅支持异步集成类型。
</Note>

## 支持的格式

| 类型         | 描述                                                                                              |
| ---------- | ----------------------------------------------------------------------------------------------- |
| `raw`      | URL 的原始响应正文,通常但不限于 HTML 文档                                                                      |
| `parsed`   | 解析的页面内容,以 JSON 格式提供                                                                             |
| `markdown` | [Markdown](https://help.decodo.com/docs/cn/web-scraping-api-markdown-response-deprecated) 响应    |
| `xhr`      | 页面渲染期间捕获的 [XHR](https://help.decodo.com/docs/cn/web-scraping-api-fetch-and-xhr-deprecated) 请求   |
| `png`      | 网页的 PNG 格式[截图](https://help.decodo.com/docs/cn/web-scraping-api-screenshot-response-deprecated) |

下表显示了可用的响应格式,这些格式由 API 请求中包含的参数决定。请记住,并非所有目标都支持每个参数;因此,输出结果可能会有所不同。

| Parse  | XHR    | Markdown | Headless     | 实时输出     | 可用输出                        |
| ------ | ------ | -------- | ------------ | -------- | --------------------------- |
| `true` | -      | -        | \* OR `html` | parsed   | html, parsed                |
| `true` | -      | -        | `png`        | parsed   | html, parsed, png           |
| `true` | `true` | -        | `html`       | parsed   | html, parsed, xhr           |
| `true` | -      | `true`   | - OR `html`  | parsed   | html, parsed, markdown      |
| `true` | `true` | `true`   | `html`       | parsed   | html, parsed, xhr, markdown |
| -      | `true` | -        | `html`       | xhr      | html, xhr                   |
| -      | `true` | `true`   | `html`       | markdown | html, xhr, markdown         |
| -      | -      | `true`   | `png`        | markdown | html, markdown, png         |
| -      | -      | -        | `png`        | png      | html, png                   |
| -      | -      | -        | - OR `html`  | html     | html                        |

## 使用 task\_id 通过 Results 端点获取多格式响应

要接收多格式响应,请在结果请求 URL 中添加 `?type=` 参数并指定所需的响应类型,例如:

`https://scraper-api.decodo.com/v3/task/{task_id}/results?type=raw,xhr`

***

<Columns cols={2}>
  <Card title="支持" href="https://direct.lc.chat/12092754" cta="让我们聊聊！">
    需要帮助或只是想打个招呼？我们的支持团队全天候为您服务。 \
    您也可以随时通过电子邮件 [support@decodo.com](mailto:support@decodo.com) 联系我们。
  </Card>

  <Card title="反馈" href="mailto:feedback@decodo.com" cta="分享反馈">
    找不到您要找的内容？请求一篇文章！ \
    有反馈意见？分享您对我们如何改进的想法。
  </Card>
</Columns>
