主题
WP V2 实时 SERP HTML
POST /v3/serp/google/local_finder/live/html
POST /v3/serp/wp/v2/live/html
本接口实时获取指定、搜索位置、语言及设备条件下的搜索结果原始 HTML 页面。每次请求支持提交 1 个任务,请求体为 UTF-8 编码的 JSON 数组。平台限流以认证说明中的 30/60/120 次/分钟规则为准。
接口地址:
text
https://api.seermartech.cn/v3/serp/wp/v2/live/html接口按请求计费;扣费以响应头 X-SeerMarTech-Charge-CNY 为准。
请求参数
主要参数
| 字段 | 类型 | 填 | 说明 |
|---|---|---|---|
keyword | string | 是 | 搜索,最长 700 个字符。中的 %## 会被解码,+ 会被解码为空格。如需传字面量 %,请使用 %25;如需传字面量 +,请使用 %2B。 |
location_code | integer | 条件填 | 搜索位置代码。未指定 location_name 和 location_coordinate 时填。使用本字段时,无需再传 location_name 或 location_coordinate。可通过 GET /v3/serp/wp/locations 查询可用位置代码,例如:2840。 |
language_code | string | 条件填 | 搜索语言代码。未指定 language_name 时填。使用本字段时,无需再传 language_name。可通过 GET /v3/serp/wp/languages 查询可用语言代码,例如:en。 |
depth | integer | 否 | 解析深度,即期望返回的结果数量。桌面端默认 20、最大 100;移动端默认 10、最大 100。桌面端每 20 条结果、移动端每 10 条结果为一个计费单位;若设置更高深度且返回结果对应数量,可能产生额外费用。若结果少于指定深度,未返回部分会自动退回相应余额。 |
device | string | 否 | 设备类型,可选 desktop 或 mobile,默认 desktop。 |
附加参数
| 字段 | 类型 | 填 | 说明 |
|---|---|---|---|
location_name | string | 条件填 | 搜索位置称。未指定 location_code 和 location_coordinate 时填。使用本字段时,无需传另外两个位置参数。可通过 GET /v3/serp/wp/locations 查询,例如:London,England,United Kingdom。 |
language_name | string | 条件填 | 搜索语言称。未指定 language_code 时填。使用本字段时,无需传 language_code,例如:English。 |
os | string | 否 | 设备操作系统。device 为 desktop 时可选 windows、macos,默认 windows;device 为 mobile 时可选 android、ios,默认 android。 |
tag | string | 否 | 自定义任务标识,最长 255 个字符。该值会原样返回在响应的 data 对象中,可用于业务任务与结果。 |
location_coordinate | string | 条件填 | GPS 坐标。未指定 location_code 和 location_name 时填,格式为 "latitude,longitude,zoom"。未传 zoom 时默认使用 9z;纬度和经度最多 7 位小数;缩放级别范围为 4z 至 18z。示例:52.6178549,-155.352142,20z。 |
min_rating | string | 否 | 按最低评分筛选结果。桌面端可选:3.5、4、4.5;移动端可选:2、2.5、3、3.5、4、4.5。 |
time_filter | string | 否 | 按营业时间筛选地点。搜索引擎仍可能返回不符合该筛选条件的结果。可选值:"open_now"、"24_hours"、"$day_value"、"$day_value;$time_value"。,$day_value 可为 monday 至 sunday;$time_value 可为 00 至 23。示例:"tuesday;18"。 |
请求示例
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",
"device": "desktop",
"depth": 20,
"tag": "serp-html-demo"
}
]'Python
python
import requests
url = "https://api.seermartech.cn/v3/serp/wp/v2/live/html"
# 每次实时请求只能提交一个任务,但请求体为 JSON 数组
payload = [
{
"language_code": "en",
"location_code": 2840,
"keyword": "albert einstein",
"device": "desktop",
"depth": 20,
"tag": "serp-html-demo"
}
]
response = requests.post(
url,
headers={
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json"
},
json=payload,
timeout=60
)
response.raise_for_status()
# 实人民币扣费以响应头为准
charge_cny = response.headers.get("X-SeerMarTech-Charge-CNY")
result = response.json()
print("本次扣费(CNY):", charge_cny)
print(result)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",
device: "desktop",
depth: 20,
tag: "serp-html-demo"
}
],
{
headers: {
Authorization: "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json"
},
timeout: 60000
}
);
// 实人民币扣费以响应头为准
console.log("本次扣费(CNY):", response.headers["x-seermartech-charge-cny"]);
console.log(response.data);响应说明
接口返回 JSON 对象 tasks 数组本次提交任务的执行结果。
顶层字段
| 字段 | 类型 | 说明 |
|---|---|---|
version | string | 当前 API 版本。 |
status_code | integer | 局状态码。建议在业务系统中针对异常状态建立重试、告警或降级处理机制。 |
status_message | string | 局状态说明。 |
time | string | 请求总执行耗时,单位为秒。 |
cost | float | 平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。 |
tasks_count | integer | tasks 数组中的任务总数。 |
tasks_error | integer | 执行失败的任务数量。 |
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 | 本次请求对应的接口路径信息。 |
data | object | 回显提交任务时使用的请求参数 tag。 |
result | array | 搜索结果数组。 |
result 结果字段
| 字段 | 类型 | 说明 |
|---|---|---|
keyword | string | 请求中提交的。特殊编码会被解码,+ 会显示为空格。 |
type | string | 请求中的搜索引擎类型。 |
se_domain | string | 搜索引擎域名。 |
location_code | integer | 请求使用的位置代码。 |
language_code | string | 请求使用的语言代码。 |
datetime | string | 获取结果的 UTC 时间,格式为 yyyy-mm-dd hh:mm:ss +00:00。例如:2019-11-15 12:57:46 +00:00。 |
items_count | integer | items 数组中的结果数量。 |
items | array | SERP 中解析出的搜索结果。 |
page | integer | 返回 HTML 页面的序号。 |
date | string | HTML 页面抓取时间及 UTC 时区偏移。 |
html | string | 搜索结果页面的原始 HTML。 |
响应示例
json
{
"version": "0.1.20200130",
"status_code": 20000,
"status_message": "Ok.",
"time": "7.7543 sec.",
"cost": 0.003,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"id": "00000000-0000-0000-0000-000000000000",
"status_code": 20000,
"status_message": "Ok.",
"time": "7.7543 sec.",
"cost": 0.003,
"result_count": 1,
"path": [
"v3",
"serp",
"wp",
"v2",
"live",
"html"
],
"data": {
"api": "serp",
"function": "live",
"se": "wp",
"se_type": "v2",
"language_name": "English",
"location_name": "United States",
"keyword": "albert einstein",
"tag": "serp-html-demo",
"device": "desktop",
"os": "windows"
},
"result": [
{
"keyword": "albert einstein",
"type": "serp",
"se_domain": "example.com",
"location_code": 2840,
"language_code": "en",
"datetime": "2019-11-15 12:57:46 +00:00",
"items_count": 20,
"items": [],
"page": 1,
"date": "2019-11-15 12:57:46 +00:00",
"html": "<!doctype html><html>...</html>"
}
]
}
]
}错误处理
请同时检查顶层 status_code 和每个任务中的 tasks[].status_code:
20000:请求和任务执行成功。- 状态码:表示请求参数、认证、限流、任务执行或平台数据获取过程中发生异常。
- 当
tasks_error大于0时,应遍历tasks,读取对应任务的status_code与status_message进行针对性处理。 - 对于临时性失败,可根据业务策略进行指数退避重试;对于参数或认证错误,应修正请求后再发起调用。
实用场景
- 存档搜索结果页面:保存在指定地区、语言和设备下的原始 HTML,用于后续审计、页面对比和数据复盘。
- 验证本地搜索可见性:结合坐标、评分和营业时间筛选条件,检查门店或客户在目标区域中的搜索展示。
- 监测竞品页面变化:定期抓取竞争的 SERP HTML,识别本地商家模块、广告位或自然结果结构变化。
- 构建自定义解析规则:获取原始 HTML 后按业务需求提取页面,适排名监控、品牌监测或分析逻辑。
- 分析移动端与桌面端差异:分别指定
mobile和desktop设备,比较不同终端下的结果布局与展示。