> ## Documentation Index
> Fetch the complete documentation index at: https://docs.querying.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Google 搜索结果 API（GOOGLE_SERP）

> 获取某个查询的一页 google.com 自然结果、广告和 SERP 面板，无需等待 AI 概览。

`GOOGLE_SERP` 加载一个 google.com 结果页，返回其中的自然结果和各类面板。它不等待 AI 概览，因此比 [`GOOGLE`](/zh/engines/google-ai-overviews) 更快、费用更低。可用于排名追踪，或查找要用 [`WEB_SCRAPE`](/zh/engines/web-scrape) 读取的页面。

| | |
| - | - |
| `taskType` | `GOOGLE_SERP` |
| 输入 | `query`（必填）；`page`、`country`、`location`、`include` |
| 积分 | 每个任务 1 积分 |
| 国家 | 默认 `US`。可使用任意 ISO 3166-1 alpha-2 代码。 |
| 位置 | 支持。见[地区与位置](/zh/engines/capacity.md)。 |

## 请求

```bash theme={"theme":"css-variables"}
curl -X POST https://api.querying.ai/v1/async/task \
  -H "Authorization: Bearer $QUERYING_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "taskType": "GOOGLE_SERP", "payload": { "query": "best running shoes for flat feet", "country": "US", "page": 2 } }'
```

任务异步执行。按[异步任务](/zh/concepts/async-tasks.md)中的说明读取结果。

## 参数

| 字段 | 必填 | 说明 |
| - | - | - |
| `query` | 是 | 搜索查询，1-100,000 个字符。缺少 `query` 时接受 `prompt`。 |
| `page` | 否 | 结果页码，1 到 10 的整数，默认 `1`。每页包含十条自然结果。其他值返回 `422 VALIDATION_ERROR`。 |
| `country` | 否 | 要搜索的 Google 市场，默认 `US`。 |
| `location` | 否 | 以十进制度表示的 `{ "latitude", "longitude" }`。Google 会像回答站在该地点的用户一样作答，结果以 `location` 返回同一地点。 |
| `include.rawResponse` | 否 | 设为 `true` 时以 `rawContent` 附带结果页 HTML。页面很大，常接近 1 MB。 |

## 响应

例如某个查询的第 2 页：

```json theme={"theme":"css-variables"}
{
  "organicResults": [
    { "position": 11, "title": "...", "link": "https://...", "displayedLink": "...", "snippet": "...", "page": 2 }
  ],
  "peopleAlsoAsk": [{ "...": "..." }],
  "relatedSearches": [{ "...": "..." }],
  "ads": [{ "...": "..." }],
  "page": 2
}
```

| 字段 | 说明 |
| - | - |
| `organicResults` | 始终存在。`position` 跨页累计，因此第 2 页的第一条结果是 `11`。每行都带有它所在的 `page`。 |
| `page` | 实际加载的页码。 |
| `peopleAlsoAsk`、`relatedSearches`、`knowledgeGraph` | 页面展示时返回的 Google 面板。 |
| `ads` | 页面展示时返回的顶部和底部广告。 |
| `map` | 本地结果包：页面展示时返回的地点，包含 `name`、`position`、`placeId`、`location`、`mapsUrl`、`reviews` 等字段。 |
| `serp` | 存在时返回的其他面板：`topStories`、`videoResults`、`localMap`、`discussionsAndForums`。 |
| `location` | 你发送的地点（如有发送）。 |
| `rawContent` | 结果页 HTML，需设置 `include.rawResponse: true`。 |

页面未展示的面板会被省略，而不是返回 `null` 或 `[]`。除 `organicResults` 和 `page` 外，请把每个字段都当作可选字段。响应中没有 `aioverview`、`text` 或 `sources`；如需 AI 概览，请使用 [`GOOGLE`](/zh/engines/google-ai-overviews)。

## 限制与错误

* 已完成任务中的 `organicResults` 为空，表示 Google 本身没有为该查询返回结果。返回前会在第二个浏览器上确认。
* `page` 超出 1-10 时返回 `422 VALIDATION_ERROR`。
* 格式错误的 `location` 返回 `400 VALIDATION_ERROR`。
* 其他请求错误见[错误](/zh/concepts/errors.md)。

## 相关内容

* [Google AI 概览](/zh/engines/google-ai-overviews.md)：带 AI 概览的同一页面
* [网页抓取](/zh/engines/web-scrape.md)：以 Markdown 读取结果页面
* [地区与位置](/zh/engines/capacity.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.