> 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/mu-biao/sou-suo-yin-qing/gu-ge/gou-wu/gou-wu-shang-pin.md).

# 购物商品

使用 网页爬虫API 获取详细的 Google Shopping 商品数据，包括价格、评论、规格和变体。

该 `google_shopping_product` source 使用一个从 Google Shopping 检索详细商品信息（标题、描述、价格、卖家、相关商品、评论等）的 **产品令牌** 获取自 `google_shopping_search` 或 `google_search`.

## **请求示例**

在下面的代码示例中，我们使用有效令牌发起请求，以检索 Google Shopping 商品的商品页。

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

```shell
curl 'https://data.oxylabs.io/v1/queries' \
--user 'USERNAME:PASSWORD' \
-H 'Content-Type: application/json' \
-d '{
       "source": "google_shopping_product",
       "query": "<product_token_string>",
       "render": "html",
       "parse": true
    }'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
from pprint import pprint


# Structure payload.
payload = {
    "source": "google_shopping_product",
    "query": "[product_token_string]",
    "render": "html",
    "parse": True
}

# Get response.
response = requests.request(
    'POST',
    'https://data.oxylabs.io/v1/queries',
    auth=('USERNAME', 'PASSWORD'),
    json=payload,
)

# 将格式化后的响应打印到标准输出。
pprint(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require("https");

const username = "USERNAME";
const password = "PASSWORD";
const body = {
    source: "google_shopping_product",
    query: "[product_token_string]",
    render: "html",
    parse: true
};

const options = {
    hostname: "data.oxylabs.io",
    path: "/v1/queries",
    method: "POST",
    headers: {
        "Content-Type": "application/json",
        Authorization:
            "Basic " + Buffer.from(`${username}:${password}`).toString("base64"),
    },
};

const request = https.request(options, (response) => {
    let data = "";

    response.on("data", (chunk) => {
        data += chunk;
    });

    response.on("end", () => {
        const responseData = JSON.parse(data);
        console.log(JSON.stringify(responseData, null, 2));
    });
});

request.on("error", (error) => {
    console.error("Error:", error);
});

request.write(JSON.stringify(body));
request.end();
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$params = array(
    'source' => 'google_shopping_product',
    'query' => '[product_token_string]',
    'render' => 'html',
    'parse' => true
);

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://data.oxylabs.io/v1/queries");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_USERPWD, "USERNAME" . ":" . "PASSWORD");

$headers = array();
$headers[] = "Content-Type: application/json";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
echo $result;

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
}
curl_close($ch);
```

{% endtab %}

{% tab title="Golang" %}

```go
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "io/ioutil"
    "net/http"
)

func main() {
    const Username = "USERNAME"
    const Password = "PASSWORD"

    payload := map[string]interface{}{
        "source": "google_shopping_product",
        "query": "[product_token_string]",
        "render": "html",
        "parse": true,
    }

    jsonValue, _ := json.Marshal(payload)

    client := &http.Client{}
    request, _ := http.NewRequest("POST",
        "https://data.oxylabs.io/v1/queries",
        bytes.NewBuffer(jsonValue),
    )

    request.SetBasicAuth(Username, Password)
    response, _ := client.Do(request)

    responseText, _ := ioutil.ReadAll(response.Body)
    fmt.Println(string(responseText))
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Json;
using System.Threading.Tasks;

namespace OxyApi
{
    class Program
    {
        static async Task Main()
        {
            const string Username = "USERNAME";
            const string Password = "PASSWORD";

            var parameters = new {
                source = "google_shopping_product",
                query = "[product_token_string]",
                render = "html",
                parse = true
            };

            var client = new HttpClient();

            Uri baseUri = new Uri("https://data.oxylabs.io");
            client.BaseAddress = baseUri;

            var requestMessage = new HttpRequestMessage(HttpMethod.Post, "/v1/queries");
            requestMessage.Content = JsonContent.Create(parameters);

            var authenticationString = $"{Username}:{Password}";
            var base64EncodedAuthenticationString = Convert.ToBase64String(System.Text.ASCIIEncoding.UTF8.GetBytes(authenticationString));
            requestMessage.Headers.Add("Authorization", "Basic " + base64EncodedAuthenticationString);

            var response = await client.SendAsync(requestMessage);
            var contents = await response.Content.ReadAsStringAsync();

            Console.WriteLine(contents);
        }
    }
}
```

{% endtab %}

{% tab title="Java" %}

