# Serp

> 一页 Google 网页搜索结果：自然结果、广告、AI 概览、「其他人还问了」、相关搜索和知识面板。

网页版：https://okdata.online/zh/docs/objects/serp/

所有平台同一种结构。平台没有的字段为 null，meta.unavailable 会说明原因。用 fields= 只取需要的字段。

| 字段 | 类型 | 说明 |
|---|---|---|
| `query` | string | 搜索词。 |
| `page` | integer | 第几页，从 1 开始。 |
| `total_results` | integer \| null | Google 自己估计的结果数。 |
| `organic` | SerpResult[] | 自然搜索结果，按页面顺序（通常最多 10 条）。 |
| `ads` | SerpAd[] | 页面上的付费结果；没有广告时为空。 |
| `ai_overview` | string \| null | AI 概览的文字（Google 随页面给出的话）；没有或另行加载时为 null。 |
| `related_questions` | string[] | 「其他人还问了」里的问题。 |
| `related_searches` | string[] | 页面底部的「相关搜索」。 |
| `knowledge_panel` | KnowledgePanel \| null | 知识面板：搜索词是 Google 认识的实体时才有，否则为 null。 |
| `ext` | object | 平台特有字段，只在 view=full 时返回。 |

### SerpResult

| 字段 | 类型 | 说明 |
|---|---|---|
| `rank` | integer | 在列表里的位置，从 1 开始。 |
| `title` | string | 标题。 |
| `url` | string | 网页地址。 |
| `displayed_url` | string \| null | Google 在标题下显示的网址。 |
| `source` | string \| null | Google 显示的网站名。 |
| `snippet` | string \| null | Google 在标题下展示的摘要。 |
| `date` | string \| null | Google 在摘要前显示的日期，原样（如「3 days ago」）；没有时为 null。 |

### SerpAd

| 字段 | 类型 | 说明 |
|---|---|---|
| `rank` | integer | 在列表里的位置，从 1 开始。 |
| `position` | string | 在自然结果上方还是下方。 |
| `title` | string | 广告标题。 |
| `url` | string | 广告落地页。 |
| `displayed_url` | string \| null | 广告上显示的网址。 |
| `snippet` | string \| null | 广告文案。 |

### KnowledgePanel

| 字段 | 类型 | 说明 |
|---|---|---|
| `title` | string | 实体名称。 |
| `type` | string \| null | Google 对它的分类。 |
| `description` | string \| null | 面板里的简介。 |
| `website` | string \| null | 实体的官网（Google 给出的话）。 |
| `image_url` | string \| null | 面板里的图片。 |

## 返回 Serp 的接口

- [Google 网页搜索](https://okdata.online/zh/apis/google/search/) (`google.search`): $0.01/次
- [Google 视频搜索](https://okdata.online/zh/apis/google/videos/search/) (`google.videos.search`): $0.008/次
- [Google 学术搜索](https://okdata.online/zh/apis/google/scholar/search/) (`google.scholar.search`): $0.008/次
- [Google 专利搜索](https://okdata.online/zh/apis/google/patents/search/) (`google.patents.search`): $0.008/次

## 各 view 返回的字段

每一级 view 都包含上一级的字段。`view=compact` 最精简；`full` 会在 `ext` 里加上平台特有字段。

- compact：`query`, `page`, `total_results`, `organic`, `ads`, `related_questions`, `related_searches`, `knowledge_panel`
- standard：`ai_overview`
- full：`ext`
