主题
Bing 实时 SERP HTML
POST /v3/serp/bing/v2/live/html
接口概述
该接口用于实时获取指定在 Bing 搜索结果页中的原始 HTML。你可以基于、搜索地区、语言、设备等条件发起查询,接口将返回搜索结果页对应的 HTML 源码,适合用于页面结构分析、结果复核、SERP 页面存档等场景。
- 请求方式:
POST - 接口地址:
https://api.seermartech.cn/v3/serp/bing/v2/live/html
说明:
- 本接口为实时接口,请求后直接返回结果;
- 每次调用支持提交 1 个任务;
- POST 请求体为 JSON 数组
[{ ... }];- 速率上限:每分钟最多 2000 次调用;
- 实扣费以响应头
X-SeerMarTech-Charge-CNY为准。
计费说明
该接口按请求计费。
如果返回的 SERP 深度不 10 条结果,通常按基础档计费;当 depth 大于 10,且搜索引擎返回了更多结果时,可能产生额外费用。
参考价约 ¥0.0480 / 次 扣费以响应头 X-SeerMarTech-Charge-CNY 为准。
请求参数
主要参数
| 字段名 | 类型 | 说明 |
|---|---|---|
keyword | string | 。填。最长支持 700 个字符。字段中的 %## 会被解码,字符 + 会被解码为空格。如果中需要保留 %,请写为 %25;如果需要保留 +,请写为 %2B。 |
location_code | integer | 搜索地区代码。当未指定 location_name 或 location_coordinate 时填。如果已使用该字段,则无需再传 location_name 或 location_coordinate。可通过 /v3/serp/wp/locations 获取可用地区代码。例如:2840 |
language_code | string | 搜索语言代码。当未指定 language_name 时填。如果已使用该字段,则无需再传 language_name。可通过 /v3/serp/wp/languages 获取可用语言代码。例如:en |
depth | integer | 解析深度,可选。表示需要返回的 SERP 结果数量。默认值:10;最大值:200。当深度 10 时,若搜索引擎返回了更多结果,可能产生额外费用。 |
device | string | 设备类型,可选。可选值:desktop、mobile。默认值:desktop。 |
附加参数
| 字段名 | 类型 | 说明 |
|---|---|---|
location_name | string | 搜索地区完整名称。当未指定 location_code 或 location_coordinate 时填。如果已使用该字段,则无需再传 location_code 或 location_coordinate。可通过 /v3/serp/wp/locations 获取可用地区名称。例如:London,England,United Kingdom |
language_name | string | 搜索语言完整名称。当未指定 language_code 时填。如果已使用该字段,则无需再传 language_code。可通过 /v3/serp/wp/languages 获取可用语言名称。例如:English |
os | string | 设备操作系统,可选。若 device=desktop,可选 windows、macos,默认 windows;若 device=mobile,可选 android、ios,默认 android。 |
tag | string | 自定义任务标识,可选。最长 255 个字符。便于在响应中将结果与业务任务对应。设置后,可在响应的 data 对象中看到该值。 |
stop_crawl_on_match | array | 命中目标即停止抓取的条件数组,可选。最多可传 10 个目标对象。若设置,接口将在返回结果中直到命中 match_value 为止的所有 SERP 结果。按抓取到满足条件前的页面计费。 |
match_type | string | 目标匹类型。在设置 stop_crawl_on_match 时填。可选值:domain(指定域名/子域名)、with_subdomains(主域名及子域名)、wildcard(通符模式)。 |
match_value | string | 目标域名、子域名或通符值。在设置 stop_crawl_on_match 时填。注意:域名或子域名不要带请求协议。例如:"example.com"、"/blog/post-*" |
max_crawl_pages | integer | 抓取页数上限,可选。默认值:1,最大值:100。该参数与 depth合使用,用于控制最多抓取多少页搜索结果。 |
search_param | string | 搜索附加参数,可选。用于透传搜索引擎查询参数。 |
url | string | 直接指定搜索 URL,可选。接口会尝试从 URL 中解析出所需字段。但这种方式对 URL 的语言和地区参数要求较高,处理也更复杂,通常不建议优使用。示例:https://www.bing.com/search?q=rank%20checker&count=50&first=1&setlang=en&cc=US&safesearch=Moderate&FORM=SEPAGE |
location_coordinate | string | 地理坐标,可选。当未指定 location_name 或 location_code 时填。格式为 "latitude,longitude",经纬度最多支持 7 位小数。例如:53.476225,-2.243572 |
stop_crawl_on_match 对象结构
| 字段名 | 类型 | 说明 |
|---|---|---|
match_type | string | 匹类型。可选:domain、with_subdomains、wildcard |
match_value | string | 匹目标值,支持域名、子域名或通符表达式 |
响应结构
接口返回 JSON 数据,顶层 tasks 数组。
顶层字段
| 字段名 | 类型 | 说明 |
|---|---|---|
version | string | 当前 API 版本 |
status_code | integer | 通用状态码,完整错误码可参考 /v3/appendix/errors |
status_message | string | 通用状态信息 |
time | string | 执行耗时,单位秒 |
cost | float | 本次请求总费用,单位 USD |
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 |
result_count | integer | result 数组中的结果数 |
path | array | 请求路径 |
data | object | 与请求体中提交参数一致的对象 |
result | array | 获取结果数组 |
result 数组中的字段
| 字段名 | 类型 | 说明 |
|---|---|---|
keyword | string | 请求中的。返回时 %## 会被解码,+ 会被解码为空格 |
type | string | 请求中的搜索引擎类型 |
se_domain | string | 请求中的搜索引擎域名 |
location_code | integer | 请求中的地区代码 |
language_code | string | 请求中的语言代码 |
datetime | string | 结果获取时间,UTC 格式,示例:2019-11-15 12:57:46 +00:00 |
items_count | integer | items 数组中的结果数量 |
items | array | SERP 结果项数组 |
page | integer | 返回的 HTML 页码序号 |
date | string | HTML 页面抓取时间,格式示例:2019-11-15 12:57:46 +00:00 |
html | string | 搜索结果页原始 HTML |
请求示例
cURL
bash
curl --location --request POST "https://api.seermartech.cn/v3/serp/bing/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/bing/v2/live/html"
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json"
}
data = [
{
"language_code": "en",
"location_code": 2840,
"keyword": "albert einstein"
}
]
response = requests.post(url, headers=headers, json=data)
print(response.json)TypeScript
typescript
import axios from "axios";
async function fetchBingSerpHtml {
const response = await axios.post(
"https://api.seermartech.cn/v3/serp/bing/v2/live/html",
[
{
language_code: "en",
location_code: 2840,
keyword: "albert einstein",
},
],
{
headers: {
Authorization: "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
},
}
);
console.log(response.data);
}
fetchBingSerpHtml;响应示例
json
{
"version": "0.1.20200203",
"status_code": 20000,
"status_message": "Ok.",
"time": "4.7397 sec.",
"cost": 0.003,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"data": {
"api": "serp",
"function": "live",
"se": "bing",
"se_type": "v2",
"language_code": "en",
"location_code": "2840",
"keyword": "albert einstein",
"tag": "tag1",
"device": "desktop",
"os": "windows"
},
"result": [
{
}
]
}
]
}错误处理
建议对以下两层状态进行处理:
- 顶层状态:检查
status_code和status_message,判断整个请求是否成功; - 任务级状态:遍历
tasks数组,检查每个任务的status_code和status_message。
完整错误码与状态说明可参考:/v3/appendix/errors
常见处理建议:
- 当
status_code非成功状态时,记录原始响应并重试或告警; - 当任务级别返回错误时对失败任务做补偿处理;
- 对
cost、time、tasks_error建议纳监控,便于控制成本和稳定性; - 如果使用
stop_crawl_on_match或较大的depth/max_crawl_pages,应特别消耗。
使用说明
- 若只需要获取页面 HTML,使用该接口即可;
- 若你更结构化搜索结果,应考虑使用对应的结构化 SERP 接口;
url方式虽然可用,但更推荐直接传keyword、location_code、language_code等标准字段;depth与max_crawl_pages决定抓取范围,建议按需求控制,不的成本增长。
实用场景
- 抓取搜索结果页原始源码:获取 Bing SERP 的完整 HTML,用于前端结构分析、样式变化监测和页面归档。
- 复核排名采集结果:结合结构化排名数据,对指定的真实展示页面进行人工或程序化复核,提升 SEO 监测准确性。
- 监控 SERP 页面改版:定期保存同一在不同地区或设备下的 HTML,及时发现搜索结果模块布局变化。
- 定位品牌或竞品:合
stop_crawl_on_match,在搜索结果中命中目标域名后停止抓取,降低成本并快速确认位置。 - 分析多设备差异:分别以
desktop和mobile请求同一,比较不同终端下的 Bing 结果页 HTML 结构差异。