```java
package org.example;

import okhttp3.*;
import org.json.JSONObject;
import java.util.concurrent.TimeUnit;

public class Main implements Runnable {
    private static final String AUTHORIZATION_HEADER = "Authorization";
    public static final String USERNAME = "USERNAME";
    public static final String PASSWORD = "PASSWORD";

    public void run() {
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("source", "google_shopping_product");
        jsonObject.put("query", "[product_token_string]");
        jsonObject.put("render", "html");
        jsonObject.put("parse", true);

        Authenticator authenticator = (route, response) -> {
            String credential = Credentials.basic(USERNAME, PASSWORD);
            return response
                    .request()
                    .newBuilder()
                    .header(AUTHORIZATION_HEADER, credential)
                    .build();
        };

        var client = new OkHttpClient.Builder()
                .authenticator(authenticator)
                .build();

        var mediaType = MediaType.parse("application/json; charset=utf-8");
        var body = RequestBody.create(jsonObject.toString(), mediaType);
        var request = new Request.Builder()
                .url("https://data.oxylabs.io/v1/queries")
                .post(body)
                .build();

        try (var response = client.newCall(request).execute()) {
            if (response.body() != null) {
                try (var responseBody = response.body()) {
                    System.out.println(responseBody.string());
                }
            }
        } catch (Exception exception) {
            System.out.println("Error: " + exception.getMessage());
        }

        System.exit(0);
    }

    public static void main(String[] args) {
        new Thread(new Main()).start();
    }
}
```

{% endtab %}

{% tab title="JSON" %}

```json
{
    "source": "google_shopping_product",
    "query": "[product_token_string]",
    "render": "html",
    "parse": true
}
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
**重要：** 该 `query` 参数必须包含一个来自 `google_shopping_search` 或者来自 `popular_products` 结果 `google_search`.
{% endhint %}

我们使用 [**Push-Pull**](https://developers.oxylabs.io/products/cn/web-scraper-api/integration-methods/push-pull.md) 集成方式在示例中。提交任务后会立即返回任务 ID，而不是结果。一旦任务状态为 `完成`，请使用以下方式获取结果： `GET https://data.oxylabs.io/v1/queries/{job_id}/results`。请参阅 [**Push-Pull**](https://developers.oxylabs.io/products/cn/web-scraper-api/integration-methods/push-pull.md) 以了解如何检查任务状态、回调和批量查询。

## 请求参数值

### 通用

用于抓取 Google Shopping 商品页面的基本设置和自定义选项。

<table><thead><tr><th width="222">参数</th><th width="330.3333333333333">说明</th><th>默认值</th></tr></thead><tbody><tr><td><mark style="background-color:green;"><strong><code>source</code></strong></mark></td><td>设置抓取器。</td><td><code>google_shopping_product</code></td></tr><tr><td><mark style="background-color:green;"><strong><code>query</code></strong></mark></td><td>来自的商品令牌 <code>google_shopping_search</code> 或 <code>google_search</code></td><td>-</td></tr><tr><td><code>render</code></td><td>设置为时启用 JavaScript 渲染 <code>html</code>. <strong>必需</strong> 以接收来自“More stores”部分的额外价格结果。 <a href="https://developers.oxylabs.io/products/cn/web-scraper-api/features/js-rendering-and-browser-control.md#javascript-rendering"><strong>更多信息</strong></a><strong>.</strong></td><td>-</td></tr><tr><td><code>parse</code></td><td>设置为时返回解析后的数据 <code>true</code>。查看输出 <a href="#output-data-dictionary"><strong>数据字典</strong></a>.</td><td><code>false</code></td></tr><tr><td><code>callback_url</code></td><td>回调端点的 URL。 <a href="https://developers.oxylabs.io/products/cn/web-scraper-api/integration-methods/push-pull.md"><strong>更多信息</strong></a></td><td>-</td></tr><tr><td><code>user_agent_type</code></td><td>设备类型和浏览器。完整列表可见 <a href="https://developers.oxylabs.io/products/cn/web-scraper-api/features/http-context-and-job-management/user-agent-type.md"><strong>这里</strong></a>.</td><td><code>桌面端</code></td></tr></tbody></table>

&#x20;    \- 必填参数

### 本地化

将结果适配到特定地理位置、域名和语言。

{% hint style="warning" %}
**注意：** 本地化参数（`gl` 和 `hl`）现在已嵌入到商品令牌中。要检索 `google_shopping_product` 与原始搜索结果匹配的数据，我们建议保持这些字段为空，除非确实需要覆盖。
{% endhint %}

