# Google Trends

## **SERP API Google 查询参数配置**

使用 **Thordata 的 SERP API** 可自定义 Google trends查询，支持地理定位、搜索类型及高级参数设置，优化搜索结果。

<details>

<summary><strong><code>q</code> ,</strong>搜索查询<strong>(必填)</strong></summary>

定义用于数据爬取的搜索查询（默认值：`q=pizza`）。支持任何语言的关键词。

**示例请求：**

使用参数 `q` 的示例：pizza

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

</details>

## 地理位置

<details>

<summary><strong><code>hl</code> ,</strong>语言<strong>(非必填)</strong></summary>

设置搜索结果的界面语言（默认值：en）。采用标准语言代码格式（例如：en、es、zh-CN）。\
如需完整的支持语言代码列表，请参考：[Google 语言代码](https://developers.google.com/custom-search/docs/xml_results#languageCollections)。

**示例请求：**

使用参数 `q=pizza` 和 `hl=es` 的示例结果

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

</details>

<details>

<summary><strong><code>geo</code> ,</strong>位置<strong>(非必填)</strong></summary>

此参数用于设置您希望搜索的地理位置。默认值为全球范围（当未设置或 geo 参数值为空时启用）。完整支持的 Google Trends 地理位置列表请参阅：[Google Trends 地理位置](https://developers.google.com/custom-search/docs/xml_results#countryCollections)。

**示例请求：**

使用参数 `q=pizza` 和 `geo=India` 的示例结果

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

</details>

<details>

<summary><strong><code>region</code>,</strong>地区<strong>(非必填)</strong></summary>

该参数用于在使用「按地区比较区段」和「按地区兴趣分布」数据类型图表时获取更精确的结果。其他数据类型图表不支持此区域参数。默认值取决于设定的地理区域。可用选项包括：

* `COUNTRY` - 国家
* `REGION` - 次区域
* `DMA` - 都会区
* `CITY` - 城市

**示例请求：**

使用参数 `q=pizza` 和 `region=COUNTRY` 的示例结果

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

</details>

## 搜索类型

<details>

<summary><code>data_type</code> <strong>,</strong>类别<strong>(非必填)</strong></summary>

此参数用于设置您要执行的搜索类型。可用选项包括：

* **`TIMESERIES`** - 时间趋势分析（支持单个或多个查询）
* **`GEO_MAP`** - 区域比较分析（仅支持多个查询）
* **`GEO_MAP_0`** - 区域兴趣分布（仅支持单个查询）
* **`RELATED_TOPICS`** - 相关主题（仅支持单个查询）
* **`RELATED_QUERIES`** - 相关查询（仅支持单个查询）

**示例请求：**

使用参数 `q=pizza` 和 `data_type=TIMESERIES` 的示例结果

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

</details>

## 高级参数

<details>

<summary><code>tz</code><strong>,</strong>时区<strong>(非必填)</strong></summary>

此参数用于设置时区偏移量。默认值为 -420（太平洋夏令时间，PDT：UTC-7）。数值以分钟为单位，取值范围为 -1439 至 1439。

**时区偏移量计算方法：**\
以 UTC+0 为基准，计算目标时区的时间差（分钟数）。例如：

* 太平洋夏令时间（PDT，UTC-7）→ `tz = -7 * 60 = -420`
* 台湾标准时间（TST，UTC+8）→ `tz = 8 * 60 = 480`

**示例请求：**

使用参数 `q=pizza` 和 `tz=-420` 的示例结果（PDT 时区）

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

</details>

<details>

<summary><code>cat</code>,类別 <strong>(非必填)</strong></summary>

此参数用于设置搜索分类。默认值为 `0`（表示所有分类）。

**示例请求：**

使用参数 `q=pizza` 和 `cat=7` 的示例结果

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

</details>

<details>

<summary><code>gprop</code> <strong>,</strong>财产<strong>(非必填)</strong></summary>

此参数用于按属性类别对搜索结果进行排序。默认属性为「网页搜索」（当未设置或 gprop 参数值为空时启用）。其他可用选项包括：

* **`images`** - 图片搜索
* **`news`** - 新闻搜索
* **`froogle`** - Google 购物
* **`youtube`** - YouTube 搜索

**示例请求：**

使用参数 `q=pizza` 和 `gprop=froogle` 的搜索结果

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

</details>

<details>

<summary><code>date</code> <strong>,</strong>日期<strong>(非必填)</strong></summary>

此参数用于设置搜索日期范围。可用选项包括：

**预设时间范围：**

* `now 1-H` - 过去1小时
* `now 4-H` - 过去4小时
* `now 1-d` - 过去1天
* `now 7-d` - 过去7天
* `today 1-m` - 过去30天
* `today 3-m` - 过去90天
* `today 12-m` - 过去12个月
* `today 5-y` - 过去5年
* `all` - 2004年至今

**自定义日期格式：**

* `yyyy-mm-dd yyyy-mm-dd`（例如：`2021-10-15 2022-05-25`）

**示例请求：**

使用参数 `q=pizza` 和 `date=now 1-H` 的搜索结果

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

</details>

如果您需要更多帮助，请通过邮&#x7BB1;**<support@thordata.com>**&#x8054;系我们。
