主题
SERP 实时常规结果
本接口通过实时抓取,返回指定、搜索引擎、语言和地理位置下的搜索结果页面(SERP)数据。
请求方法与路径:
text
POST https://api.seermartech.cn/v3/serp/wp/organic/live/regular请求体使用 UTF-8 编码的 JSON 数组格式。平台限流以认证说明中的 30/60/120 次/分钟规则为准。
计费说明
本接口按任务请求计费。depth、max_crawl_pages 和高级抓取控制参数可能影响扣费:
- 每个最多 10 条结果的 SERP 页面按一次抓取计费。
depth大于 10 时,如果搜索引擎返回 10 条结果,可能产生额外费用。- 使用
max_crawl_pages时,每抓取一个结果页都会计费。 - 使用
stop_crawl_on_match时,在满足条件前抓取的每个 SERP 页面都会计费。 - 当
keyword含高级搜索操作符时,单个任务费用可能按 5 倍计算。
扣费以响应头 X-SeerMarTech-Charge-CNY 为准。
请求参数
主要参数
| 参数 | 类型 | 填 | 说明 |
|---|---|---|---|
keyword | string | 是 | 查询,最多 700 个字符。接口会解码 %## 编码,字符 + 会被解码为空格。若中需要使用 %,请写成 %25;需要使用 +,请写成 %2B。如果 allinanchor:、allintext:、allintitle:、allinurl:、cache:、define:、filetype:、id:、inanchor:、info:、intext:、intitle:、inurl:、link: 或 site: 等操作符,任务费用可能按 5 倍计算。 |
location_code | integer | 条件填 | 搜索引擎位置代码。未指定 location_name 或 location_coordinate 时填。使用该参数后,不应同时指定另外两个位置参数。可通过 /v3/serp/google/locations 获取可用位置列表。例如:2840。 |
language_code | string | 条件填 | 搜索引擎语言代码。未指定 language_name 时填。使用该参数后,不应同时指定 language_name。可通过 /v3/serp/google/languages 获取可用语言列表。例如:en。 |
depth | integer | 否 | SERP 解析深度,即需要返回的结果数量。默认值为 10,最大值为 200。 |
device | string | 否 | 设备类型,可选值为 desktop、mobile。默认值为 desktop。 |
附加参数
| 参数 | 类型 | 填 | 说明 |
|---|---|---|---|
location_name | string | 条件填 | 搜索引擎位置的完整名称。未指定 location_code 或 location_coordinate 时填。示例:London,England,United Kingdom。 |
language_name | string | 条件填 | 搜索引擎语言的完整名称。未指定 language_code 时填。示例:English。 |
os | string | 否 | 设备操作系统。device=desktop 时可选 windows、macos,默认 windows;device=mobile 时可选 android、ios,默认 android。 |
tag | string | 否 | 自定义任务标识,最多 255 个字符。该值会原样返回在响应的 data 对象中,可用于请求与结果。 |
stop_crawl_on_match | array | 否 | 停止抓取条件数组,最多 10 个目标对象。每个对象 match_type 和 match_value。满足条件时,响应将截至目标结果(该结果)的 SERP 数据。 |
match_type | string | 条件填 | stop_crawl_on_match 中目标的匹方式:domain 表示指定域名或子域名;with_subdomains 表示主域名及子域名;wildcard 表示通符模式。 |
match_value | string | 条件填 | 要匹的域名、子域名或通符值。域名不得请求协议。例如:example.com、/blog/post-*。 |
max_crawl_pages | integer | 否 | 最大抓取 SERP 页数,最大值为 100。每抓取一页都会计费,每页通常 10 条自然结果。该参数与 depth合使用。 |
search_param | string | 否 | 搜索请求的参数。部分搜索参数不受支持,若传以下参数将被自动移除:lr、cr、as_qdr、as_sitesearch、as_occt、as_filetype。 |
group_organic_results | boolean | 否 | 是否将结果作为父级自然结果的摘要返回。true:作为父级结果的摘要;false:作为独立自然结果返回。默认值为 true。 |
url | string | 否 | 搜索请求的完整 URL。接口会从 URL 中解析、语言和位置等参数。该方式处理复杂,在 URL 中提供准确的语言和位置信息,通常不建议使用。URL 中的 lr、cr、as_qdr、as_sitesearch、as_occt、as_filetype 参数会被自动移除。 |
location_coordinate | string | 条件填 | 地理位置坐标,格式为 纬度,经度,半径。纬度和经度最多 7 位小数;半径最小值为 199 毫米,最大值为 199999 毫米。例如:53.476225,-2.243572,200。 |
se_domain | string | 否 | 搜索引擎域名。接口通常根据位置和语言自动选择,也可以手动指定,例如 google.co.uk、google.com.au、google.de。 |
target | string | 否 | 目标域名、子域名或网页,用于筛选 SERP 结果。域名或子域名不得 https:// 和 www.。也支持使用 * 通符。 |
target_search_mode | string | 否 | 多个抓取目标的匹模式。只有启用 stop_crawl_on_match 时才生效。all:所有目标都找到后停止;any:任一目标找到后停止。默认值为 any。 |
find_targets_in | array | 否 | 指定在哪些 SERP素中查找目标。只有启用 stop_crawl_on_match 时才生效。不能与 ignore_targets_in含相同类型。 |
ignore_targets_in | array | 否 | 指定不参与目标匹的 SERP素类型。只有启用 stop_crawl_on_match 时才生效。不能与 find_targets_in含相同类型。 |
find_targets_in 和 ignore_targets_in 支持以下类型:
text
organic
paid
local_pack
featured_snippet
events
google_flights
images
jobs
knowledge_graph
local_service
map
scholarly_articles
third_party_reviews
twittertarget 通符示例
target 值 | 匹范围 |
|---|---|
example.com | 网站首页,例如 https://example.com 或 https://www.example.com/ |
example.com* | 该域名下的所有页面 |
*example.com* | 该域名及所有页面和子域名 |
*example.com | 不限子域名的网站首页,例如 https://en.example.com |
example.com/example-page | 完匹指定 URL |
example.com/example-page* | 匹以指定路径开头的所有 URL |
请求示例
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"
}
]'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",
}
]
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/organic/live/regular",
[
{
language_code: "en",
location_code: 2840,
keyword: "albert einstein",
device: "desktop",
},
],
{
headers: {
Authorization: "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
},
}
);
// 处理响应数据
console.log(response.data);响应说明
接口返回 JSON 数据,顶层 tasks 数组。
顶层响应字段
| 字段 | 类型 | 说明 |
|---|---|---|
version | string | 当前 API 版本。 |
status_code | integer | 请求总体状态码。完整错误码请参考 /v3/appendix/errors。 |
status_message | string | 请求总体状态信息。 |
time | string | 请求执行耗时,单位为秒。 |
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 结果数组。 |
SERP 结果字段
| 字段 | 类型 | 说明 |
|---|---|---|
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 | 搜索细化选项。 |
item_types | array | 当前 SERP 中检测到的结果类型。 |
se_results_count | integer | SERP 中的结果总数。 |
pages_count | integer | 实获取的 SERP 页数。 |
items_count | integer | items 数组中的结果数量。 |
items | array | SERP 结果项数组。 |
spell 字段
当搜索引擎对进行了自动纠错时,返回纠正后的及纠错类型。
| 字段 | 类型 | 说明 |
|---|---|---|
keyword | string | 搜索引擎纠正后的,结果对应此。 |
type | string | 纠错类型。可选值:did_you_mean、showing_results_for、no_results_found_for、including_results_for。 |
refinement_chips 字段
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 refinement_chips。 |
xpath | string | 素的 XPath。 |
items | array | 搜索细化项。 |
options | array | 进一步的搜索细化选项。 |
items 中的字段:
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 refinement_chips_element。 |
title | string | 细化项标题。 |
url | string | 含细化参数的搜索 URL。 |
domain | string | SERP 中的域名。 |
options 中的字段:
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 refinement_chips_option。 |
title | string | 选项标题。 |
url | string | 含细化参数的搜索 URL。 |
domain | string | SERP 中的域名。 |
item_types 支持的值
text
answer_box
app
carousel
multi_carousel
featured_snippet
google_flights
google_reviews
third_party_reviews
images
jobs
knowledge_graph
local_pack
hotels_pack
map
organic
paid
people_also_ask
related_searches
people_also_search
shopping
top_stories
twitter
video
events
recipes
top_sights
scholarly_articles
popular_products
questions_and_answers
find_results_on
stocks_box
commercial_units
local_services
google_hotels
math_solver
currency_box
product_considerations
short_videos
refine_products
perspectives
discussions_and_forums
compare_sites
ai_overviewitem_types 会列出当前 SERP 中发现的所有结果类型,但本接口提供以下三类结果项的详细数据:
featured_snippetorganicpaid
如需获取 SERP 特殊结果和富摘要在的完整结果及排名,请使用对应的高级 SERP 接口。
SERP 结果项字段
精选摘要:featured_snippet_element_in_serp
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 featured_snippet。 |
rank_group | integer | 同类型结果中的组排名。不同类型结果不会参与该字段排序。 |
rank_absolute | integer | 在当前 SERP 所有结果中的绝对排名。高级 SERP 特性对应的位置可能被省略。 |
page | integer | 该结果所在的 SERP 页码。 |
domain | string | SERP 中的域名。 |
title | string | 结果标题。 |
description | string | 结果描述。 |
url | string | 结果 URL。 |
breadcrumb | string | 面屑字段,通常为 null。 |
自然结果:organic_element_in_serp
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 organic。 |
rank_group | integer | 同类型结果中的组排名。 |
rank_absolute | integer | 在当前 SERP 所有结果中的绝对排名,高级 SERP 特性位置可能被省略。 |
page | integer | 结果所在的 SERP 页码。 |
domain | string | SERP 中的域名。 |
title | string | 结果标题。 |
description | string | 结果描述。 |
url | string | 结果 URL。 |
breadcrumb | string | SERP 中的面屑信息。 |
付费结果:paid_element_in_serp
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 paid。 |
rank_group | integer | 同类型广告结果中的组排名。 |
rank_absolute | integer | 在当前 SERP 所有结果中的绝对排名,高级 SERP 特性位置可能被省略。 |
page | integer | 广告所在的 SERP 页码。 |
domain | string | 广告结果中的域名。 |
title | string | 广告标题。 |
description | string | 广告描述。 |
url | string | 广告目标 URL。 |
breadcrumb | string | 广告结果中的面屑信息。 |
响应示例
json
{
"version": "0.1.20200129",
"status_code": 20000,
"status_message": "Ok.",
"time": "12.2397 sec.",
"cost": 0.003,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"id": "01234567-89ab-cdef-0123-456789abcdef",
"status_code": 20000,
"status_message": "Ok.",
"time": "12.2397 sec.",
"cost": 0.003,
"result_count": 1,
"path": [
"v3",
"serp",
"wp",
"organic",
"live",
"regular"
],
"data": {
"language_code": "en",
"location_code": 2840,
"keyword": "flight ticket new york san francisco",
"tag": "tag2",
"device": "desktop",
"os": "windows"
},
"result": [
{
"keyword": "flight ticket new york san francisco",
"type": "organic",
"se_domain": "google.com",
"location_code": 2840,
"language_code": "en",
"check_url": "https://www.google.com/search?q=flight+ticket+new+york+san+francisco",
"datetime": "2019-11-15 12:57:46 +00:00",
"item_types": [
"organic",
"paid",
"featured_snippet"
],
"se_results_count": 85600000,
"pages_count": 1,
"items_count": 10,
"items": [
{
"type": "organic",
"rank_group": 1,
"rank_absolute": 1,
"page": 1,
"domain": "example.com",
"title": "示例结果标题",
"description": "示例结果描述。",
"url": "https://example.com/example-page",
"breadcrumb": "example.com › example-page"
}
]
}
]
}
]
}接口状态码和错误信息请参考 /v3/appendix/errors。建议客户端针对 HTTP 错误、任务级错误、时和空结果进行单独处理。
实用场景
- 监测自然排名:按指定国家、城市、语言和设备实时获取自然结果,评估网站在不同搜索环境下的可见度变化。
- 分析竞品 SERP 版位:通过
target和通符筛选竞品域名,统计首页、栏目页及重点页的排名表现。 - 识别付费与自然流量机会:同时读取
organic、paid和featured_snippet结果,制定 SEO 与搜索广告协同策略。 - 执行本地化搜索分析:使用
location_code、location_name或location_coordinate模拟不同地区搜索,发现本地排名差异和区域需求。 - 控制大规模 SERP 抓取成本:结合
stop_crawl_on_match、target_search_mode和max_crawl_pages,在找到目标域名后及时停止抓取,提升竞品监测效率。