Skip to content

Google店信息 HTML(实时)

POST /v3/business_data/google/hotel_info/live/html

接口概述

POST /v3/business_data/google/hotel_info/live/html

本接口返回指定在 Google Hotels 平台上的非结构化 HTML 数据服务描述、位置、评分、设施、评价、图片、价格等信息。

请求时通过唯一的 hotel_identifier 指定。该标识符可通过以下方式获取:

  • 调用 Google SERP API 高级方法,在响应的 hotels 字段中获取;
  • 调用 Business Data API 的搜索接口 /v3/business_data/google/hotel_searches/task_post/ 获取。

返回结果取决于指定的搜索地区和语言。可用地区和语言分别参考:

  • /v3/business_data/google/locations
  • /v3/business_data/google/languages

请求地址

text
POST https://api.seermartech.cn/v3/business_data/google/hotel_info/live/html

认证方式

请求头统一使用 Bearer Token:

http
Authorization: Bearer smt_live_YOUR_KEY
Content-Type: application/json

计费说明

本接口按任务计费。高优级任务可能产生额外费用。

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

接口调用限制:

平台限流以认证说明中的 30/60/120 次/分钟规则为准;

  • 每次 Live API 调用只能一个任务;
  • 同时执行的请求数最多为 30 个。

所有 POST 请求体使用 UTF-8 编码的 JSON 格式,并且顶层是 JSON 数组:

json
[
  {
    "hotel_identifier": "唯一标识符"
  }
]

请求参数

参数名类型说明
hotel_identifierstringGoogle 搜索中的实体唯一标识符。可通过 Google SERP API 高级方法或搜索接口获取。示例:ChYIq6SB--i6p6cpGgovbS8wN2s5ODZfEAE
priorityinteger任务优级。1:普通优级,默认值;2:高优级。高优级可能产生额外费用。
location_namestring条件填搜索引擎地区的完整名称。当未指定 location_codelocation_coordinate 时填。使用该参数后,无需再传另外两个地区参数。示例:London,England,United Kingdom
location_codeinteger条件填搜索引擎地区代码。当未指定 location_namelocation_coordinate 时填。示例:2840
location_coordinatestring条件填地区 GPS 坐标,格式为 "纬度,经度"。纬度和经度最多支持 7 位小数。使用坐标设置地区时,搜索将在距离该坐标最近的点执行。示例:53.476225,-2.243572
language_namestring条件填搜索结果语言的完整名称。当未指定 language_code 时填。示例:English
language_codestring条件填搜索结果语言代码。当未指定 language_name 时填。示例:en
check_instring住日期,格式为 yyyy-mm-dd。未指定时默认使用明天。示例:2019-01-15
check_outstring退房日期,格式为 yyyy-mm-dd。未指定时默认使用后天。示例:2019-01-15
currencystring价格显示所使用的货币代码。示例:USD
adultsinteger成人数量。未指定时默认为 2。示例:1
childrenarray儿童数量及年龄。不指定时表示不儿童。例如,1 名 14 岁儿童可传 [14];1 名 13 岁儿童和 1 名 8 岁儿童可传 [13, 8]
tagstring用户自定义任务标识符,最长 255 个字符。可用于识别任务并与响应结果匹。提交的值会原样返回在响应的 data 数组中。

地区参数规则

以下三个参数三选一:

  • location_name
  • location_code
  • location_coordinate

以下两个参数二选一:

  • language_name
  • language_code

可通过以下接口获取可用的地区和语言:

text
GET https://api.seermartech.cn/v3/business_data/google/locations
GET https://api.seermartech.cn/v3/business_data/google/languages

请求示例

curl

bash
curl --location --request POST \
  "https://api.seermartech.cn/v3/business_data/google/hotel_info/live/html" \
  --header "Authorization: Bearer smt_live_YOUR_KEY" \
  --header "Content-Type: application/json" \
  --data-raw '[
    {
      "location_name": "New York,New York,United States",
      "language_name": "English",
      "hotel_identifier": "ChYIq6SB--i6p6cpGgovbS8wN2s5ODZfEAE"
    }
  ]'

Python

python
import requests

url = "https://api.seermartech.cn/v3/business_data/google/hotel_info/live/html"

headers = {
    "Authorization": "Bearer smt_live_YOUR_KEY",
    "Content-Type": "application/json",
}

payload = [
    {
        "location_code": 1023191,
        "language_code": "en",
        "hotel_identifier": "ChYIq6SB--i6p6cpGgovbS8wN2s5ODZfEAE",
    }
]

