Skip to content

Google 图片搜索实时 HTML 结果

POST /v3/serp/google/images/live/html

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

POST https://api.seermartech.cn/v3/serp/google/images/live/html

实时获取指定、搜索引擎及地理位置对应的 Google 图片搜索结果原始 HTML 页面。每个任务最多返回 100 条搜索结果对应的页面。

> 说明:示例中还出现了 /v3/serp/wp/v2/live/html,该路径属于文档示例路径,不作为本接口的调用地址。接口请使用 /v3/serp/google/images/live/html

接口限制与计费

  • 所有请求体使用 UTF-8 编码的 JSON 格式。

  • 请求体是 JSON 数组,例如 [{ ... }]

  • 每次请求只能 1 个任务。 平台限流以认证说明中的 30/60/120 次/分钟规则为准。

  • 系统按任务计费。

  • depth 大于 100 且搜索引擎返回 100 条结果时,可能产生额外费用。

  • 如果 depth 高于返回结果数量,未返回部分的费用会自动退还。

  • 如果 keyword含以下搜索操作符,单个任务费用将按 5 倍计算:

    allinanchor:allintext:allintitle:allinurl:define:filetype:id:inanchor:info:intext:intitle:inurl:link:related:site:

-含 cache: 的查询不受支持,并会返回参数校验错误。

  • 参考价约 ¥0.021 / 次
  • 实扣费以响应头 X-SeerMarTech-Charge-CNY 为准。

请求参数

主要参数

参数类型说明
keywordstring要查询的,最多 700 个字符。百分号编码会被解码,+ 会被解码为空格。若中需要使用 %,请写为 %25;需要使用 +,请写为 %2B
location_codeinteger条件填搜索位置编码。当未提供 location_namelocation_coordinate 时填。指定此参数后,无需再传 location_namelocation_coordinate。可通过 GET /v3/serp/google/locations 获取可用位置编码,例如 2840
language_codestring条件填搜索语言编码。当未提供 language_name 时填。指定此参数后,无需再传 language_name。可通过 GET /v3/serp/google/languages 获取可用语言编码,例如 en
depthinteger解析深度,即需要获取的结果数量。默认值为 100,最大值为 200
location_namestring条件填搜索位置的完整名称。当未提供 location_codelocation_coordinate 时填。例如:London,England,United Kingdom
language_namestring条件填搜索语言的完整名称。当未提供 language_code 时填。例如:English
osstring设备操作系统。本接口提供桌面端结果。可选值:windowsmacos。默认值:windows
tagstring自定义任务标识,最长 255 个字符。该值会原样返回在响应的 data 对象中,可用于请求与结果。
max_crawl_pagesinteger需要抓取的搜索结果页数,最大值为 100。该参数与 depth合使用。
search_paramstring搜索查询的参数。
urlstring搜索查询的完整 URL。平台会从 URL 中解析的查询参数。该方式处理复杂度较高,且在 URL 中指定准确的语言和位置,通常不建议使用。
location_coordinatestring条件填地理位置坐标,格式为 纬度,经度,半径。纬度和经度最多支持 7 位小数;半径最小值为 199.9 米,最大值为 199999 米。例如:53.476225,-2.243572,200
se_domainstring搜索引擎域名。平台通常会根据位置和语言自动选择域名,也可以手动指定,例如:google.co.ukgoogle.com.augoogle.de

参数选择规则

位置参数以下三种方式选择一种:

  • location_code
  • location_name
  • location_coordinate

语言参数以下两种方式选择一种:

  • language_code
  • language_name

例如,以下请求使用美国位置编码和英文语言编码:

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

请求示例

curl

bash
curl --location --request POST \
  "https://api.seermartech.cn/v3/serp/google/images/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/google/images/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, timeout=120)
result = response.json()

if result.get("status_code") == 20000:
    print(result)
else:
    print(
        f"请求失败,错误码:{result.get('status_code')},"
        f"错误信息:{result.get('status_message')}"
    )

TypeScript

typescript
import axios from "axios";

const response = await axios.post(
  "https://api.seermartech.cn/v3/serp/google/images/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 数据,顶层 tasks 数组,每个任务对应一个提交的查询。

顶层字段

字段类型说明
versionstring当前 API 版本。
status_codeinteger请求整体状态码。成功通常为 20000
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请求路径信息。
dataobject本次任务使用的请求参数。
resultarray搜索结果数据。

result 字段

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

items 字段

字段类型说明
pageinteger返回的 HTML 页面序号。
datestringHTML 页面扫描时间,格式为 年-月-日 时:分:秒 +UTC 时差
htmlstring搜索结果页面的原始 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": "01234567-89ab-cdef-0123-456789abcdef",
      "status_code": 20000,
      "status_message": "Ok.",
      "time": "7.7543 sec.",
      "cost": 0.003,
      "result_count": 1,
      "path": [
        "v3",
        "serp",
        "google",
        "images",
        "live",
        "html"
      ],
      "data": {
        "api": "serp",
        "function": "live",
        "se": "google",
        "se_type": "images",
        "language_name": "English",
        "location_name": "United States",
        "keyword": "albert einstein",
        "tag": "tag1",
        "device": "desktop",
        "os": "windows"
      },
      "result": [
        {
          "keyword": "albert einstein",
          "type": "images",
          "se_domain": "google.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": "<html>...</html>"
            }
          ]
        }
      ]
    }
  ]
}

状态码与错误处理

请根据顶层 status_code 和任务级 status_code 判断请求是否成功:

  • 20000:请求或任务处理成功。
  • 状态码:请求或任务处理失败,原因请结合 status_message 判断。

建议客户端同时处理以下异常:

  • HTTP 请求时或网络连接失败。
  • 顶层请求成功但某个任务失败。
  • tasks_error 大于 0
  • 返回结果为空或 items_count 小于预期。
  • HTML解析失败或页面结构发生变化。

错误码可参考:/v3/appendix/errors

实用场景

  • 采集图片搜索结果 HTML:获取指定的原始图片搜索页面,用于构建自有 SERP 解析和监控系统。
  • 监控图片排名变化:按、地区和语言定期抓取图片搜索结果,评估品牌或资产的变化。
  • 分析竞品图片占位:提取竞品在目标下的图片搜索表现,为图片 SEO 和优化提供依据。
  • 验证本地化搜索结果:使用位置编码、坐标和搜索引擎域名模拟不同地区的图片搜索,检查化 SEO置效果。
  • 构建图片 SEO 报告:结合 keywordse_domainlocation_code 和 HTML生成客户排名、竞品及页面结构分析报告。

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