Skip to content

SERP 实时常规结果

本接口通过实时抓取,返回指定、搜索引擎、语言和地理位置下的搜索结果页面(SERP)数据。

请求方法与路径:

text
POST https://api.seermartech.cn/v3/serp/wp/organic/live/regular

请求体使用 UTF-8 编码的 JSON 数组格式。平台限流以认证说明中的 30/60/120 次/分钟规则为准。

计费说明

本接口按任务请求计费。depthmax_crawl_pages 和高级抓取控制参数可能影响扣费:

  • 每个最多 10 条结果的 SERP 页面按一次抓取计费。
  • depth 大于 10 时,如果搜索引擎返回 10 条结果,可能产生额外费用。
  • 使用 max_crawl_pages 时,每抓取一个结果页都会计费。
  • 使用 stop_crawl_on_match 时,在满足条件前抓取的每个 SERP 页面都会计费。
  • keyword含高级搜索操作符时,单个任务费用可能按 5 倍计算。

扣费以响应头 X-SeerMarTech-Charge-CNY 为准。

请求参数

主要参数

参数类型说明
keywordstring查询,最多 700 个字符。接口会解码 %## 编码,字符 + 会被解码为空格。若中需要使用 %,请写成 %25;需要使用 +,请写成 %2B。如果 allinanchor:allintext:allintitle:allinurl:cache:define:filetype:id:inanchor:info:intext:intitle:inurl:link:site: 等操作符,任务费用可能按 5 倍计算。
location_codeinteger条件填搜索引擎位置代码。未指定 location_namelocation_coordinate 时填。使用该参数后,不应同时指定另外两个位置参数。可通过 /v3/serp/google/locations 获取可用位置列表。例如:2840
language_codestring条件填搜索引擎语言代码。未指定 language_name 时填。使用该参数后,不应同时指定 language_name。可通过 /v3/serp/google/languages 获取可用语言列表。例如:en
depthintegerSERP 解析深度,即需要返回的结果数量。默认值为 10,最大值为 200
devicestring设备类型,可选值为 desktopmobile。默认值为 desktop

附加参数

参数类型说明
location_namestring条件填搜索引擎位置的完整名称。未指定 location_codelocation_coordinate 时填。示例:London,England,United Kingdom
language_namestring条件填搜索引擎语言的完整名称。未指定 language_code 时填。示例:English
osstring设备操作系统。device=desktop 时可选 windowsmacos,默认 windowsdevice=mobile 时可选 androidios,默认 android
tagstring自定义任务标识,最多 255 个字符。该值会原样返回在响应的 data 对象中,可用于请求与结果。
stop_crawl_on_matcharray停止抓取条件数组,最多 10 个目标对象。每个对象 match_typematch_value。满足条件时,响应将截至目标结果(该结果)的 SERP 数据。
match_typestring条件填stop_crawl_on_match 中目标的匹方式:domain 表示指定域名或子域名;with_subdomains 表示主域名及子域名;wildcard 表示通符模式。
match_valuestring条件填要匹的域名、子域名或通符值。域名不得请求协议。例如:example.com/blog/post-*
max_crawl_pagesinteger最大抓取 SERP 页数,最大值为 100。每抓取一页都会计费,每页通常 10 条自然结果。该参数与 depth合使用。
search_paramstring搜索请求的参数。部分搜索参数不受支持,若传以下参数将被自动移除:lrcras_qdras_sitesearchas_occtas_filetype
group_organic_resultsboolean是否将结果作为父级自然结果的摘要返回。true:作为父级结果的摘要;false:作为独立自然结果返回。默认值为 true
urlstring搜索请求的完整 URL。接口会从 URL 中解析、语言和位置等参数。该方式处理复杂,在 URL 中提供准确的语言和位置信息,通常不建议使用。URL 中的 lrcras_qdras_sitesearchas_occtas_filetype 参数会被自动移除。
location_coordinatestring条件填地理位置坐标,格式为 纬度,经度,半径。纬度和经度最多 7 位小数;半径最小值为 199 毫米,最大值为 199999 毫米。例如:53.476225,-2.243572,200
se_domainstring搜索引擎域名。接口通常根据位置和语言自动选择,也可以手动指定,例如 google.co.ukgoogle.com.augoogle.de
targetstring目标域名、子域名或网页,用于筛选 SERP 结果。域名或子域名不得 https://www.。也支持使用 * 通符。
target_search_modestring多个抓取目标的匹模式。只有启用 stop_crawl_on_match 时才生效。all:所有目标都找到后停止;any:任一目标找到后停止。默认值为 any
find_targets_inarray指定在哪些 SERP素中查找目标。只有启用 stop_crawl_on_match 时才生效。不能与 ignore_targets_in含相同类型。
ignore_targets_inarray指定不参与目标匹的 SERP素类型。只有启用 stop_crawl_on_match 时才生效。不能与 find_targets_in含相同类型。

