> For the complete documentation index, see [llms.txt](https://developers.oxylabs.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.oxylabs.io/documentation/cn/kuai-su-kai-shi/kuai-su-kai-shi-wang-ye-pa-chong-api.md).

# 快速开始：网页爬虫API

{% hint style="success" %}
已经熟悉基础内容？查看 [网页爬虫API 文档](/products/cn/web-scraper-api.md) 或我们的便捷 [集成中心](/integrations/cn/wang-ye-pa-chong-api-ji-cheng.md).
{% endhint %}

Oxylabs [网页爬虫API](https://oxylabs.io/products/scraper-api/web) 是一个一体化解决方案，可自动处理代理轮换、JavaScript 渲染和反机器人系统。这个指南将带您在几分钟内从空白终端走到实时网页数据。

按照以下详细步骤操作，或观看一个简短的视频演示：

{% embed url="<https://www.youtube.com/watch?t=2s&v=WOD0mZnu-j0>" %}

{% stepper %}
{% step %}

### 设置与凭证

在发送您的第一个请求之前，您需要先授权访问：

1. **创建账号：** 在以下位置注册： [Oxylabs Dashboard](https://dashboard.oxylabs.io/).
2. **选择套餐：** 选择免费试用进行测试，或立即订阅。
3. **创建 API 用户：** 在左侧进入“网页爬虫API”部分，然后选择“用户”选项卡。
4. **保存您的凭证：** 所有请求都需要这些特定的 API 凭证（不是您的控制台登录信息）。
   {% endstep %}

{% step %}

### 您的第一个请求

该 `通用` source 适用于任何公开网站。打开您的终端并运行此命令来抓取我们的沙盒站点：

```bash
curl --user 'USERNAME:PASSWORD' \\
'https://realtime.oxylabs.io/v1/queries' \\
-H 'Content-Type: application/json' \\
-d '{
    "source": "universal",
    "url": "https://sandbox.oxylabs.io/products"
}'
```

{% endstep %}

{% step %}

### 获取结构化数据

如果您正在抓取受支持的域名（如 Amazon 或 Google），API 可以返回结构化 JSON，而不是原始 HTML。只需将 `source` 设置为特定目标，并使用 `"parse": true`。例如，让我们抓取一个 Amazon 商品：

```bash
curl 'https://realtime.oxylabs.io/v1/queries' \\
--user "USERNAME:PASSWORD" \\
-H "Content-Type: application/json" \\
-d '{
    "source": "amazon_product", 
    "query": "B07FZ8S74R", 
    "parse": true
}'
```

{% endstep %}
{% endstepper %}

### 关键参数

这些是用于自定义请求的最常见参数：

| 参数              | 类型  | 描述                                      |
| --------------- | --- | --------------------------------------- |
| `source`        | 字符串 | 必填。抓取引擎（例如 `通用`, `amazon`, `google`等）。  |
| `url` / `query` | 字符串 | 目标链接或专用目标的关键词/ID。                       |
| `parse`         | 布尔值 | 设置为 `true` 以便在受支持的域名上返回结构化 JSON 结果。     |
| `render`        | 字符串 | 设置为 `html` 以便为 JavaScript 密集型网站启用无头浏览器。 |
| `geo_location`  | 字符串 | 本地化您的结果（例如 `美国` 或 `90210`).             |

您可以在网页爬虫API 文档的 API Targets 部分找到更多可自定义参数。 [文档](/products/cn/web-scraper-api.md) 或 [API targets](/api-targets/cn/ren-yi-yu-ming.md) 部分。

### 常见响应代码

| 代码    | 状态     | 描述                       |
| ----- | ------ | ------------------------ |
| `200` | `OK`   | 成功。您的数据位于 `results` 对象中。 |
| `401` | `未授权`  | 请检查您在仪表板中的 API 用户凭证。     |
| `429` | `请求过多` | 您已超过并发限制。                |

您可以在 [完整响应代码列表](/products/cn/web-scraper-api/response-codes.md) 在网页爬虫API 产品部分中找到。

### 下一步

既然您已经发送了第一个查询，请根据需要继续浏览其余文档：

* **在寻找特定域名？** 前往 [API Targets](https://developers.oxylabs.io/api-targets/cn/) 部分，查看 Amazon、Google、eBay 以及更多热门网站的专门指南。
* **需要高级功能？** 访问 [Products](/products/cn/web-scraper-api.md) 空间，了解自定义解析、任务管家、云存储交付等更多内容。
* **使用 AI 扩展？** 查看 [适用于 AI 工作流的解决方案](/products/cn/web-scraper-api/solutions-for-ai-workflows.md) 或者了解 [OxyCopilot](/products/cn/web-scraper-api/web-scraper-api-playground/oxycopilot.md) 如何使用自然语言自动化您的解析逻辑。
* **其他集成？** 我们的示例使用同步 Realtime 集成。您可以在 Proxy Endpoint 或异步 Push-Pull 集成中找到 [集成方法](/integrations/cn/wang-ye-pa-chong-api-ji-cheng.md) 页面。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developers.oxylabs.io/documentation/cn/kuai-su-kai-shi/kuai-su-kai-shi-wang-ye-pa-chong-api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