<table><thead><tr><th width="218">参数</th><th width="336.3333333333333">说明</th><th>默认值</th></tr></thead><tbody><tr><td><code>geo_location</code></td><td>结果应适配的地理位置。正确使用此参数对于获取正确数据极其重要。更多信息请参阅我们推荐的 <code>geo_location</code> 参数结构 <a href="https://developers.oxylabs.io/products/cn/web-scraper-api/features/localization/serp-localization.md#google"><strong>这里</strong></a><strong>.</strong></td><td>-</td></tr><tr><td><code>locale</code></td><td><code>Accept-Language</code> 用于更改界面语言的请求头值。 <a href="https://developers.oxylabs.io/products/cn/web-scraper-api/features/localization/domain-locale.md#google"><strong>更多信息</strong></a>.</td><td>-</td></tr></tbody></table>

## 结构化数据

下面可以找到一个 **结构化输出示例** 用于 `google_shopping_product`.

{% file src="/files/4e0eb32135f920438eb36424e43e9c6917d38dab" %}

## 输出数据字典

**HTML 示例**

<figure><img src="https://3714446197-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBQ7Zf9paoN3FTeGcyfY1%2Fuploads%2Fgit-blob-94994ab82e160706d3fab5f13f5eb5d8d65d8977%2FScreenshot%202025-10-15%20at%2014.57.20.png?alt=media" alt=""><figcaption></figcaption></figure>

#### JSON 结构

下表列出了我们解析的每个产品页面元素的详细列表，以及它们的说明和数据类型。表中还包括一些元数据。

<table><thead><tr><th width="247.11328125">键</th><th width="384">说明</th><th>类型</th></tr></thead><tbody><tr><td><code>url</code></td><td>Google Shopping 商品页的 URL。</td><td>字符串</td></tr><tr><td><code>title</code> （可选）</td><td>商品列表标题。</td><td>字符串</td></tr><tr><td><code>description</code></td><td>商品的详细描述。</td><td>字符串</td></tr><tr><td><code>images</code></td><td>包含商品图片的对象。</td><td>对象</td></tr><tr><td><code>images.full_size</code></td><td>商品大图 URL 数组。</td><td>数组</td></tr><tr><td><code>images.thumbnails</code></td><td>商品缩略图 URL 数组。</td><td>数组</td></tr><tr><td><code>pricing</code></td><td>包含所有在线价格信息的数组。</td><td>数组</td></tr><tr><td><code>reviews</code></td><td>包含评论信息的对象。（仅限美国）</td><td>对象</td></tr><tr><td><code>变体</code></td><td>包含商品变体的对象数组。（颜色、尺寸等）</td><td>数组</td></tr><tr><td><code>related_items</code></td><td>包含相关商品的对象数组。</td><td>数组</td></tr><tr><td><code>规格</code></td><td>包含商品规格的对象数组。</td><td>数组</td></tr><tr><td><code>parse_status_code</code></td><td>解析任务的状态码。您可以查看所述的解析器状态码 <a href="https://developers.oxylabs.io/products/cn/web-scraper-api/response-codes.md#parsers"><strong>这里</strong></a>.</td><td>整数</td></tr><tr><td><code>created_at</code></td><td>抓取任务创建时的时间戳。</td><td>时间戳</td></tr><tr><td><code>updated_at</code></td><td>抓取任务完成时的时间戳。</td><td>时间戳</td></tr><tr><td><code>status_code</code></td><td>抓取任务的状态代码。你可以查看所描述的抓取器状态代码 <a href="https://developers.oxylabs.io/products/cn/web-scraper-api/response-codes.md"><strong>这里</strong></a>.</td><td>整数</td></tr><tr><td><code>job_id</code></td><td>与该抓取任务关联的任务 ID。</td><td>字符串</td></tr></tbody></table>

{% hint style="info" %}
在以下部分中，当结果类型包含多个条目时，解析后的 JSON 代码片段会被缩短。
{% endhint %}

### 定价

包含商品价格信息的数组。

<figure><img src="https://3714446197-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBQ7Zf9paoN3FTeGcyfY1%2Fuploads%2Fgit-blob-3d0489c26c8e8ad3fd766c09c20b7004bb3ea2ab%2FScreenshot%202025-10-15%20at%2014.58.23.png?alt=media" alt=""><figcaption></figcaption></figure>

