# Google Shopping

**SERP API 谷歌 Shopping 查詢參數**<br>

使用 Thordata 的 SERP API 配置谷歌 shopping 查詢，包括本地化參數、地理位置、分頁、以及「高級參數」輸出選項。

<details>

<summary><strong><code>q</code> ，搜索查詢（必填）</strong></summary>

定義用於數據抓取的搜索查詢（預設值：q=pizza）。支援任何語言的任意關鍵詞。

**示例請求：**

使用`q`：<mark style="color:blue;">pizza</mark>參數的示例

```sh
curl -X POST https://scraperapi.thordata.com/request \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -H "Authorization: Bearer token" \
 -d "engine=google_shopping" \
 -d "q=pizza" \
 -d "json=1"
```

</details>

## 本土化

<details>

<summary><strong><code>google_domain</code>，域名(非必填)</strong></summary>

定義用於數據抓取的搜索引擎域名（預設值：google.com）。\
您可在系統中修改此參數，或參考 Google 域名頁面獲取完整支援的域名列表。

**示例請求：**

使用`q`：<mark style="color:blue;">pizza</mark>,`url` ：<mark style="color:blue;">google.co.ao</mark>參數的示例

```sh
curl -X POST https://scraperapi.thordata.com/request \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -H "Authorization: Bearer token" \
 -d "engine=google_shopping" \
 -d "q=pizza" \
 -d "google_domain=google.co.ao" \
 -d "json=1"
```

</details>

<details>

<summary><strong><code>gl</code> ，國家(非必填)</strong></summary>

指定搜尋結果的定位國家/地區（預設值：us）。採用兩位字母國家代碼（如：us-美國，ru-俄羅斯，uk-英國）。

