> 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/api-targets/cn/search-engines/google/shopping.md).

# 购物

了解如何通过两个步骤抓取 Google Shopping：从搜索生成令牌，然后提取详细产品信息。

Google Shopping 来源旨在通过 `google_shopping_search` 和 `google_shopping_product` 这些来源。数据提取是如下所示的两步流程。

### **步骤 1：生成令牌**

首先，你需要向 `google_shopping_search` [source](/api-targets/cn/search-engines/google/shopping/shopping-search.md)提交请求。这一步至关重要，因为它会生成 **产品令牌**，这在之后收集商品数据时是必需的。下面是用于 `google_shopping_search` 请求：

```json
{
  "source": "google_shopping_search",
  "query": "google_pixel",
  "render": "html",
  "parse": true
}
```

{% hint style="warning" %}
**重要：** 只有渲染后的解析任务才会返回商品令牌。
{% endhint %}

任务完成后，你会在响应中的 `organic` 部分：

```json
{
    "results": [
        {
            "content": {
                "url": "https://www.google.com/search?q=google_pixel&gl=us&hl=en&udm=28&sei=1uDkaLnMNPCNxc8P67XmqQg",
                "page": 1,
                "results": {
                    "paid": [],
                    "organic": [
                        {
                            "pos": 1,
                            "url": "https://www.google.com/shopping/product/547163035992318172?q=google_pixel&gl=us&hl=en&udm=28&sei=1uDkaLnMNPCNxc8P67XmqQg&gl=US",
                            "type": "grid",
                            "price": 899,
                            "title": "Google Pixel 9 Pro XL",
                            "token": "eyJjYXRhbG9naWQiOiAiNTQ3MTYzMDM1OTkyMzE4MTcyIiwgImdwY2lkIjogIjQ0MjYwMDg2MDY1MDIwNTc4NTkiLCAiaW1hZ2VEb2NpZCI6ICIxMjMwMTAyNDkzMzk0Mjg2MjY4IiwgIm1pZCI6ICI1NzY0NjI3ODc4NTM5Njc1NDAiLCAicHZvIjogIjIzIiwgInB2dCI6ICJoZyIsICJyZHMiOiAiUENfNDQyNjAwODYwNjUwMjA1Nzg1OXxQUk9EX1BDXzQ0MjYwMDg2MDY1MDIwNTc4NTkiLCAicXVlcnkiOiAiZ29vZ2xlX3BpeGVsIn0=",
```

解析结果中收集到的每个商品令牌都代表一个自然结果。

{% hint style="info" %}
**注意：** 没有生成的令牌，就无法检索商品或价格信息。
{% endhint %}

### **步骤 2：在商品请求中使用令牌**

要开始收集商品数据，请在向 `google_shopping_product` [source](/api-targets/cn/search-engines/google/shopping/shopping-product.md):

```json

{
  "source": "google_shopping_product",
  "query": "eyJjYXRhbG9naWQiOiAiNTQ3MTYzMDM1OTkyMzE4MTcyIiwgImdwY2lkIjogIjQ0MjYwMDg2MDY1MDIwNTc4NTkiLCAiaW1hZ2VEb2NpZCI6ICIxMjMwMTAyNDkzMzk0Mjg2MjY4IiwgIm1pZCI6ICI1NzY0NjI3ODc4NTM5Njc1NDAiLCAicHZvIjogIjIzIiwgInB2dCI6ICJoZyIsICJyZHMiOiAiUENfNDQyNjAwODYwNjUwMjA1Nzg1OXxQUk9EX1BDXzQ0MjYwMDg2MDY1MDIwNTc4NTkiLCAicXVlcnkiOiAiZ29vZ2xlX3BpeGVsIn0=",
  "parse": true
}
```

{% hint style="warning" %}
**重要：** 如果使用无效或生成不正确的令牌，任务将失败。
{% endhint %}

在为 `google_shopping_product` 和 `google_shopping_search` 来源使用本地化参数时，请确保使用相同的地区设置（如果未定义则为 none）。来源之间的区域不一致可能会导致数据不完整或不准确。


---

# 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/api-targets/cn/search-engines/google/shopping.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.