find_targets_inignore_targets_in 支持以下类型:

text
organic
paid
local_pack
featured_snippet
events
google_flights
images
jobs
knowledge_graph
local_service
map
scholarly_articles
third_party_reviews
twitter

target 通符示例

target匹范围
example.com网站首页,例如 https://example.comhttps://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 数组。

顶层响应字段

字段类型说明
versionstring当前 API 版本。
status_codeinteger请求总体状态码。完整错误码请参考 /v3/appendix/errors
status_messagestring请求总体状态信息。
timestring请求执行耗时,单位为秒。
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 结果数组。

SERP 结果字段

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

spell 字段

当搜索引擎对进行了自动纠错时,返回纠正后的及纠错类型。

字段类型说明
keywordstring搜索引擎纠正后的,结果对应此。
typestring纠错类型。可选值:did_you_meanshowing_results_forno_results_found_forincluding_results_for

refinement_chips 字段

字段类型说明
typestring固定为 refinement_chips
xpathstring素的 XPath。
itemsarray搜索细化项。
optionsarray进一步的搜索细化选项。

items 中的字段:

字段类型说明
typestring固定为 refinement_chips_element
titlestring细化项标题。
urlstring含细化参数的搜索 URL。
domainstringSERP 中的域名。

options 中的字段:

字段类型说明
typestring固定为 refinement_chips_option
titlestring选项标题。
urlstring含细化参数的搜索 URL。
domainstringSERP 中的域名。

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_overview

item_types 会列出当前 SERP 中发现的所有结果类型,但本接口提供以下三类结果项的详细数据:

  • featured_snippet
  • organic
  • paid

如需获取 SERP 特殊结果和富摘要在的完整结果及排名,请使用对应的高级 SERP 接口。

SERP 结果项字段

字段类型说明
typestring固定为 featured_snippet
rank_groupinteger同类型结果中的组排名。不同类型结果不会参与该字段排序。
rank_absoluteinteger在当前 SERP 所有结果中的绝对排名。高级 SERP 特性对应的位置可能被省略。
pageinteger该结果所在的 SERP 页码。
domainstringSERP 中的域名。
titlestring结果标题。
descriptionstring结果描述。
urlstring结果 URL。
breadcrumbstring面屑字段,通常为 null

自然结果:organic_element_in_serp

字段类型说明
typestring固定为 organic
rank_groupinteger同类型结果中的组排名。
rank_absoluteinteger在当前 SERP 所有结果中的绝对排名,高级 SERP 特性位置可能被省略。
pageinteger结果所在的 SERP 页码。
domainstringSERP 中的域名。
titlestring结果标题。
descriptionstring结果描述。
urlstring结果 URL。
breadcrumbstringSERP 中的面屑信息。

付费结果:paid_element_in_serp

字段类型说明
typestring固定为 paid
rank_groupinteger同类型广告结果中的组排名。
rank_absoluteinteger在当前 SERP 所有结果中的绝对排名,高级 SERP 特性位置可能被省略。
pageinteger广告所在的 SERP 页码。
domainstring广告结果中的域名。
titlestring广告标题。
descriptionstring广告描述。
urlstring广告目标 URL。
breadcrumbstring广告结果中的面屑信息。

响应示例

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 和通符筛选竞品域名,统计首页、栏目页及重点页的排名表现。
  • 识别付费与自然流量机会:同时读取 organicpaidfeatured_snippet 结果,制定 SEO 与搜索广告协同策略。
  • 执行本地化搜索分析:使用 location_codelocation_namelocation_coordinate 模拟不同地区搜索,发现本地排名差异和区域需求。
  • 控制大规模 SERP 抓取成本:结合 stop_crawl_on_matchtarget_search_modemax_crawl_pages,在找到目标域名后及时停止抓取,提升竞品监测效率。

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