Skip to content

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 为准。

> depthmax_crawl_pages 会影响抓取的 SERP 数量。由于单个 Yahoo SERP 可能少于 10 条结果,增加解析深度可能触发额外计费。

请求参数

请求体为 JSON 数组,数组中只能一个任务对象:

参数类型说明
urlstring搜索查询的完整 URL。指定后,本平台会从 URL 中解析、语言、位置等字段。该方式处理复杂度较高,且在 URL 中明确指定语言和位置,通常不建议使用。示例:https://search.yahoo.com/search?p=rank+checker&n=100&vl=lang_en&vc=us&ei=UTF-8
keywordstring搜索,最长 700 个字符。请求中的 %## 编码会被解码,+ 会被解码为空格。若中需要使用 %,请写为 %25;需要使用字面量 + 时,请写为 %2B
location_namestring条件填搜索引擎位置的完整名称。未指定 location_codelocation_coordinate 时填。使用该参数后,无需再指定另外两个位置参数。示例:London,England,United Kingdom
location_codeinteger条件填搜索引擎位置代码。未指定 location_namelocation_coordinate 时填。示例:2840
location_coordinatestring条件填位置 GPS 坐标,格式为 latitude,longitude,radius。纬度和经度最多支持 7 位小数;radius 最小值为 199.9,最大值为 199999。示例:53.476225,-2.243572,200
language_namestring条件填搜索引擎语言的完整名称。未指定 language_code 时填。示例:English
language_codestring条件填搜索引擎语言代码。未指定 language_name 时填。示例:en
devicestring设备类型,可选值:desktopmobile。默认值:desktop
osstring操作系统。device=desktop 时可选 windowsmacos,默认值为 windowsdevice=mobile 时可选 androidios,默认值为 android
se_domainstring搜索引擎域名。默认,本平台会根据位置和语言自动选择合适的域名,也可以手动指定,例如:au.search.yahoo.comuk.search.yahoo.comca.search.yahoo.com
depthintegerSERP 解析深度,即需要获取的结果数量。默认值:6;最大值:200。该值越大,可能抓取更多 SERP 并产生额外费用。
max_crawl_pagesinteger最多抓取的搜索结果页数。默认值:1;最大值:100。该参数与 depth合使用。
targetstring目标域名、子域名或网页,用于筛选结果。域名或子域名不能 https://www.。目标任务只返回 url 字段的 SERP素。
search_paramstring搜索查询的附加参数。
stop_crawl_on_matcharray停止抓取条件数组,最多 10 个目标对象。每个对象 match_typematch_value。当抓取结果匹指定条件时,返回截至该结果为止的 SERP 数据。
tagstring自定义任务标识,最长 255 个字符。该值会原样返回在响应任务的 data 对象中,便于请求和结果。

位置参数说明

location_namelocation_codelocation_coordinate 三只能选择一个使用。

可通过以下接口获取可用搜索位置:

GET https://api.seermartech.cn/v3/serp/wp/locations

可通过以下接口获取可用搜索语言:

GET https://api.seermartech.cn/v3/serp/wp/languages

target 匹规则

  • example.com:返回主页结果,例如 https://example.comhttps://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 数组。

顶层响应字段

字段类型说明
versionstring当前 API 版本
status_codeinteger通用状态码。成功通常为 20000
status_messagestring通用状态消息
timestring请求执行耗时,例如 0.3059 sec.
costfloat平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。
tasks_countintegertasks 数组中的任务总数
tasks_errorintegertasks 数组中返回错误的任务数
tasksarray任务结果数组

任务字段

字段类型说明
idstring任务唯一标识,UUID 格式
status_codeinteger任务状态码,取值范围通常为 1000060000
status_messagestring任务状态消息
timestring任务执行耗时
costfloat平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。
result_countintegerresult 数组中的数量
patharray请求 URL 路径信息
dataobject创建任务时提交的参数
resultarraySERP 结果数组

result 字段

字段类型说明
keywordstring请求中的。返回值中的 %## 会被解码,+ 会被解码为空格。
typestring搜索引擎类型
se_domainstring实使用的搜索引擎域名
location_codeinteger位置代码
language_codestring语言代码
check_urlstring实搜索结果页面 URL,可用于核验返回结果
datetimestring获取结果的 UTC 时间,格式为 yyyy-mm-dd hh-mm-ss +00:00
spellobject搜索引擎自动纠错信息
refinement_chipsobject搜索细化选项;该接口通常返回 null
item_typesarraySERP 中出现的结果类型
se_results_countintegerSERP 中的结果总数
pages_countinteger实抓取的结果页数
items_countintegeritems 数组中的结果数量
itemsarraySERP 结果数组

item_types 可能以下值:

  • featured_snippet:精选摘要
  • images:图片结果
  • local_pack:本地结果
  • hotels_pack:结果
  • organic:自然结果
  • paid:付费结果
  • people_also_ask:用户也问了
  • related_searches:搜索
  • shopping:购物结果
  • recipes:菜谱结果
  • top_stories:热门新闻
  • video:视频结果
  • ai_overview:AI 摘要

此接口主要提供 organicpaidfeatured_snippet 类型的数据。若需要获取 SERP 中的及丰富摘要,可使用对应的高级 SERP 接口。

spell 字段

当搜索引擎对进行了自动纠错时,spell 对象会纠正后的和纠错类型。

字段类型说明
keywordstring搜索引擎纠正后的,结果对应纠正后的
typestring自动纠错类型,可能为 including_results_for

items素字段

自然结果通常以下字段:

字段类型说明
typestring结果类型,通常为 organic
rank_groupinteger同类型结果中的组排名
rank_absoluteinteger在整个 SERP 中的绝对排名
pageinteger结果所在的搜索结果页码
domainstring结果域名
titlestring结果标题
descriptionstring结果描述
urlstring结果 URL
breadcrumbstring面屑路径

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_codestatus_message 判断请求及任务是否成功:

  • 顶层 status_code=20000:请求处理成功。
  • tasks_error 大于 0:至少有一个任务处理失败。
  • 任务级 status_code 可与顶层状态码不同,应逐个检查 tasks 中的任务状态。
  • 发生错误时,应记录 idstatus_codestatus_message 和请求参数,便于重试与排查。

完整错误码可参考:/v3/appendix/errors

实用场景

  • 监控自然排名:按指定国家、城市、语言和设备实时获取 Yahoo 搜索结果,评估 SEO 项目的排名表现。
  • 对比桌面端与移动端 SERP:分别提交不同 deviceos 参数,识别移动端与桌面端搜索结果差异,指导页面和优化。
  • 分析竞争对手可见度:通过 target 筛选竞争对手域名及页面,统计在目标中的出现位置和结果数量。
  • 追踪区域化搜索表现:使用 location_code 或 GPS 坐标获取本地化 SERP,支持本地 SEO 和多地区市场分析。
  • 控制大规模抓取成本:使用 stop_crawl_on_match 在发现目标域名或页面后停止继续抓取,在满足监控条件的同时减少无效 SERP 请求。

统一入口:官网 · LLM API · 控制台