# Google 新闻 关键词搜索 API (google_news.search)

- Canonical page: https://everyinfra.com/google-news-api/search
- Endpoint: POST /api/v1/social with {"platform": "google_news", "action": "search", "params": {...}}
- Price: $0.000792 per call ($0.79 per 1,000 requests); failed and empty results are not charged
- Returns: list, default 20, max 20 per call
- Mode: sync; add "mode": "async" for slow tasks

## Health

- Live health (24h percent, hourly and daily trends): https://api.everyinfra.com/api/v1/social/availability?platform=google_news&action=search

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| keyword | not declared | yes | not declared | 新闻搜索词，支持 -排除、OR、site:（如 bitcoin site:cnn.com），最多 500 字。 |
| country | not declared | no | not declared | 按哪个国家的 Google 新闻搜，两位国家代码（如 us、gb、de），默认 us。 |
| language | not declared | no | not declared | 结果语言，两位语言代码（如 en、es、de），默认 en。 |
| time_window | not declared | no | not declared | 只要这段时间内的文章：hour、day、week、month、year；不填不限时间。 |
| limit | integer (1–20) | no | 20 | 这次调用最多返回的条数，整数，1–20；不传按默认值，实际返回可能少于这个数。超过上限会在扣费前返回 422。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| rank | 该文章在这次结果里的顺序，从 1 开始（Google 新闻的排序，大致从新到旧）。 |
| title | 标题。平台无标题概念时（如纯文本帖）为 null。 |
| url | 该记录在原平台上的可访问链接。 |
| source | 发布这篇文章的媒体名（如 Reuters、WSJ）。 |
| text | 正文内容，已去除 HTML 标签，全文返回、不截断（个别平台的列表结果本身只有摘要，以该平台的字段说明为准）。 |
| published_at | 文章发布时间，UTC，ISO 8601。 |
| image_url | 图片链接。多图能力可能返回 image_urls 数组。 |
| platform | 数据来源平台标识，与请求里的 platform 一致（如 xiaohongshu、tiktok）。 |

## Example

```bash
curl -X POST 'https://api.everyinfra.com/api/v1/social' \
  -H "Authorization: Bearer $EVERYINFRA_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "platform": "google_news",
  "action": "search",
  "params": {
    "keyword": "OpenAI"
  }
}'
```

```python
import os
import requests

response = requests.post(
    "https://api.everyinfra.com/api/v1/social",
    headers={"Authorization": f"Bearer {os.environ['EVERYINFRA_API_KEY']}"},
    json={
        "platform": "google_news",
        "action": "search",
        "params": {
            "keyword": "OpenAI",
        },
    },
    timeout=120,
)
print(response.status_code)
print(response.json())
```

## Response example

No real sample for these example parameters yet: structure only, every value is a placeholder (…).

```text
{
  "id": "req_…",
  "platform": "google_news",
  "action": "search",
  "results": [
    {
      "rank": …,
      "title": …,
      "url": …,
      "source": …,
      "text": …,
      "published_at": …,
      "image_url": …,
      "platform": …
    }
  ],
  "count": …,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## Also

- Capability catalog (no key): https://api.everyinfra.com/api/v1/social/catalog?platform=google_news
- OpenAPI: https://everyinfra.com/openapi.json · Agents guide: https://everyinfra.com/agents.md