完整國家代碼支援清單請參閱：[Google官方國家代碼表](https://developers.google.com/adwords/api/docs/appendix/geotargeting)

**示例請求：**

使用`q`：<mark style="color:blue;">pizza</mark>,`gl`<mark style="color:blue;">：ru</mark>參數的示例

```sh
curl -X POST https://scraperapi.thordata.com/request \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -H "Authorization: Bearer token" \
 -d "engine=google_shopping" \
 -d "q=pizza" \
 -d "gl=ru" \
 -d "json=1"
```

</details>

<details>

<summary><strong><code>hl</code> ，語言(非必填)</strong></summary>

設定搜尋結果的介面語言（預設值：en）。採用標準語言代碼格式（如：en-英文，es-西班牙文，zh-CN-簡體中文）。

完整語言代碼支援清單請參閱：[Google官方語言代碼表](https://developers.google.com/google-ads/api/docs/start)

**示例請求：**

使用`q`：<mark style="color:blue;">pizza</mark>,`hl`： <mark style="color:blue;">es</mark>參數的示例

```sh
curl -X POST https://scraperapi.thordata.com/request \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -H "Authorization: Bearer token" \
 -d "engine=google_shopping" \
 -d "q=pizza" \
 -d "json=1" \
 -d "hl=es"
```

</details>

## 地理位置

<details>

<summary><strong><code>location</code>，地理位置(非必填)</strong></summary>

模擬從精確位置發起搜尋（需搭配 uule 參數使用）。若未指定此參數，系統可能採用代理伺服器的地理位置作為預設值。

**示例請求：**

使用`q`：<mark style="color:blue;">pizza</mark>,`location`:<mark style="color:blue;">India</mark>,`uule`:<mark style="color:blue;">w+CAIQICIFSW5kaWE</mark>參數的示例

```

curl -X POST https://scraperapi.thordata.com/request \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -H "Authorization: Bearer token" \
 -d "engine=google_shopping" \
 -d "q=pizza" \
 -d "json=1" \
 -d "location=India" \
 -d "uule=w+CAIQICIFSW5kaWE"
```

</details>

<details>

<summary><strong><code>uule</code> ，</strong>編碼位置<strong>(非必填)</strong></summary>

使用 Base64 編碼目標地理位置（需與 `location` 參數配合使用）。

**示例請求：**

使用`q`：<mark style="color:blue;">pizza</mark>,`location`:<mark style="color:blue;">India</mark>,`uule`:<mark style="color:blue;">w+CAIQICIFSW5kaWE</mark>參數的示例

```sh
curl -X POST https://scraperapi.thordata.com/request \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -H "Authorization: Bearer token" \
 -d "engine=google_shopping" \
 -d "q=pizza" \
 -d "json=1" \
 -d "location=India" \
 -d "uule=w+CAIQICIFSW5kaWE"
```

</details>

## 分頁

<details>

<summary><strong><code>start</code> ，結果偏移量（非必填）</strong></summary>

此參數定義結果偏移量。它會跳過指定數量的結果。它用於分頁。 （例如，0（預設值）表示第一頁結果，10 表示第二頁結果，20 表示第三頁結果，以此類推。）

**示例請求：**

使用`q`：<mark style="color:blue;">pizza</mark>,`start`:<mark style="color:blue;">30</mark>參數的示例

```sh
curl -X POST https://scraperapi.thordata.com/request \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -H "Authorization: Bearer token" \
 -d "engine=google_shopping" \
 -d "q=pizza" \
 -d "json=1" \
 -d "start=30"
```

</details>

<details>

<summary><strong><code>num</code> ，每頁結果數（非必填）</strong></summary>

設定搜尋結果每頁返回數量（預設值：10）。例如：`num`=10 表示每頁返回10筆結果。

**示例請求：**

使用`q`：<mark style="color:blue;">pizza</mark>,`num`:<mark style="color:blue;">20</mark>參數的示例

```sh
curl -X POST https://scraperapi.thordata.com/request \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -H "Authorization: Bearer token" \
 -d "engine=google_shopping" \
 -d "q=pizza" \
 -d "json=1" \
 -d "num=20"
```

</details>

## 高級參數

<details>

<summary><strong><code>tbs</code> ，高級搜索條件（非必填）</strong></summary>

時間/類型篩選參數（支援進階條件設定）：

1. 時間範圍篩選：
   * qdr:h → 過去1小時（例：tbs=qdr:h）
   * qdr:d → 過去24小時（例：tbs=qdr:d）
   * qdr:w → 過去1週（例：tbs=qdr:w）
   * qdr:m → 過去1個月（例：tbs=qdr:m）
   * qdr:y → 過去1年（例：tbs=qdr:y）
2. 內容類型篩選：
   * sur:f → 僅顯示圖片結果（例：tbs=sur:f）
   * sur:fc → 僅顯示彩色圖片
   * sur:fm → 僅顯示動態圖片（GIF等）
3. 複合條件組合：
   * 可疊加多個條件（例：tbs=qdr:w,sur:f → 過去1週內的圖片結果）

**示例請求：**

使用`q`：<mark style="color:blue;">pizza</mark>,`tbs`:<mark style="color:blue;">sur:f</mark>參數的示例

```sh
curl -X POST https://scraperapi.thordata.com/request \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -H "Authorization: Bearer token" \
 -d "engine=google_shopping" \
 -d "q=pizza" \
 -d "json=1" \
 -d "tbs=sur:f"
```

</details>

<details>

<summary><code>shoprs</code> <strong>，過濾器ID（非必填）</strong></summary>

此參數用於設定搜尋篩選器的輔助 ID，以精確控制搜尋結果的篩選條件。

**示例請求：**

使用`q`：<mark style="color:blue;">pizza</mark>,`shoprs`:<mark style="color:$primary;">shoprs\_1</mark>參數的示例

```sh
curl -X POST https://scraperapi.thordata.com/request \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -H "Authorization: Bearer token" \
 -d "engine=google_shopping" \
 -d "q=pizza" \
 -d "json=1" \
 -d "shoprs=shoprs_1"
```

</details>

<details>

<summary><code>min_price</code> <strong>，最低價格（非必填）</strong></summary>

設定搜尋結果的最低價格門檻（單位：當地貨幣），此設定將覆寫任何透過 `shoprs` 參數嵌入的價格篩選條件。

**示例請求：**

使用`q`：<mark style="color:blue;">pizza</mark>,`min_price`:<mark style="color:blue;">10</mark>參數的示例

```sh
curl -X POST https://scraperapi.thordata.com/request \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -H "Authorization: Bearer token" \
 -d "engine=google_shopping" \
 -d "q=pizza" \
 -d "json=1" \
 -d "min_price=10"
```

</details>

<details>

<summary><code>max_price</code> <strong>，最高價格（非必填）</strong></summary>

強制設定搜尋結果的最高價格上限（單位：當地貨幣），此設定將優先覆蓋所有透過 `shoprs` 或其他參數設定的價格篩選條件。

**示例請求：**

使用`q`：<mark style="color:blue;">pizza</mark>,`max_price`:<mark style="color:blue;">100</mark>參數的示例

```sh
curl -X POST https://scraperapi.thordata.com/request \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -H "Authorization: Bearer token" \
 -d "engine=google_shopping" \
 -d "q=pizza" \
 -d "json=1" \
 -d "min_price=10" \
 -d "max_price=100"
```

</details>

<details>

<summary><code>sort_by</code><strong>，排序依據（非必填）</strong></summary>

**功能說明**：定義搜尋結果的排序規則，特別針對商品價格進行排序優化。

**可用選項：**

| 值   | 排序方式       | 適用場景           |
| --- | ---------- | -------------- |
| `1` | **價格由低到高** | 比價採購、預算型消費     |
| `2` | **價格由高到低** | 奢侈品搜尋、高端商品市場分析 |

**示例請求：**

使用`q`：<mark style="color:blue;">pizza</mark>,`sort_by`:1參數的示例

```sh
curl -X POST https://scraperapi.thordata.com/request \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -H "Authorization: Bearer token" \
 -d "engine=google_shopping" \
 -d "q=pizza" \
 -d "json=1" \
 -d "sort_by=1"
```

</details>

<details>

<summary><code>free_shipping</code><strong>，免費送貨（非必填）</strong></summary>

制篩選出提供免運費服務的商品，排除所有需支付運費的搜尋結果

**示例請求：**

使用`q`：<mark style="color:blue;">pizza</mark>,`free_shipping`:true參數的示例

```sh
curl -X POST https://scraperapi.thordata.com/request \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -H "Authorization: Bearer token" \
 -d "engine=google_shopping" \
 -d "q=pizza" \
 -d "gl=ad" \
 -d "json=1" \
 -d "free_shipping=true"
```

</details>

<details>

<summary><code>on_sale</code><strong>，特價中非必填）</strong></summary>

强制筛选出标有促销标识的商品（如折扣价/限时优惠/满减活动），排除所有常规价格商品

**示例請求：**

使用`q`：<mark style="color:blue;">pizza</mark>,`on_sale`:true參數的示例

```sh
curl -X POST https://scraperapi.thordata.com/request \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -H "Authorization: Bearer token" \
 -d "engine=google_shopping" \
 -d "q=pizza" \
 -d "gl=ad" \
 -d "json=1" \
 -d "on_sale=true"
```

</details>

<details>

<summary><code>small_business</code><strong>，小型企業（非必填）</strong></summary>

進展示小型企業。

**示例請求：**

使用`q`：<mark style="color:blue;">pizza</mark>,`small_business`:true參數的示例

```sh
curl -X POST https://scraperapi.thordata.com/request \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -H "Authorization: Bearer token" \
 -d "engine=google_shopping" \
 -d "q=pizza" \
 -d "gl=ad" \
 -d "json=1" \
 -d "small_business=true"
```

</details>

<details>

<summary><code>direct_link</code><strong>，包括直接連接（非必填）</strong></summary>

控制搜尋結果是否包含商品的「直連購買連結」

**示例請求：**

使用`q`：<mark style="color:blue;">pizza</mark>,`direct_link`:true參數的示例

```sh
curl -X POST https://scraperapi.thordata.com/request \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -H "Authorization: Bearer token" \
 -d "engine=google_shopping" \
 -d "q=pizza" \
 -d "gl=ad" \
 -d "json=1" \
 -d "direct_link=true"
```

</details>

如需進一步幫助，請透過 **<support@thordata.com>** 聯繫我們。