response = requests.post(url, headers=headers, json=payload, timeout=60)
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 payload = [
  {
    location_name: "New York,New York,United States",
    language_name: "English",
    hotel_identifier: "ChYIq6SB--i6p6cpGgovbS8wN2s5ODZfEAE",
  },
];

axios
  .post(
    "https://api.seermartech.cn/v3/business_data/google/hotel_info/live/html",
    payload,
    {
      headers: {
        Authorization: "Bearer smt_live_YOUR_KEY",
        "Content-Type": "application/json",
      },
    }
  )
  .then((response) => {
    // 处理接口返回结果
    console.log(response.data);
  })
  .catch((error) => {
    console.error("请求失败:", error.response?.data || error.message);
  });

响应结构

接口返回 JSON 数据,顶层 tasks 数组。

顶层响应字段

字段名类型说明
versionstring当前 API 版本。
status_codeinteger请求整体状态码。20000 表示成功。
status_messagestring请求整体状态信息。
timestring接口执行耗时,单位为秒。
costfloat平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。
tasks_countintegertasks 数组中的任务数量。
tasks_errorintegertasks 数组中返回错误的任务数量。
tasksarray任务结果数组。

任务字段

字段名类型说明
idstring任务唯一标识符,UUID 格式。
status_codeinteger当前任务状态码,通常为 10000-60000 范围的整数。
status_messagestring当前任务状态信息。
timestring当前任务执行耗时,单位为秒。
costfloat平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。
result_countintegerresult 数组中的数量。
patharray请求 URL 路径。
dataarray提交任务时使用的参数,通常原始请求参数及系统补字段。
resultarray任务结果数组。

result 字段

字段名类型说明
keywordstringhotel_id:$ 格式返回的唯一标识符。
typestring搜索结果类型。本接口固定为 hotel_info
se_domainstring搜索引擎域名。
location_codeinteger请求中使用的地区代码。
language_codestring请求中使用的语言代码。
datetimestring获取结果的日期和时间,UTC 格式:yyyy-mm-dd hh-mm-ss +00:00
items_countintegeritems 数组中的结果数量。
itemsarray返回的 HTML 页面数组。

items 字段

字段名类型说明
pageinteger返回的 HTML 页面序号。
datestringHTML 页面抓取时间,UTC 格式:yyyy-mm-dd hh-mm-ss +00:00
htmlstring页面完整 HTML。

响应示例

json
{
  "version": "0.1.20210430",
  "status_code": 20000,
  "status_message": "Ok.",
  "time": "0.2257 sec.",
  "cost": 0,
  "tasks_count": 1,
  "tasks_error": 0,
  "tasks": [
    {
      "id": "01234567-89ab-cdef-0123-456789abcdef",
      "status_code": 20000,
      "status_message": "Ok.",
      "time": "0.1800 sec.",
      "cost": 0,
      "result_count": 1,
      "path": [
        "v3",
        "business_data",
        "google",
        "hotel_info",
        "live",
        "html"
      ],
      "data": [
        {
          "hotel_identifier": "ChYIq6SB--i6p6cpGgovbS8wN2s5ODZfEAE",
          "language_code": "en",
          "location_name": "New York,New York,United States"
        }
      ],
      "result": [
        {
          "keyword": "hotel_id:ChYIq6SB--i6p6cpGgovbS8wN2s5ODZfEAE",
          "type": "hotel_info",
          "se_domain": "google.com",
          "location_code": 1023191,
          "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</html>"
            }
          ]
        }
      ]
    }
  ]
}

错误处理

建议根据顶层和任务级别的 status_codestatus_message 处理异常:

  • 顶层 status_code:表示本次请求整体状态;
  • 任务级 status_code:表示单个任务的处理状态;
  • tasks_error:表示返回错误的任务数量;
  • result_count0 时,表示当前任务没有可返回的结果。

完整错误码请参考本平台错误码文档。

实用场景

  • 抓取页 HTML,提取介绍、位置、设施和图片等,用于建设信息数据库。
  • 采集价格与条件,结合日期、退房日期、成人和儿童参数,支持价格监测与竞品分析。
  • 对比不同地区和语言下的展示结果,分析本地化搜索页面差异,优化 SEO 和多语言页面。
  • 解析评价与评分,构建品牌口碑监控体系,及时发现评分变化和用户反馈趋势。
  • 保存页面原始 HTML,支持后续自定义解析、字段补和历史页面版本对比。

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