主题
获取百度自然搜索高级结果(按任务 ID)
GET /v3/serp/baidu/organic/task_get/advanced/{id}
接口说明
用于根据任务 ID 获取百度自然搜索(Organic)SERP 的高级结果。
请求方式:
GET请求地址:https://api.seermartech.cn/v3/serp/baidu/organic/task_get/advanced/$id
该接口在任务创建后用于获取结果,不会重复计费。任务结果在生成后的 30 天 可随时获取。
计费说明
账户在创建任务时扣费,后续在 30 天通过本接口获取同一任务结果****。
扣费以响应头 X-SeerMarTech-Charge-CNY 为准。
路径参数
| 字段 | 类型 | 说明 |
|---|---|---|
id | string | 任务唯一标识,UUID 格式。可在任务创建后 30 天用于获取结果。 |
沙箱说明
如需查看该接口可能返回的 SERP 特性及扩展,可调用沙箱地址:
https://sandbox.seermartech.cn/v3/serp/baidu/organic/task_get/advanced/00000000-0000-0000-0000-000000000000
沙箱返回的是示例结构和模拟数据,不会扣费。
返回结构
API 返回 JSON 对象,顶层 tasks 数组。
顶层字段
| 字段 | 类型 | 说明 |
|---|---|---|
version | string | 当前 API 版本 |
status_code | integer | 通用状态码,建议对异常状态进行统一处理 |
status_message | string | 通用状态信息 |
time | string | 执行耗时,单位秒 |
cost | float | 本次请求总成本,单位 USD |
tasks_count | integer | tasks 数组中的任务数量 |
tasks_error | integer | tasks 数组中返回错误的任务数 |
tasks | array | 任务数组 |
tasks[] 字段
| 字段 | 类型 | 说明 |
|---|---|---|
id | string | 任务 ID,UUID 格式 |
status_code | integer | 任务状态码,通常范围 10000-60000 |
status_message | string | 任务状态信息 |
time | string | 任务执行耗时,单位秒 |
cost | float | 任务成本,单位 USD |
result_count | integer | result 数组数量 |
path | array | URL 路径 |
data | object | 与创建任务时一致的请求参数 |
result | array | 结果数组 |
result[] 字段
| 字段 | 类型 | 说明 |
|---|---|---|
keyword | string | 创建任务时的;返回时会对 %## 进行解码,+ 会被解码为空格 |
type | string | 搜索引擎类型,对应 POST 任务中的 type |
se_domain | string | 搜索引擎域名 |
location_code | integer | 地区编码 |
language_code | string | 语言编码 |
check_url | string | 搜索结果直达链接,可用于校验结果准确性 |
datetime | string | 结果抓取时间,UTC 格式:yyyy-mm-dd hh-mm-ss +00:00 |
spell | object | 搜索引擎自动纠错信息 |
refinement_chips | object | 搜索细化标签;百度结果中通常为 null |
item_types | array | 当前 SERP 中的结果类型 |
se_results_count | integer | SERP 总结果数 |
pages_count | integer | 抓取到的结果页数 |
items_count | integer | items 数组中的数量 |
items | array | SERP 中的结果 |
spell 字段
当搜索引擎对进行了自动纠错时返回。
| 字段 | 类型 | 说明 |
|---|---|---|
keyword | string | 纠错后的 |
type | string | 纠错类型 |
spell.type 可能值:
did_you_meanshowing_results_forno_results_found_forincluding_results_for
item_types 可能值
imageslocal_packmaporganicpaidrelated_searchesvideostocks_boxdictionaryshopping
items素说明
items 中会按 SERP 结构返回不同类型的结果。以下为主要类型说明。
organic 自然结果
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 organic |
rank_group | integer | 同类型结果中的组排名 |
rank_absolute | integer | SERP部中的绝对排名 |
page | integer | 所在搜索结果页码 |
position | string | 在页面中的位置:left、right |
xpath | string | 素 XPath |
domain | string | 结果域名 |
title | string | 标题 |
url | string | 结果链接 |
cache_url | string | 页面缓存链接 |
related_search_url | string | 相似搜索链接 |
breadcrumb | string | 面屑 |
website_name | string | 网站名称 |
is_image | boolean | 是否图片 |
is_video | boolean | 是否视频 |
is_featured_snippet | boolean | 是否为精选摘要 |
is_malicious | boolean | 是否被标记为恶意 |
is_web_story | boolean | 是否为 Web Story |
description | string | 结果描述 |
pre_snippet | string | 描述前附加信息 |
extended_snippet | string | 描述后附加信息 |
images | array | 结果中的图片信息 |
amp_version | boolean | 是否有 AMP 版本 |
rating | object | 评分信息 |
price | object | 价格信息 |
highlighted | array | 描述中加粗高亮的词 |
links | array | 站点链接(sitelinks),无则为 null |
faq | object | FAQ 扩展,无则为 null |
extended_people_also_search | array | 扩展搜索 |
about_this_result | object | 结果说明信息;百度始终为 null |
related_result | array | 同域名结果 |
timestamp | string | 发布时间,UTC 格式 |
rectangle | object | 结果区域坐标信息;百度当前始终为 null |
organic.images[]
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 images_element |
alt | string | 图片 alt 文本 |
url | string | 页面 URL |
image_url | string | 图片地址;原图不可用时可能返回平台存储地址 |
organic.rating
| 字段 | 类型 | 说明 |
|---|---|---|
rating_type | string | 评分类型:Max5、Percents、CustomMax |
value | integer / float | 评分值 |
votes_count | integer | 评价数量 |
rating_max | integer | 当前评分制最大值 |
organic.price
| 字段 | 类型 | 说明 |
|---|---|---|
current | float | 当前价格 |
regular | float | 原价 |
max_value | float | 最高价格 |
currency | string | 币种 ISO 代码 |
is_price_range | boolean | 是否为价格区间 |
displayed_price | string | SERP 中展示的原始价格文本 |
organic.links[]
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 link_element |
title | string | 站点链接标题 |
description | string | 链接描述 |
url | string | 站点链接 URL |
organic.faq
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 faq_box |
items | array | FAQ 项列表 |
organic.faq.items[]
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 faq_box_element |
title | string | 问题标题 |
description | string | 下拉答案 |
links | array | FAQ部链接 |
organic.about_this_result
百度中该字段始终为 null。若平台后续支持,可能以下字段:
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 about_this_result_element |
url | string | 结果 URL |
source | string | 附加信息来源 |
source_info | string | 来源说明 |
source_url | string | 来源链接 |
language | string | 结果语言 |
location | string | 地区 |
search_terms | array | 命中的搜索词 |
related_terms | array | 词 |
organic.related_result[]
该结构与自然结果相近,表示主结果摘要中展示的同域名页面。
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 related_result |
xpath | string | 素 XPath |
domain | string | 域名 |
title | string | 标题 |
url | string | URL |
cache_url | string | 缓存页 URL |
related_search_url | string | 相似搜索 URL |
breadcrumb | string | 面屑 |
is_image | boolean | 是否图片 |
is_video | boolean | 是否视频 |
description | string | 描述 |
pre_snippet | string | 描述前附加信息 |
extended_snippet | string | 描述后附加信息 |
images | array | 图片信息 |
amp_version | boolean | 是否有 AMP 版本 |
rating | object | 评分信息 |
price | object | 价格信息 |
highlighted | array | 高亮词 |
about_this_result | object | 百度始终为 null |
timestamp | string | 发布时间 |
search_terms | array | 命中的搜索词 |
related_terms | array | 词 |
rectangle
百度当前暂不支持在建任务时启用 calculate_rectangles,因此 rectangle 字段始终为 null。若后续支持,结构如下:
| 字段 | 类型 | 说明 |
|---|---|---|
x | integer | 左上角 x 坐标 |
y | integer | 左上角 y 坐标 |
width | integer | 宽度(像素) |
height | integer | 高度(像素) |
paid 付费结果
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 paid |
rank_group | integer | 同类型组排名 |
rank_absolute | integer | 绝对排名 |
page | integer | 页码 |
position | string | left 或 right |
xpath | string | 素 XPath |
domain | string | 广告结果域名 |
description | string | 描述 |
title | string | 标题 |
url | string | 广告链接 |
breadcrumb | string | 面屑 |
highlighted | array | 高亮词 |
extra | object | 额外信息 |
description_rows | array | 扩展描述,无则为 null |
links | array | 广告附加链接 |
rectangle | object | 坐标信息;百度当前始终为 null |
paid.extra
| 字段 | 类型 | 说明 |
|---|---|---|
ad_aclk | string | 广告标识 |
paid.links[]
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 link_element |
title | string | 链接标题 |
description | string | 链接描述 |
url | string | 链接 URL |
ad_aclk | string | 广告标识 |
related_searches 搜索
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 related_searches |
rank_group | integer | 同类型组排名 |
rank_absolute | integer | 绝对排名 |
page | integer | 页码 |
position | string | left 或 right |
xpath | string | 素 XPath |
items | array | 搜索项,无则为 null |
rectangle | object | 坐标信息;百度当前始终为 null |
local_pack 本地结果
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 local_pack |
rank_group | integer | 同类型组排名 |
rank_absolute | integer | 绝对排名 |
page | integer | 页码 |
position | string | left 或 right |
xpath | string | 素 XPath |
title | string | 标题 |
description | string | 描述 |
domain | string | 域名 |
phone | string | 电话号码 |
url | string | 链接 |
is_paid | boolean | 是否为付费结果 |
rating | object | 评分信息 |
cid | string | 本地商户唯一 ID |
rectangle | object | 坐标信息;百度当前始终为 null |
map 地图结果
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 map |
rank_group | integer | 同类型组排名 |
rank_absolute | integer | 绝对排名 |
page | integer | 页码 |
position | string | left 或 right |
xpath | string | 素 XPath |
title | string | 标题 |
url | string | 链接 |
rectangle | object | 坐标信息;百度当前始终为 null |
video 视频结果
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 video |
rank_group | integer | 同类型组排名 |
rank_absolute | integer | 绝对排名 |
page | integer | 页码 |
position | string | left 或 right |
xpath | string | 素 XPath |
items | array | 视频子项 |
rectangle | object | 坐标信息;百度当前始终为 null |
video.items[]
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 video_element |
source | string | 视频来源 |
title | string | 标题 |
timestamp | string | 发布时间,UTC 格式 |
url | string | 视频链接 |
images 图片结果
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 images |
rank_group | integer | 同类型组排名 |
rank_absolute | integer | 绝对排名 |
page | integer | 页码 |
position | string | left 或 right |
xpath | string | 素 XPath |
title | string | 标题 |
url | string | 链接 |
items | array | 图片子项 |
rectangle | object | 坐标信息;百度当前始终为 null |
images.items[]
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 images_element |
alt | string | 图片 alt 文本 |
url | string | 原始图片 URL |
image_url | string | 百度 SERP 中的图片预览 URL |
stocks_box 股票信息卡片
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 stocks_box |
rank_group | integer | 同类型组排名 |
rank_absolute | integer | 绝对排名 |
page | integer | 页码 |
position | string | left 或 right |
xpath | string | 素 XPath |
title | string | 标题 |
source | string | 信息来源 |
snippet | string | 摘要信息 |
price | string | 抓取时的股价/报价 |
url | string | 链接 |
domain | string | 域名 |
rectangle | object | 坐标信息;百度当前始终为 null |
table | object | 表格数据,无则为 null |
graph | object | 图表数据 |
stocks_box.table
| 字段 | 类型 | 说明 |
|---|---|---|
table_header | array | 列名,无则为 null |
table_content | array | 表格,无则为 null |
stocks_box.graph
| 字段 | 类型 | 说明 |
|---|---|---|
items | array | 当前时间段图表点数据 |
previous_items | array | 上一收盘周期图表点数据 |
stocks_box.graph.items[] / previous_items[]
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 graph_element |
date | string | 时间,ISO 8601:yyyy-mm-ddThh:mm:ss |
value | integer | 对应时间点的股价/收盘价 |
dictionary 词/翻译结果
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 dictionary |
rank_group | integer | 同类型组排名 |
rank_absolute | integer | 绝对排名 |
page | integer | 页码 |
position | string | left 或 right |
xpath | string | 素 XPath |
title | string | 标题 |
url | string | 结果链接 |
domain | string | 域名 |
breadcrumb | string | 面屑 |
keyword | string | 结果中高亮的 |
snippet | string | 摘要 |
text | boolean / string | 结果描述文本 |
links | array | 站点链接,无则为 null |
rectangle | object | 坐标信息;百度当前始终为 null |
shopping 购物结果
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 shopping |
rank_group | integer | 同类型组排名 |
rank_absolute | integer | 绝对排名 |
page | integer | 页码 |
position | string | left 或 right |
xpath | string | 素 XPath |
title | string | 标题 |
items | array | 商品子项 |
rectangle | object | 坐标信息;百度当前通常为 null |
shopping.items[]
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 shopping_element |
title | string | 商品标题 |
price | object | 商品价格信息 |
source | string | 信息来源 |
description | string | 商品描述 |
marketplace | string | 商家平台,如 by Baidu |
marketplace_url | string | 平台商品页链接 |
url | string | 商品链接 |
rectangle | object | 坐标信息 |
shopping.items[].price
| 字段 | 类型 | 说明 |
|---|---|---|
current | float | 当前价格 |
regular | float | 原价 |
max_value | float | 最高价格 |
currency | string | 币种 ISO 代码 |
is_price_range | boolean | 是否为价格区间 |
displayed_price | string | 原始价格展示文本 |
认证方式
所有示例统一使用 Bearer Token:
Authorization: Bearer smt_live_YOUR_KEY
请求示例
cURL
bash
id="02261816-2027-0066-0000-c27d02864073"
curl --location --request GET "https://api.seermartech.cn/v3/serp/baidu/organic/task_get/advanced/${id}" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json"Python
python
import requests
task_id = "02261816-2027-0066-0000-c27d02864073"
url = f"https://api.seermartech.cn/v3/serp/baidu/organic/task_get/advanced/{task_id}"
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
data = response.json
print(data)TypeScript
typescript
const taskId = '02231256-2604-0066-2000-57133b8fc54e';
const response = await fetch(
`https://api.seermartech.cn/v3/serp/baidu/organic/task_get/advanced/${taskId}`,
{
method: 'GET',
headers: {
'Authorization': 'Bearer smt_live_YOUR_KEY',
'Content-Type': 'application/json'
}
}
);
const result = await response.json;
console.log(result);结合 tasks_ready 获取已完成任务
接时,通常查询已完成任务,再按返回的任务 ID 或高级结果地址拉取。
Python 示例
python
import requests
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json"
}
# 1. 获取已完成的百度自然搜索任务
ready_url = "https://api.seermartech.cn/v3/serp/baidu/organic/tasks_ready"
ready_resp = requests.get(ready_url, headers=headers)
ready_data = ready_resp.json
results = []
if ready_data.get("status_code") == 20000:
for task_group in ready_data.get("tasks", []):
for task_item in task_group.get("result", []):
# 2. 按 endpoint_advanced 拉取高级结果
endpoint = task_item.get("endpoint_advanced")
if endpoint:
full_url = f"https://api.seermartech.cn{endpoint}"
resp = requests.get(full_url, headers=headers)
results.append(resp.json)
# 3. 或按任务 ID 拉取
# task_id = task_item.get("id")
# if task_id:
# url = f"https://api.seermartech.cn/v3/serp/baidu/organic/task_get/advanced/{task_id}"
# resp = requests.get(url, headers=headers)
# results.append(resp.json)
print(results)TypeScript 示例
typescript
const headers = {
'Authorization': 'Bearer smt_live_YOUR_KEY',
'Content-Type': 'application/json'
};
// 1. 获取已完成任务
const readyResponse = await fetch(
'https://api.seermartech.cn/v3/serp/baidu/organic/tasks_ready',
{
method: 'GET',
headers
}
);
const readyData = await readyResponse.json;
const results: any[] = [];
if (readyData.status_code === 20000) {
for (const taskGroup of readyData.tasks || []) {
for (const taskItem of taskGroup.result || []) {
// 2. 使用高级结果地址获取
if (taskItem.endpoint_advanced) {
const detailResponse = await fetch(
`https://api.seermartech.cn${taskItem.endpoint_advanced}`,
{
method: 'GET',
headers
}
);
results.push(await detailResponse.json);
}
// 3. 或直接按任务 ID 获取
// if (taskItem.id) {
// const detailResponse = await fetch(
// `https://api.seermartech.cn/v3/serp/baidu/organic/task_get/advanced/${taskItem.id}`,
// { method: 'GET', headers }
// );
// results.push(await detailResponse.json);
// }
}
}
}
console.log(results);响应示例
json
{
"version": "0.1.20210129",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.1110 sec.",
"cost": 0,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"data": {
"api": "serp",
"function": "task_get",
"se": "baidu",
"se_type": "organic",
"language_code": "zh_CN",
"location_code": 2156,
"keyword": "我附近的餐",
"priority": 2,
"device": "desktop",
"os": "windows"
},
"result": [
{
"se_results_count": 100000000,
"pages_count": 1,
"items_count": 104,
"items": [
{
"type": "map",
"rank_group": 1,
"rank_absolute": 1,
"page": 1,
"position": "left",
"xpath": "/body/div/div/div/div/div",
"title": "香港特别行政区地图_百度地图",
"url": "http://www.baidu.com/link?url=ZZ7nek3xVIa5HWn4gNzdoRGkLNqGsX5Syb42it5YCMPTQV_cVHIJsK7BxQJojvYBqP5tpHen59nHqM9PdmR3Fd3TL92etbtdj8iJjc61Hs4TQpg8iG4NhkME6WlBwVzWEUjDH9bj-kfVvvujBqOcXe-ZyweDKp38rAwrKrlUveYoBgn-U-lplag5cuyGkcQNnj8FjZf82BaQhDqcK__9c_",
"rectangle": null
},
{
"type": "local_pack",
"rank_group": 1,
"rank_absolute": 2,
"page": 1,
"position": "left",
"xpath": null,
"title": "A 鲁西南老牌坊特色 餐 (省体店)",
"description": "¥81起\n192条评论 地址:山东省济南市市中区民生大街68号",
"domain": "www.baidu.com",
"phone": "0531-82070315",
"url": "http://www.baidu.com/link?url=8dF4xGRj-2pSCCMGHNyBlfIVHw9ovX-asHcA-OwRb0isspC7CyLZwtGtDKUIrqS1bLwH7L4wGA9KxfdXDFQofMM9hdAr17TaYQmEjy5xVt6xbjHM9yN2IyP4asPDRRrpm1RFlOXaoljz3CpgEVo0WLFbAJYzC42HGY7DitYtFOuvI-h8r040xB3dHUVdYWuMlRINctMd0G0GSqZD2EmD8OA1ie-YmQuKpmkDKgYEfcxqqaR3wi0l6uNzzi1iLwCu",
"is_paid": false,
"rating": null,
"cid": null,
"rectangle": null
},
{
"type": "organic",
"rank_group": 1,
"rank_absolute": 3,
"page": 1,
"position": "left",
"xpath": "/html/body/div/div/div/div/div",
"domain": "www.baidu.com",
"title": "离我最近的24小时餐饮 - 百度知道",
"url": "http://www.baidu.com/link?url=UTxRWr9JWaHHxwv3aUpWQupKoLJ34LSRqd7ojs96S21mZhcGHzS2o1B8-jfgmSIRv78er06Q6SN49rO5G6Fds-9VysuWJxTcv2w9S-oeTU3",
"cache_url": "http://cache.baiducontent.com/c?m=k8D_sPXid14sCxjoyAYJ_-4HVl48T0JV-xV-Gh-Z4jlU345oLxZPvpsKYH1-0O2sP6-18x_P553RUYsNXqp64iE9LwU5YoTISNleNCt6m46dQ7nIeppvsBUtJAD0tIOc6zmm1vRj4s2LckJWzQ1MwO-YSPgM1t0FAeanEGgWOp-GuqXlhzoNnGSuxd3X4Xdm&p=882a9645dd955de00da2c7710f00cf&newp=9c769a47978259b304bd9b7d0d1d8b23161cda386a848d0a3b8fd12594664f171c0ba7ec67634b598fca786c00af4c58e8f33575300727b59acf8e40d6afd4456edf653b2740d00053cb05f3&s=cfcd208495d565ef&user=baidu&fm=sc&query=%CE%D2%B8%BD%BD%FC%B5%C4%B2%CD%CC%FC&qid=ab930d34001180f3&p1=2",
"breadcrumb": "百度知道",
"is_image": true,
"is_video": false,
"is_featured_snippet": false,
"is_malicious": false,
"is_web_story": false,
"description": "最佳答案: 找一个离我近 的饭店 营业时间凌晨两点前.new-pmd .c-abstract br{display: none;}\n更多我附近的餐的问题>>",
"pre_snippet": null,
"extended_snippet": null,
"amp_version": false,
"rating": null,
"highlighted": [],
"links": null,
"faq": null,
"extended_people_also_search": null,
"timestamp": null,
"rectangle": null
}
]
}
]
}
]
}错误处理建议
请至少处理以下几类:
- 顶层
status_code非20000 tasks_error大于0tasks[].status_code为错误状态tasks[].result为空- 任务 30 天,结果不可再获取
- 请求的
id不存在或格式不合法
详细错误码请参考 /v3/appendix/errors。
使用建议
- 通过创建任务接口创建百度自然搜索任务。
- 轮询
/v3/serp/baidu/organic/tasks_ready获取已完成任务。 - 使用
endpoint_advanced或本接口按id获取详细结果。 - 根据
item_types判断 SERP 中了哪些模块。 - 解析
items数组时,按type分支处理不同结构。
实用场景
- 监控自然排名:按定期抓取百度自然结果,跟踪目标页面的
rank_absolute变化,评估 SEO 优化效果。 - 识别 SERP 版位结构:分析
item_types与items,判断是否触发地图、本地、图片、视频、购物等模块,帮助制定更适合的策略。 - 分析竞品形式:提取竞品在自然结果、付费广告、站点链接、FAQ 等位置的展示方式,制定页面结构和投放策略。
- 挖掘本地搜索机会:针对餐饮、门店、服务类解析
local_pack、map、phone、cid等字段,评估本地流量和商户。 - 构建搜索结果特征库:沉淀
title、description、breadcrumb、rating、price、highlighted等字段,支持后续 CTR 研究、摘要生成分析和 SERP 变化预警。