Google 新聞 搜尋 API
API 健康狀態
健康 可用 受限 多數不可用 無資料
正在載入健康狀態...
取得 Google 新聞搜尋資料,包括標題和來源元數據,用於媒體監控和新聞彙整。
標籤: Google 新聞
請求參數
| 名稱 | 必填 | 類型 | 預設值 | 說明 |
|---|---|---|---|---|
query | 是 | string | Google 新聞的搜尋查詢(例如 '人工智慧'、'氣候變遷')。 | |
country | 否 | string | us | 設定目標國家代碼(例如 'us'、'uk')以本地化結果。請參閱 Google 國家。 |
language | 否 | string | en | 使用兩個字母的代碼設定結果語言(例如 'en' 表示英文,'fr' 表示法文)。請參閱 Google 語言。 |
topic_token | 否 | string | Google 新聞主題代碼,用於檢索特定類別的結果(例如 '世界'、'科技')。從先前的回應中取得。 | |
publication_token | 否 | string | Google 新聞出版物代碼,用於從特定來源取得結果(例如 'CNN'、'BBC')。從先前的回應中取得。 | |
section_token | 否 | string | Google 新聞區塊代碼,用於存取主題或出版物內的特定子區塊。 | |
so | 否 | string | 新聞結果的排序方式。僅適用於 'story_token'。 可用值: - RELEVANCE:相關性。也接受舊版值 0。- DATE:日期。也接受舊版值 1。 |
複製請求
bash
curl -X GET "https://api.justserpapi.com/api/v1/google/news/search?query=coffee" \
-H "X-API-Key: YOUR_API_KEY"js
const res = await fetch("https://api.justserpapi.com/api/v1/google/news/search?query=coffee", {
headers: { "X-API-Key": "YOUR_API_KEY" }
});
const data = await res.json();
console.log(data);python
import requests
url = "https://api.justserpapi.com/api/v1/google/news/search"
headers = { "X-API-Key": "YOUR_API_KEY" }
params = {
"query": "coffee"
}
response = requests.get(url, headers=headers, params=params)
print(response.json())php
<?php
$url = "https://api.justserpapi.com/api/v1/google/news/search?query=coffee";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"X-API-Key: YOUR_API_KEY"
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;go
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
client := &http.Client{}
req, _ := http.NewRequest("GET", "https://api.justserpapi.com/api/v1/google/news/search?query=coffee", nil)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}回應
正在載入最新回應範例...
