# Google News

**SERP API 谷歌 News 查詢參數**

\
使用 Thordata 的 SERP API 配置谷歌 News 查詢，包括本地化參數、以及「進階參數」輸出選項。

<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_news" \
 -d "q=pizza" \
 -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_news" \
 -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_news" \
 -d "q=pizza" \
 -d "json=1" \
 -d "hl=es"
```

</details>

## 高级參數

<details>

<summary><code>topic_token</code> <strong>，主題令牌（非必填）</strong></summary>

定義 Google 新聞主題識別碼。\
該識別碼用於存取特定主題的新聞結果（例如：`'World'（國際）、'Business'（商業）、'Technology'（科技）`）。

**示例請求：**

查询 `q` ：<mark style="color:blue;">pizza</mark>,,`topic_token`:Technology的示例結果

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

</details>

<details>

<summary><code>publication_token</code><strong>，發佈令牌（非必填）</strong></summary>

該權杖用於存取特定出版商（例如：`'CNN'、'BBC'、'The Guardian'`（衛報））的新聞結果。

**示例請求：**

查询 `q` ：<mark style="color:blue;">pizza</mark>,`publication_token`:BBC的示例結果

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

</details>

<details>

<summary><code>section_token</code><strong>，部分标记（非必填）</strong></summary>

定義 Google 新聞版塊權杖。\
該權杖用於存取特定主題的子分類內容（例如："`Business -> Economy`"（商業 -> 經濟））。

**示例請求：**

查询 `q` ：<mark style="color:blue;">pizza</mark>,`section_token`:Business,的示例結果

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

</details>

<details>

<summary><code>story_token</code> <strong>，故事代幣（非必填）</strong></summary>

定義 Google 新聞報導識別碼。\
該識別碼用於存取特定新聞事件的完整報導內容（包含不同媒體來源的相關報導集合）。

**示例請求：**

查询 `q` ：<mark style="color:blue;">pizza</mark>,`story_token`:story的示例結果

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

</details>

<details>

<summary><code>so</code><strong>，排序依据（非必填）</strong></summary>

此參數用於指定新聞結果的排序方式，可選擇依「相關性」或「日期」進行排序（預設為依相關性排序）

**示例請求：**

查询 `q` ：<mark style="color:blue;">pizza</mark>,`so`:<mark style="color:blue;">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_news" \
 -d "q=pizza" \
 -d "json=1" \
 -d "so=1"
```

</details>

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