主题
Yahoo 实时自然结果 SERP 接口
GET /v3/appendix/errors
本接口使用 POST 方法,路径为:
POST https://api.seermartech.cn/v3/serp/wp/organic/live/regular
实时获取指定、搜索引擎位置、语言和设备条件下的搜索结果页面(SERP)数据。请求体使用 UTF-8 编码的 JSON 数组格式。平台限流以认证说明中的 30/60/120 次/分钟规则为准。
计费说明
每次请求都会产生费用。解析深度越高、抓取页数越多,可能产生更多 SERP 抓取费用。
参考价约 ¥0.0216 / 次,扣费以响应头 X-SeerMarTech-Charge-CNY 为准。
> depth 与 max_crawl_pages 会影响抓取的 SERP 数量。由于单个 Yahoo SERP 可能少于 10 条结果,增加解析深度可能触发额外计费。
请求参数
请求体为 JSON 数组,数组中只能一个任务对象:
| 参数 | 类型 | 填 | 说明 |
|---|---|---|---|
url | string | 否 | 搜索查询的完整 URL。指定后,本平台会从 URL 中解析、语言、位置等字段。该方式处理复杂度较高,且在 URL 中明确指定语言和位置,通常不建议使用。示例:https://search.yahoo.com/search?p=rank+checker&n=100&vl=lang_en&vc=us&ei=UTF-8 |
keyword | string | 是 | 搜索,最长 700 个字符。请求中的 %## 编码会被解码,+ 会被解码为空格。若中需要使用 %,请写为 %25;需要使用字面量 + 时,请写为 %2B。 |
location_name | string | 条件填 | 搜索引擎位置的完整名称。未指定 location_code 或 location_coordinate 时填。使用该参数后,无需再指定另外两个位置参数。示例:London,England,United Kingdom |
location_code | integer | 条件填 | 搜索引擎位置代码。未指定 location_name 或 location_coordinate 时填。示例:2840 |
location_coordinate | string | 条件填 | 位置 GPS 坐标,格式为 latitude,longitude,radius。纬度和经度最多支持 7 位小数;radius 最小值为 199.9,最大值为 199999。示例:53.476225,-2.243572,200 |
language_name | string | 条件填 | 搜索引擎语言的完整名称。未指定 language_code 时填。示例:English |
language_code | string | 条件填 | 搜索引擎语言代码。未指定 language_name 时填。示例:en |
device | string | 否 | 设备类型,可选值:desktop、mobile。默认值:desktop。 |
os | string | 否 | 操作系统。device=desktop 时可选 windows、macos,默认值为 windows;device=mobile 时可选 android、ios,默认值为 android。 |
se_domain | string | 否 | 搜索引擎域名。默认,本平台会根据位置和语言自动选择合适的域名,也可以手动指定,例如:au.search.yahoo.com、uk.search.yahoo.com、ca.search.yahoo.com。 |
depth | integer | 否 | SERP 解析深度,即需要获取的结果数量。默认值:6;最大值:200。该值越大,可能抓取更多 SERP 并产生额外费用。 |
max_crawl_pages | integer | 否 | 最多抓取的搜索结果页数。默认值:1;最大值:100。该参数与 depth合使用。 |
target | string | 否 | 目标域名、子域名或网页,用于筛选结果。域名或子域名不能 https:// 和 www.。目标任务只返回 url 字段的 SERP素。 |
search_param | string | 否 | 搜索查询的附加参数。 |
stop_crawl_on_match | array | 否 | 停止抓取条件数组,最多 10 个目标对象。每个对象 match_type 和 match_value。当抓取结果匹指定条件时,返回截至该结果为止的 SERP 数据。 |
tag | string | 否 | 自定义任务标识,最长 255 个字符。该值会原样返回在响应任务的 data 对象中,便于请求和结果。 |
位置参数说明
location_name、location_code 和 location_coordinate 三只能选择一个使用。
可通过以下接口获取可用搜索位置:
GET https://api.seermartech.cn/v3/serp/wp/locations
可通过以下接口获取可用搜索语言:
GET https://api.seermartech.cn/v3/serp/wp/languages
target 匹规则
example.com:返回主页结果,例如https://example.com、https://www.example.com/。example.com*:返回该域名下所有页面。*example.com*:返回该域名及子域名下的所有页面。*example.com:匹不限定子域名的主页。example.com/example-page:匹指定 URL。example.com/example-page*:匹以指定字符串开头的 URL。
stop_crawl_on_match 参数
示例:
json
"stop_crawl_on_match": [
{
"match_type": "domain",
"match_value": "example.com"
}
]match_type 支持以下值:
| 值 | 说明 |
|---|---|
domain | 匹指定域名或子域名 |
with_subdomains | 匹主域名及所有子域名 |
wildcard | 按通符模式匹 |
match_value 为填字段,可填写目标域名、子域名或通符模式。域名不能请求协议,例如:
json
"match_value": "example.com"json
"match_value": "/blog/post-*"请求示例
curl
bash
curl --location --request POST \
"https://api.seermartech.cn/v3/serp/wp/organic/live/regular" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json" \
--data-raw '[
{
"language_code": "en",
"location_code": 2840,
"keyword": "albert einstein",
"device": "desktop",
"os": "windows"
}
]'Python
python
import requests
url = "https://api.seermartech.cn/v3/serp/wp/organic/live/regular"
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
}
payload = [
{
"language_code": "en",
"location_code": 2840,
"keyword": "albert einstein",
"device": "desktop",
"os": "windows",
}
]
response = requests.post(url, headers=headers, json=payload)
if response.status_code == 200:
result = response.json()
print(result)
else:
print(f"HTTP 错误:{response.status_code}")
print(response.text)TypeScript
typescript
import axios from "axios";
const response = await axios.post(
"https://api.seermartech.cn/v3/serp/wp/organic/live/regular",
[
{
language_code: "en",
location_code: 2840,
keyword: "albert einstein",
device: "desktop",
os: "windows",
},
],
{
headers: {
Authorization: "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
},
}
);
console.log(response.data);响应字段
接口返回 JSON 对象 tasks 数组。
顶层响应字段
| 字段 | 类型 | 说明 |
|---|---|---|
version | string | 当前 API 版本 |
status_code | integer | 通用状态码。成功通常为 20000。 |
status_message | string | 通用状态消息 |
time | string | 请求执行耗时,例如 0.3059 sec. |
cost | float | 平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。 |
tasks_count | integer | tasks 数组中的任务总数 |
tasks_error | integer | tasks 数组中返回错误的任务数 |
tasks | array | 任务结果数组 |
任务字段
| 字段 | 类型 | 说明 |
|---|---|---|
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 | SERP 结果数组 |
result 字段
| 字段 | 类型 | 说明 |
|---|---|---|
keyword | string | 请求中的。返回值中的 %## 会被解码,+ 会被解码为空格。 |
type | string | 搜索引擎类型 |
se_domain | string | 实使用的搜索引擎域名 |
location_code | integer | 位置代码 |
language_code | string | 语言代码 |
check_url | string | 实搜索结果页面 URL,可用于核验返回结果 |
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 结果数组 |
item_types 可能以下值:
featured_snippet:精选摘要images:图片结果local_pack:本地结果hotels_pack:结果organic:自然结果paid:付费结果people_also_ask:用户也问了related_searches:搜索shopping:购物结果recipes:菜谱结果top_stories:热门新闻video:视频结果ai_overview:AI 摘要
此接口主要提供 organic、paid 和 featured_snippet 类型的数据。若需要获取 SERP 中的及丰富摘要,可使用对应的高级 SERP 接口。
spell 字段
当搜索引擎对进行了自动纠错时,spell 对象会纠正后的和纠错类型。
| 字段 | 类型 | 说明 |
|---|---|---|
keyword | string | 搜索引擎纠正后的,结果对应纠正后的 |
type | string | 自动纠错类型,可能为 including_results_for |
items素字段
自然结果通常以下字段:
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 结果类型,通常为 organic |
rank_group | integer | 同类型结果中的组排名 |
rank_absolute | integer | 在整个 SERP 中的绝对排名 |
page | integer | 结果所在的搜索结果页码 |
domain | string | 结果域名 |
title | string | 结果标题 |
description | string | 结果描述 |
url | string | 结果 URL |
breadcrumb | string | 面屑路径 |
rank_group 表示相同 type素之间的排名;不同类型之间的相对位置应以 rank_absolute 为准。
响应示例
json
{
"version": "0.1.20200129",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.3059 sec.",
"cost": 0.003,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"id": "01234567-89ab-cdef-0123-456789abcdef",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.2800 sec.",
"cost": 0.003,
"result_count": 1,
"path": [
"v3",
"serp",
"wp",
"organic",
"live",
"regular"
],
"data": {
"api": "serp",
"function": "live",
"se": "wp",
"se_type": "organic",
"language_code": "en",
"location_code": 2840,
"keyword": "flight ticket new york san francisco",
"tag": "tag1",
"device": "desktop",
"os": "windows"
},
"result": [
{
"keyword": "flight ticket new york san francisco",
"type": "organic",
"se_domain": "search.yahoo.com",
"location_code": 2840,
"language_code": "en",
"check_url": "https://search.yahoo.com/search?p=flight+ticket+new+york+san+francisco",
"datetime": "2019-11-15 12:57:46 +00:00",
"spell": null,
"refinement_chips": null,
"item_types": [
"organic",
"paid",
"images"
],
"se_results_count": 85600000,
"pages_count": 1,
"items_count": 2,
"items": [
{
"type": "organic",
"rank_group": 1,
"rank_absolute": 1,
"page": 1,
"domain": "example.com",
"title": "Flight tickets from New York to San Francisco",
"description": "Compare available flight tickets and routes.",
"url": "https://example.com/flights",
"breadcrumb": "example.com › flights"
}
]
}
]
}
]
}状态码与错误处理
请根据响应中的 status_code 和 status_message 判断请求及任务是否成功:
- 顶层
status_code=20000:请求处理成功。 tasks_error大于0:至少有一个任务处理失败。- 任务级
status_code可与顶层状态码不同,应逐个检查tasks中的任务状态。 - 发生错误时,应记录
id、status_code、status_message和请求参数,便于重试与排查。
完整错误码可参考:/v3/appendix/errors
实用场景
- 监控自然排名:按指定国家、城市、语言和设备实时获取 Yahoo 搜索结果,评估 SEO 项目的排名表现。
- 对比桌面端与移动端 SERP:分别提交不同
device和os参数,识别移动端与桌面端搜索结果差异,指导页面和优化。 - 分析竞争对手可见度:通过
target筛选竞争对手域名及页面,统计在目标中的出现位置和结果数量。 - 追踪区域化搜索表现:使用
location_code或 GPS 坐标获取本地化 SERP,支持本地 SEO 和多地区市场分析。 - 控制大规模抓取成本:使用
stop_crawl_on_match在发现目标域名或页面后停止继续抓取,在满足监控条件的同时减少无效 SERP 请求。