> ## 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 支持在响应中检索多种数据类型

为了提高效率，我们的 API 支持通过 /scrape 端点在单个响应中请求多种格式。

<Tip>
  此功能仅适用于 /scrape 端点，同时支持实时和异步两种集成类型。
</Tip>

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

下表列出了可用的响应格式，具体取决于您在 API 请求中包含的参数。请注意，并非所有目标都支持每个参数，因此输出结果可能有所不同。

| Parse | XHR | Markdown | Headless | 实时输出 | 可用输出 |
| - | - | - | - | - | - |
| `true` | \* | - | \* 或 `html` | parsed | html, parsed |
| `true` | - | \* | `png` | parsed | html, parsed, png |
| `true` | `true` | - | `html` | parsed | html, parsed, xhr |
| `true` | \* | `true` | - 或 `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 |
| \* | - | \* | - 或 `html` | html | html |

## 如何指定多种格式

只需两步：

1. 在请求负载中包含所需的输出类型
2. 在 API URL 中通过 `?type` 参数指定这些类型

<CodeGroup>
  ```shellscript cURL theme={null}
  # 将 TOKEN VALUE 替换为您的 API 密钥
  curl --request 'POST' \
          --url 'https://data.decodo.com/v1/scrape?type=markdown,xhr' \
          --header 'Accept: application/json' \
          --header 'Authorization: Bearer TOKEN VALUE' \
          --header 'Content-Type: application/json' \
          --data '
      {
        "url": "https://example.com",
        "markdown":true,
        "xhr": true
      }
  '
  ```
</CodeGroup>

**实时端点：** `https://data.decodo.com/v1/scrape?type=`

**异步端点：** `https://data.decodo.com/v1/task?type=`

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

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

`https://data.decodo.com/v1/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>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.