Skip to content

Yahoo SERP 实时 HTML 接口

GET /v3/appendix/errors

本接口使用 POST 方法,请求路径为:

/v3/serp/wp/v2/live/html

该接口用于实时抓取指定、搜索位置、语言和设备对应的搜索结果页原始 HTML。/wp/v2/ 为容路径,请按上述路径调用。

接口信息

  • 请求方法POST
  • 请求地址https://api.seermartech.cn/v3/serp/wp/v2/live/html
  • 请求格式:JSON(UTF-8)
  • 单次请求任务数:1 平台限流以认证说明中的 30/60/120 次/分钟规则为准
  • 计费方式:每个请求单独计费
  • 参考价:扣费以响应头 X-SeerMarTech-Charge-CNY 为准

请求体是 JSON 数组,例如:

json
[
  {
    "language_code": "en",
    "location_code": 2840,
    "keyword": "albert einstein"
  }
]

请求参数

参数类型说明
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.9199999。示例: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 解析深度,即需要返回的结果数量。默认值:10,最大值:200。每页最多 10 条结果按一个 SERP 计费;设置大于 10 的值时,如果搜索引擎返回 10 条结果,可能产生额外费用。
max_crawl_pagesinteger最多抓取的搜索结果页数。默认值:1,最大值:100。该参数与 depth合使用。
search_paramstring搜索查询的参数。
stop_crawl_on_matcharray停止抓取条件数组,最多 10 个目标对象。满足条件后,响应会截至匹目标所在页面的 SERP 结果。系统会已抓取的 SERP 页面计费。

stop_crawl_on_match 对象参数

参数类型说明
match_valuestring要匹的域名、子域名或通符值。域名或子域名不得协议头。示例:example.com/blog/post-*
match_typestring匹类型。可选值:domain(匹指定域名或子域名)、with_subdomains(匹主域名及子域名)、wildcard(匹通符模式)。

示例:

json
[
  {
    "keyword": "seo tools",
    "language_code": "en",
    "location_code": 2840,
    "device": "desktop",
    "depth": 100,
    "max_crawl_pages": 10,
    "stop_crawl_on_match": [
      {
        "match_type": "with_subdomains",
        "match_value": "example.com"
      }
    ]
  }
]

获取位置和语言列表

可通过以下容路径查询可用的搜索位置:

/v3/serp/wp/locations

可通过以下容路径查询可用的搜索语言:

/v3/serp/wp/languages

响应字段

顶层字段

字段类型说明
versionstring当前 API 版本。
status_codeinteger请求级状态码。完整错误码请参考 /v3/appendix/errors
status_messagestring请求级状态信息。
timestring请求执行耗时,单位为秒。
costfloat平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。
tasks_countintegertasks 数组中的任务总数。
tasks_errorintegertasks 数组中执行失败的任务数。
tasksarray任务结果数组。

tasks 字段

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

result 字段

字段类型说明
keywordstring请求中的。返回时会对 %## 进行解码,并将 + 解码为空格。
typestring搜索引擎类型。
se_domainstring实使用的搜索引擎域名。
location_codeinteger搜索位置编码。
language_codestring搜索语言编码。
datetimestring获取结果的日期和时间,UTC 格式:yyyy-mm-dd hh-mm-ss +00:00
items_countintegeritems 数组中的结果数量。
itemsarray搜索结果项数组。
pageinteger返回的 HTML 页面序号。
datestringHTML 页面扫描时间,UTC 格式:yyyy-mm-dd hh-mm-ss +00:00
htmlstring搜索结果页的原始 HTML。

认证方式

请求头使用 Bearer Token:

http
Authorization: Bearer smt_live_YOUR_KEY
Content-Type: application/json

请求示例

cURL

bash
curl --location --request POST \
  "https://api.seermartech.cn/v3/serp/wp/v2/live/html" \
  --header "Authorization: Bearer smt_live_YOUR_KEY" \
  --header "Content-Type: application/json" \
  --data-raw '[
    {
      "language_code": "en",
      "location_code": 2840,
      "keyword": "albert einstein"
    }
  ]'

Python

python
import requests

url = "https://api.seermartech.cn/v3/serp/wp/v2/live/html"

headers = {
    "Authorization": "Bearer smt_live_YOUR_KEY",
    "Content-Type": "application/json",
}

payload = [
    {
        "language_code": "en",
        "location_code": 2840,
        "keyword": "albert einstein",
    }
]

response = requests.post(url, headers=headers, json=payload)
result = response.json()

if result.get("status_code") == 20000:
    print(result)
else:
    print(
        "请求失败,状态码:%s,消息:%s"
        % (result.get("status_code"), result.get("status_message"))
    )

TypeScript

typescript
import axios from "axios";

const response = await axios.post(
  "https://api.seermartech.cn/v3/serp/wp/v2/live/html",
  [
    {
      language_code: "en",
      location_code: 2840,
      keyword: "albert einstein",
    },
  ],
  {
    headers: {
      Authorization: "Bearer smt_live_YOUR_KEY",
      "Content-Type": "application/json",
    },
  },
);

const result = response.data;

if (result.status_code === 20000) {
  console.log(result);
} else {
  console.error(
    `请求失败,状态码:${result.status_code},消息:${result.status_message}`,
  );
}

响应示例

json
{
  "version": "0.1.20200130",
  "status_code": 20000,
  "status_message": "Ok.",
  "time": "7.7543 sec.",
  "cost": 0.0216,
  "tasks_count": 1,
  "tasks_error": 0,
  "tasks": [
    {
      "id": "01234567-89ab-cdef-0123-456789abcdef",
      "status_code": 20000,
      "status_message": "Ok.",
      "time": "7.7000 sec.",
      "cost": 0.0216,
      "result_count": 1,
      "path": [
        "v3",
        "serp",
        "wp",
        "v2",
        "live",
        "html"
      ],
      "data": {
        "api": "serp",
        "function": "live",
        "se": "wp",
        "se_type": "v2",
        "language_code": "en",
        "location_code": 2840,
        "keyword": "albert einstein",
        "tag": "tag1",
        "device": "desktop",
        "os": "windows"
      },
      "result": [
        {
          "keyword": "albert einstein",
          "type": "v2",
          "se_domain": "search.yahoo.com",
          "location_code": 2840,
          "language_code": "en",
          "datetime": "2019-11-15 12:57:46 +00:00",
          "items_count": 1,
          "items": [],
          "page": 1,
          "date": "2019-11-15 12:57:46 +00:00",
          "html": "<!doctype html><html>...</html>"
        }
      ]
    }
  ]
}

如需处理异常,建议同时检查顶层 status_code、任务级 status_codetasks_error 以及响应头 X-SeerMarTech-Charge-CNY

实用场景

  • 抓取指定的 SERP 原始 HTML,还原搜索结果页面结构并支持自定义解析,满足复杂排名监控和结果页面研究需求。
  • 对比桌面端与移动端 SERP 页面,识别不同设备下的排名、模块和页面结构差异,移动 SEO 优化。
  • 按国家、城市或 GPS 坐标采集本地搜索结果,分析地域化排名表现,为本地 SEO 和区域投放提供数据依据。
  • 批量获取不同语言和搜索域名的结果页面,监测跨市场排名及搜索结果差异,支持化 SEO 策略。
  • 使用停止抓取条件控制采集范围,在发现目标域名或子域名后提前结束任务,减少不的页面抓取和费用。

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