> 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 请求。其他编程语言的示例，请参阅相关部分： [**亚马逊**](https://developers.oxylabs.io/api-targets/cn/e-commerce/amazon), [**谷歌**](https://developers.oxylabs.io/api-targets/cn/search-engines/google), [**其他网站**](https://developers.oxylabs.io/api-targets/cn/).

{% tabs %}
{% tab title="亚马逊" %}

```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="谷歌" %}

```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**](https://developers.oxylabs.io/products/cn/web-scraper-api/integration-methods/realtime.md) 集成方法。在我们的示例中。如果您想使用 [**Proxy Endpoint**](https://developers.oxylabs.io/products/cn/web-scraper-api/integration-methods/proxy-endpoint.md) 或异步 [**Push-Pull**](https://developers.oxylabs.io/products/cn/web-scraper-api/integration-methods/push-pull.md) 集成，请参阅 [**集成方法**](https://developers.oxylabs.io/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` （查看我们的解析器列表 [**这里**](https://developers.oxylabs.io/products/cn/web-scraper-api/features/result-processing-and-storage/dedicated-parsers.md)), `render` 以及更多内容，以自定义您的抓取请求。了解更多： [**功能**](https://developers.oxylabs.io/products/cn/web-scraper-api/features.md).

\- 必填参数

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

Oxylabs 支持两类通用输入：URL 和参数化输入，例如查询、产品或视频 ID。 [通用目标](https://developers.oxylabs.io/api-targets/cn/) 这些没有专用源的内容可以使用 `通用` 数据源。

所有带有专用源的可用目标可在此找到 [**这里**](https://developers.oxylabs.io/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 新手，请查看这个简短的 [**指南**](https://developers.oxylabs.io/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.
