主题
新闻搜索实时高级结果接口
GET /v3/appendix/errors
POST /v3/serp/wp/news/live/advanced
本接口用于实时获取指定、搜索引擎语言和地理位置下的新闻搜索结果。返回新闻搜索列表、热门报道(Top Stories)、新闻发布时间、来源域名、摘要、图片链接及可选的像素坐标等高级 SERP 数据。
每次请求支持平台限流以认证说明中的 30/60/120 次/分钟规则为准。POST 请求体使用 UTF-8 编码的 JSON 数组格式。
参考价约 ¥0.0432 / 次;depth过 10 且返回 10 条结果时可能产生额外费用。启用 calculate_rectangles: true 时,任务费用将增加至 2 倍。扣费以响应头 X-SeerMarTech-Charge-CNY 为准。
请求地址
text
POST https://api.seermartech.cn/v3/serp/wp/news/live/advanced请求头
http
Authorization: Bearer smt_live_YOUR_KEY
Content-Type: application/json请求参数
###填参数
| 字段 | 类型 | 说明 |
|---|---|---|
keyword | string | 填。搜索,最长 700 个字符。%## 将被解码,+ 会被解码为空格。如需搜索字面量 %,请传 %25;如需搜索字面量 +,请传 %2B。 |
location_code | integer | 未传 location_name 或 location_coordinate 时填。搜索地区代码。使用该字段时无需传地区字段。示例:2840。可通过 GET /v3/serp/wp/locations 查询可用地区。 |
language_code | string | 未传 language_name 时填。搜索语言代码。使用该字段时无需传 language_name。示例:en。可通过 GET /v3/serp/wp/languages 查询可用语言。 |
> keyword含 allinanchor:、allintext:、allintitle:、allinurl:、define:、filetype:、id:、inanchor:、info:、intext:、intitle:、inurl:、link:、related: 或 site: 等搜索运算符时,任务费用将按 5 倍计算。
> 不支持 cache: 运算符的查询,提交后将返回参数校验错误。
可选参数
| 字段 | 类型 | 说明 |
|---|---|---|
depth | integer | 解析深度,即返回的 SERP 结果数量。默认值:10;最大值:200。每 10 条结果为一个计费单位;若请求深度高于结果数,未返回部分会自动退回余额。 |
location_name | string | 搜索地区完整名称。未传 location_code 或 location_coordinate 时填。示例:London,England,United Kingdom。 |
language_name | string | 搜索语言完整名称。未传 language_code 时填。示例:English。 |
os | string | 设备操作系统。接口返回桌面端结果,可选值:windows、macos。默认值:windows。 |
max_crawl_pages | integer | 最多抓取的搜索结果页数,最大值:100。该参数与 depth合使用。 |
search_param | string | 附加搜索参数,用于传递搜索引擎支持的查询参数。 |
calculate_rectangles | boolean | 是否计算搜索结果的像素坐标。默认值:false。设为 true 时任务费用翻倍。 |
browser_screen_width | integer | 浏览器屏幕宽度,默认值:1920。在 calculate_rectangles: true 时生效。 |
browser_screen_height | integer | 浏览器屏幕高度,默认值:1080。在 calculate_rectangles: true 时生效。 |
browser_screen_resolution_ratio | integer | 浏览器屏幕像素比,默认值:1。在 calculate_rectangles: true 时生效。 |
url | string | 搜索结果页完整 URL。平台会尝试解析 URL 中的、语言和地区参数。该方式解析复杂,且在 URL 中明确指定语言和地区,通常不建议使用。 |
location_coordinate | string | 地理坐标。未传 location_code 或 location_name 时填,格式为 "纬度,经度,半径"。纬度、经度最多 7 位小数;半径范围为 199.9 至 199999 毫米。示例:53.476225,-2.243572,200。 |
se_domain | string | 自定义搜索引擎域名。系统会根据地区和语言自动选择域名,也可手动指定,如 google.co.uk、google.com.au 或 google.de。 |
请求示例
curl
bash
curl --request POST "https://api.seermartech.cn/v3/serp/wp/news/live/advanced" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json" \
--data '[
{
"keyword": "android",
"language_code": "en",
"location_code": 2840,
"depth": 20,
"calculate_rectangles": true
}
]'Python
python
import requests
url = "https://api.seermartech.cn/v3/serp/wp/news/live/advanced"
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
}
# 每次实时请求可提交一个任务
payload = [
{
"keyword": "android",
"language_code": "en",
"location_code": 2840,
"depth": 20,
"calculate_rectangles": True,
}
]
response = requests.post(url, headers=headers, json=payload, timeout=60)
response.raise_for_status()
result = response.json()
if result["status_code"] == 20000:
print(result)
else:
print(f'请求失败:{result["status_code"]} - {result["status_message"]}')TypeScript
typescript
import axios from "axios";
const response = await axios.post(
"https://api.seermartech.cn/v3/serp/wp/news/live/advanced",
[
{
keyword: "android",
language_code: "en",
location_code: 2840,
depth: 20,
calculate_rectangles: true,
},
],
{
headers: {
Authorization: "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
},
}
);
console.log(response.data);响应结构
接口返回 JSON 对象,顶层任务执行状态及 tasks 任务数组。
| 字段 | 类型 | 说明 |
|---|---|---|
version | string | 当前 API 版本。 |
status_code | integer | 局状态码。20000 表示请求成功。错误码参考 /v3/appendix/errors。 |
status_message | string | 局状态说明。 |
time | string | 请求执行耗时,单位为秒。 |
cost | float | 平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。 |
tasks_count | integer | tasks 数组中的任务数量。 |
tasks_error | integer | 返回错误的任务数量。 |
tasks | array | 任务结果数组。 |
tasks 任务对象
| 字段 | 类型 | 说明 |
|---|---|---|
id | string | 任务唯一标识符,采用 UUID 格式。 |
status_code | integer | 任务状态码,范围通常为 10000 至 60000。 |
status_message | string | 任务状态说明。 |
time | string | 任务执行耗时。 |
cost | float | 平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。 |
result_count | integer | result 数组中的数量。 |
path | array | 当前请求的 URL 路径信息。 |
data | object | 与请求提交参数对应的任务。 |
result | array | 搜索结果数组。 |
result 结果对象
| 字段 | 类型 | 说明 |
|---|---|---|
keyword | string | 请求。特殊编码会被解码,+ 会转换为空格。 |
type | string | 搜索引擎结果类型。 |
se_domain | string | 实使用的搜索引擎域名。 |
location_code | integer | 实使用的地区代码。 |
language_code | string | 实使用的语言代码。 |
check_url | string | 搜索结果页直达链接,可用于核验结果。 |
datetime | string | 结果获取时间,UTC 格式,例如 2019-11-15 12:57:46 +00:00。 |
spell | object | 搜索引擎自动纠错信息;未发生纠错时可能不存在。 |
refinement_chips | object | 搜索结果页中的搜索细化建议标签。 |
includes_non_news_search_results | boolean | 是否同时非新闻类搜索结果。 |
item_types | array | 当前 SERP 中的结果类型,可 top_stories、news_search。 |
se_results_count | integer | 搜索引擎返回的预估结果总数。 |
items_count | integer | items 数组中的结果数量。 |
items | array | 新闻搜索结果及热门报道模块。 |
spell 自动纠错对象
| 字段 | 类型 | 说明 |
|---|---|---|
keyword | string | 搜索引擎纠正后的。结果基于该返回。 |
type | string | 自动纠错类型:did_you_mean、showing_results_for、no_results_found_for、including_results_for。 |
refinement_chips 搜索细化标签对象
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 refinement_chips。 |
xpath | string | 素在页面中的 XPath。 |
items | array | 细化标签列表。 |
refinement_chips.items 中的字段:
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 refinement_chips_element。 |
title | string | 标签标题。 |
url | string | 带细化参数的搜索 URL。 |
domain | string | SERP 中的域名。 |
options | array | 更进一步的细化选项。 |
options 中的字段:
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 refinement_chips_option。 |
title | string | 细化选项标题。 |
url | string | 带细化参数的搜索 URL。 |
domain | string | SERP 中的域名。 |
news_search 新闻搜索结果对象
当 items[].type 为 news_search 时,字段结构如下:
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 news_search。 |
rank_group | integer | 同类型结果中的组排名。不同类型不计该排名。 |
rank_absolute | integer | 在 SERP素中的绝对排名。 |
xpath | string | 素在页面中的 XPath。 |
domain | string | 新闻结果域名。 |
title | string | 新闻标题。 |
url | string | 新闻页 URL。 |
image_url | string | 新闻图片 URL。原始图片不可用时可能返回平台存储地址。 |
snippet | string | 新闻摘要。 |
time_published | string | null | 新闻发布时间的相对描述。 |
timestamp | string | 新闻发布时间,UTC 格式,例如 2022-01-12 22:07:51 +00:00。 |
rectangle | object | null | 新闻结果在页面中的像素坐标。未启用 calculate_rectangles 时为 null。 |
top_stories 热门报道对象
当 items[].type 为 top_stories 时,字段结构如下:
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 top_stories。 |
rank_group | integer | 同类型中的组排名。 |
rank_absolute | integer | 在 SERP素中的绝对排名。 |
position | string | 素在页面中的对齐位置,目前可为 left。 |
xpath | string | 素在页面中的 XPath。 |
title | string | 热门报道模块标题。 |
items | array | null | 热门报道中的新闻条目;没有子条目时为 null。 |
rectangle | object | null | 模块在页面中的像素坐标;未启用 calculate_rectangles 时为 null。 |
top_stories.items 中的字段:
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 top_stories_element。 |
source | string | 新闻来源名称。 |
domain | string | 新闻来源域名。 |
title | string | 新闻标题。 |
date | string | 相对发布时间,例如 23 hours ago。 |
amp_version | boolean | 是否存在 AMP 页面版本。 |
timestamp | string | 新闻发布时间,UTC 格式。 |
url | string | 新闻页 URL。 |
image_url | string | 新闻图片 URL。 |
rectangle 像素坐标对象
在请求中设置 calculate_rectangles: true 时返回。
| 字段 | 类型 | 说明 |
|---|---|---|
x | integer | 素左上角的 X 轴坐标,屏幕左上角为原点。 |
y | integer | 素左上角的 Y 轴坐标,屏幕左上角为原点。 |
width | integer | 素宽度,单位为像素。 |
height | integer | 素高度,单位为像素。 |
响应示例
json
{
"version": "0.1.20220104",
"status_code": 20000,
"status_message": "Ok.",
"time": "14.2469 sec.",
"cost": 0.006,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"id": "12345678-1234-1234-1234-123456789012",
"status_code": 20000,
"status_message": "Ok.",
"time": "14.1134 sec.",
"cost": 0.006,
"result_count": 1,
"path": [
"v3",
"serp",
"wp",
"news",
"live",
"advanced"
],
"data": {
"api": "serp",
"function": "live",
"se": "google",
"se_type": "news",
"language_name": "English",
"location_name": "United States",
"keyword": "android",
"calculate_rectangles": true,
"device": "desktop",
"os": "windows"
},
"result": [
{
"keyword": "android",
"type": "news",
"se_domain": "google.com",
"location_code": 2840,
"language_code": "en",
"check_url": "https://www.google.com/search?q=android&tbm=nws",
"datetime": "2022-01-13 17:07:51 +00:00",
"includes_non_news_search_results": false,
"item_types": [
"news_search",
"top_stories"
],
"se_results_count": 771000000,
"items_count": 4,
"items": [
{
"type": "news_search",
"rank_group": 1,
"rank_absolute": 1,
"xpath": "/html/body/div/div/div/div/div/div/div/div/div/div",
"domain": "www.eff.org",
"title": "Google 发布 Android 新功能",
"url": "https://www.eff.org/example",
"image_url": "https://api.seermartech.cn/cdn/i/example:0",
"snippet": "新闻搜索结果摘要示例。",
"time_published": null,
"timestamp": "2022-01-12 22:07:51 +00:00",
"rectangle": {
"x": 180,
"y": 182,
"width": 652,
"height": 178
}
},
{
"type": "top_stories",
"rank_group": 1,
"rank_absolute": 2,
"position": "left",
"xpath": "/html/body/div/div/div/div/div/div/div/div/div/g-section-with-header",
"title": "Android 热门报道",
"items": [
{
"type": "top_stories_element",
"source": "示例媒体",
"domain": "example.com",
"title": "Android 标题",
"date": "23 hours ago",
"amp_version": false,
"timestamp": "2022-01-13 12:00:00 +00:00",
"url": "https://example.com/news/android",
"image_url": "https://api.seermartech.cn/cdn/i/example:1"
}
],
"rectangle": {
"x": 180,
"y": 376,
"width": 652,
"height": 325
}
}
]
}
]
}
]
}错误处理
建议同时检查顶层 status_code 与每个任务的 tasks[].status_code:
20000:请求成功。- 非
20000:请求或任务执行失败,应读取对应的status_message获取原因。 - 参数校验失败通常由缺少、地区或语言参数,以及使用不支持的
cache:查询运算符导致。 - 错误码完整定义请参考
/v3/appendix/errors。
实用场景
- 监测品牌新闻:按品牌名、产品名或高管姓名实时查询新闻结果,及时发现媒体报道与舆变化。
- 追踪竞品发布动态:持续检索竞品品牌与产品,识别新品发布、融资、合作或负面事件,为市场策略提供依据。
- 挖掘热点选题:分析
top_stories中的新闻标题、来源和发布时间,发现行业实时热点并指导生产。 - 评估新闻搜索可见性:获取新闻结果的绝对排名、来源域名和摘要,衡量品牌在新闻搜索中的自然表现。
- 优化页面首屏布局:启用
calculate_rectangles获取新闻模块像素坐标,分析热门报道和普通新闻结果对首屏可见区域的占用。