# 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`