```json
...
   "pricing": {
    "online": [
        {
          "price": 559,
          "seller": "Walmart - Seller",
          "details": "Pny GeForce RTX 4070 GPU 12gb Xlr8 Gaming Verto Epic-x RGB Triple Fan Dlss 3 Graphics Card",
          "currency": "USD",
          "condition": "New",
          "seller_link": "https://www.walmart.com/ip/PNY-GeForce-RTX-4070-GPU-12GB-XLR8-Gaming-VERTO-EPIC-X-RGB-Triple-Fan-DLSS-3-Graphics-Card/1396859462?wmlspartner=wlpa&selectedSellerId=101035116&selectedOfferId=159733DADC653E1891C050148D16D747&conditionGroupCode=1",
          "price_shipping": 22.05
        },
...
    ]
},
...
```

<table><thead><tr><th width="231">键（pricing[]）</th><th width="375">说明</th><th>类型</th></tr></thead><tbody><tr><td><code>online</code></td><td>包含商品价格详情的对象数组。</td><td>数组</td></tr><tr><td><code>online.price</code></td><td>指定货币下的商品价格。</td><td>浮点数</td></tr><tr><td><code>online.seller</code></td><td>提供该商品的卖家或商家的名称。</td><td>字符串</td></tr><tr><td><code>online.details</code></td><td>关于商品和购买的附加信息，例如配送和退货政策。</td><td>字符串</td></tr><tr><td><code>online.currency</code></td><td>商品价格的货币代码。</td><td>字符串</td></tr><tr><td><code>online.condition</code></td><td>商品状况。</td><td>字符串</td></tr><tr><td><code>online.seller_link</code></td><td>卖家商品页的 URL。</td><td>字符串</td></tr><tr><td><code>online.price_shipping</code></td><td>商品的运费。</td><td>浮点数</td></tr></tbody></table>

### 评论

包含商品评论和评分信息的对象。

{% hint style="info" %}
目前，评论仅在美国地区可用。
{% endhint %}

<figure><img src="https://3714446197-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBQ7Zf9paoN3FTeGcyfY1%2Fuploads%2Fgit-blob-382fa21458cb3da13c80040f6a04227226c56e4d%2Fgoogle_shopping_product-reviews.png?alt=media" alt=""><figcaption></figcaption></figure>

```json
...       
       "reviews": {
    "rating": 4.7,
    "top_review": {
        "text": "My computer is a Dell Optiplex 9020, i7-4770, 32mb, 500gb SSD. The 3 fan card is a long, and the hard drive cage had to be removed to fit in the Optiplex case. The power supply was upgraded to 750 watts which required an adapter for the Dell motherboard. With those modifications out of the way, installation of the card was drama free, but you have use Google to find the driver in the Nvidia website. I am using this GPU for 3D animation in Blender. I am very pleased with the speed of the rendering with ray tracing in EEVEE and Cycles. As this is an old computer, the computer's CPU never runs at 100%, and I haven't been able to max out this card's capacity yet. I don't hear the fans running but I have never put a high load enough on it yet, I guess. It does have a little electronic buzz when it is rendering.\u00a0Less",
        "author": "walmart.com Shopper",
        "rating": 5,
        "source": "Reviewed on walmart.com"
      },
      "rating_stars": 4.7,
      "reviews_count": 51,
      "review_count_by_stars": {
        "1": {
          "reviews_count": 2
        },
        "2": {
          "reviews_count": 0
        },
        "3": {
          "reviews_count": 2
        },
        "4": {
          "reviews_count": 3
        },
        "5": {
          "reviews_count": 44
        }
    },
},
...
```

<table><thead><tr><th width="253">键(reviews[])</th><th width="375">说明</th><th>类型</th></tr></thead><tbody><tr><td><code>rating</code></td><td>商品的平均评分，通常满分为 5 分。</td><td>浮点数</td></tr><tr><td><code>top_review</code> （可选）</td><td>包含商品最佳评论详情的对象。</td><td>对象</td></tr><tr><td><code>top_review.text</code> （可选）</td><td>最佳评论的文本内容</td><td>字符串</td></tr><tr><td><code>top_review.title</code> （可选）</td><td>最佳评论的标题。</td><td>字符串</td></tr><tr><td><code>top_review.author</code> （可选）</td><td>最佳评论的作者。</td><td>字符串</td></tr><tr><td><code>top_review.rating</code> （可选）</td><td>最佳评论作者给出的评分，通常满分为 5 分。</td><td>浮点数</td></tr><tr><td><code>top_review.source</code> （可选）</td><td>最佳评论发布的来源或网站。</td><td>字符串</td></tr><tr><td><code>rating_stars</code></td><td>商品的平均评分，通常满分为 5 星。</td><td>浮点数</td></tr><tr><td><code>reviews_count</code> （可选）</td><td>商品的评论总数。</td><td>整数</td></tr><tr><td><code>review_count_by_stars</code></td><td>包含每个星级评论数量的对象。</td><td>对象</td></tr><tr><td><code>review_count_by_stars.url</code> （可选）</td><td>X 星评论的 URL。</td><td>字符串</td></tr><tr><td><code>review_count_by_stars.reviews_count</code></td><td>X 星评论数量。</td><td>整数</td></tr></tbody></table>

