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 | 用于从特定来源(例如 'CNN'、'BBC')获取结果的 Google 新闻出版物令牌。从之前的响应中获取。 | |
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))
}响应
正在加载最新响应示例...
