> 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/products/cn/web-scraper-api.md).

# 网页爬虫API（经典版）

了解如何使用网页爬虫API并抓取所需的任何公开网站。查找代码示例、参数用法、本地化、目标等更多内容。

[**网页爬虫API**](https://oxylabs.io/products/scraper-api/web) 是一个 **一体化网页数据采集解决方案** 旨在从任何公开网站大规模提取实时数据。它涵盖网页抓取的每个阶段，从爬取 URL、提高访问成功率到数据解析并交付到您首选的存储，因此您无需管理代理、请求管理或基础设施。

该工具旨在满足企业安全标准，包括 SOC 2 Type II 合规性，并提供可快速适应的基础设施，可动态调整以适配目标网站，确保在搜索引擎、电商网站、旅游平台等场景中保持高成功率和可靠的数据提取。

## 开始使用

**创建您的 API 用户凭据**: 联系 [我们的团队](mailto:hello@oxylabs.io) 以申请您的 API 用户凭据（`USERNAME` 和 `PASSWORD`).

### 请求示例

该 API 会作为其集成基础设施的一部分自动管理代理轮换、请求重试并处理机器人监测系统，因此一次请求就足以检索所有结构化数据。

下面你会找到示例 cURL 请求。其他编程语言的示例，请参阅相关章节： [**Amazon**](https://developers.oxylabs.io/api-targets/cn/e-commerce/amazon), [**Google**](https://developers.oxylabs.io/api-targets/cn/search-engines/google), [**其他网站**](https://developers.oxylabs.io/api-targets/cn/).

{% tabs %}
{% tab title="Amazon" %}

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

{% endtab %}

{% tab title="Google" %}

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

{% endtab %}

{% tab title="其他" %}

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

{% endtab %}
{% endtabs %}

我们在示例中使用同步 [**Realtime**](/products/cn/web-scraper-api/integration-methods/realtime.md) 集成方法。如果您想使用 [**Proxy Endpoint**](/products/cn/web-scraper-api/integration-methods/proxy-endpoint.md) 或异步 [**Push-Pull**](/products/cn/web-scraper-api/integration-methods/push-pull.md) 集成，请参阅 [**集成方法**](/products/cn/web-scraper-api/integration-methods.md) 部分。

{% file src="/files/8365b1362a7a5614a3b24348eef8a863a5a2f564" %}

{% file src="/files/b0ad6ed9e7d782f0549a12e6f6ad11e8af390529" %}

### 请求参数值

1. <mark style="background-color:green;">**`source`**</mark> - 此参数用于设置将用于处理您请求的抓取器。
2. <mark style="background-color:green;">**`URL`**</mark> 或 <mark style="background-color:green;">**`query`**</mark> - 提供 `URL` 或 `query` 用于您要抓取的页面类型。有关何时使用每个参数的详细说明，请参阅下表及对应的目标子页面。
3. 此外，您还可以包含其他参数，例如 `geo_location`, `user_agent_type`, `parse` （在此查找我们的解析器列表 [**这里**](/products/cn/web-scraper-api/features/result-processing-and-storage/dedicated-parsers.md)), `render` 以及更多内容，以自定义您的抓取请求。了解更多： [**功能**](/products/cn/web-scraper-api/features.md).

\- 必填参数

### 使用 URL 或参数化输入进行抓取

Oxylabs 支持两类通用输入——URL 和参数化输入，如查询、商品或视频 ID。 [通用目标](https://developers.oxylabs.io/api-targets/cn/) 没有专用 source 的可使用 `通用` source。

所有带有专用 source 的可用目标都可以在此找到 [**这里**](/products/cn/web-scraper-api/mu-biao.md).

{% hint style="info" %}
如果您在发起首次请求或优化配置时需要帮助，我们的 24/7 专家支持团队可通过在线聊天提供服务。
{% endhint %}

## 通过 Web Scraper API Playground 进行测试

尝试 [**网页爬虫API**](https://oxylabs.io/products/scraper-api/web) 和 [**OxyCopilot**](https://oxylabs.io/products/scraper-api/ai-web-scraper-copilot) 在 [**Web Scraper API Playground**](https://dashboard.oxylabs.io/?route=/api-playground).

{% embed url="<https://www.youtube.com/watch?v=kDhknxrod6U>" %}

{% embed url="<https://youtu.be/9JoF8_5r5HY?si=61c3Zkx6FrH06PVa>" %}

## 通过 Postman 进行测试

使用 Postman 开始使用我们的 API，Postman 是一个用于发送 HTTP 请求的实用工具。下载我们的 [**网页爬虫API Postman 集合**](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzrXw45naRpCZ0Ku9AjY1%2Fuploads%2FMeGA0TZQMcAFHoVhRSQi%2FWeb%20Scraper%20API.new_postman_collection.json?alt=media\&token=9f51d41b-6604-4eef-b6c1-5024cf52c5bf) 并导入它。此集合包含用于演示爬虫功能的示例。可根据需要自定义这些示例，或立即开始抓取。

有关分步说明，请观看下面的视频教程。如果您是 Postman 新手，请查看这段简短的 [**指南**](/integrations/cn/web-scraper-api-integrations/postman.md).

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

{% hint style="info" %}
*此处提供的所有信息均按“原样”提供，仅供参考。我们不对您使用本页所含任何信息作出任何陈述，并就此不承担任何责任。在进行任何形式的抓取活动之前，您应咨询法律顾问，并仔细阅读相关网站的服务条款或获取抓取许可。*
{% endhint %}


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developers.oxylabs.io/products/cn/web-scraper-api.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
