> 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/kai-shi-shi-yong/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 仪表板](https://dashboard.oxylabs.io/).
2. **选择套餐：** 选择免费试用进行测试，或直接订阅。
3. **创建 API 用户：** 转到左侧的“网页爬虫API”部分，然后选择“用户”标签页。
4. **保存你的凭据：** 所有请求都需要这些特定的 API 凭据（不是你的仪表板登录信息）。
   {% endstep %}

{% step %}

### 你的第一个请求

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

```bash
curl 'https://realtime.oxylabs.io/v1/queries' \
--user 'USERNAME:PASSWORD' \
-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 [文档](/products/cn/web-scraper-api.md) 或 [API 目标](/api-targets/cn/ren-he-yu-ming.md) 部分中找到更多可自定义参数。

### 常见响应码

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

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

### 下一步

既然你已经发送了第一个查询，请根据你的需求继续查看其余文档：

* **在寻找特定域名？** 前往 [API 目标](https://developers.oxylabs.io/api-targets/cn/) 部分，查看关于 Amazon、Google、eBay 以及更多热门网站的专用指南。
* **需要高级功能？** 访问 [产品](/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/kai-shi-shi-yong/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.