### 相关商品（更多选项）

包含目标商品相关商品的对象数组。

<figure><img src="https://3714446197-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBQ7Zf9paoN3FTeGcyfY1%2Fuploads%2Fgit-blob-bd795f4c0e6892bbeba172b098b142ab3e26c36d%2FScreenshot%202025-10-15%20at%2015.05.40.png?alt=media" alt=""><figcaption></figcaption></figure>

```json
...             
   "related_items": [
      {
        "items": [
          {
            "url": "/search?ibp=oshop&prds=catalogid:1368129371371338580,gpcid:14975392695437189622,headlineOfferDocid:2388507960063782588,imageDocid:1618178582933849531,productid:7780474142858650836,pvo:2,pvt:hg,rds:PC_14975392695437189622%7CPROD_PC_14975392695437189622&q=nvidia+rtx&gl=us&hl=en&pvorigin=2",
            "image": "https://encrypted-tbn3.gstatic.com/shopping?q=tbn:ANd9GcScO-LIdlqj1WjcLznMECFXNo4qbZ1TRbkfHdDsDPoIYxx7S9TjKhnQX7Ah6QsKI-zPBKFrC54H0wGZC60Q_NdRebesvYUXwRhQFuZRwvtWmx4_0xoxbylM",
            "price": 639.99,
            "title": "NVIDIA GeForce RTX 5070 12GB GDDR7 Graphics Card",
            "currency": "USD",
            "reviews_count": 228
          },
...
        ],
        "title": "More options"
     }
],
...
```

<table><thead><tr><th width="265">键(related_items[])</th><th width="350">说明</th><th>类型</th></tr></thead><tbody><tr><td><code>items</code></td><td>包含每个相关商品详情的对象数组。</td><td>数组</td></tr><tr><td><code>items.url</code></td><td>相关商品页的 URL。</td><td>字符串</td></tr><tr><td><code>items.image</code></td><td>相关商品图片的 URL。</td><td>字符串</td></tr><tr><td><code>items.price</code></td><td>指定货币下相关商品的价格。</td><td>浮点数</td></tr><tr><td><code>items.title</code> （可选）</td><td>相关商品列表的标题。</td><td>字符串</td></tr><tr><td><code>items.rating</code> （可选）</td><td>相关商品的平均用户评分，通常满分为 5 分。</td><td>整数</td></tr><tr><td><code>items.store</code> （可选）</td><td>提供相关商品的商店或商家名称。</td><td>字符串</td></tr><tr><td><code>items.currency</code></td><td>商品价格的货币代码。</td><td>字符串</td></tr><tr><td><code>items.reviews_count</code></td><td>相关商品的评论总数。</td><td>整数</td></tr><tr><td><code>title</code></td><td>相关商品部分的标题</td><td>字符串</td></tr></tbody></table>

### 规格

包含商品规格详情的对象数组。

<figure><img src="https://3714446197-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBQ7Zf9paoN3FTeGcyfY1%2Fuploads%2Fgit-blob-bd571b2b955876422b6804ab1d21168571972b25%2Fgoogle_shopping_product-specifications.png?alt=media" alt=""><figcaption></figcaption></figure>

```json
...
"specifications": [
    {
        "items": [
          {
            "title": "Manufacturer",
            "value": "PNY"
          },
          {
            "title": "Output",
            "value": "HDMI, DisplayPort"
          },
          {
            "title": "Interface",
            "value": "PCI Express"
          },
          {
            "title": "Brand",
            "value": "PNY"
          },
...
        ],
        "section_title": "attributes"
      }
],
...
```

<table><thead><tr><th width="220">键 (specifications[])</th><th width="367">说明</th><th>类型</th></tr></thead><tbody><tr><td><code>items.title</code></td><td>规格标题。</td><td>字符串</td></tr><tr><td><code>items.value</code></td><td>规格值。</td><td>字符串</td></tr></tbody></table>


---

# 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/mu-biao/sou-suo-yin-qing/gu-ge/gou-wu/gou-wu-shang-pin.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.
