主题
Google店 HTML 实时采集
接口说明
该接口用于获取指定实体在 Google Hotels 页面上的原始 HTML,返回结果为非结构化页面源码。你可以基于这些 HTML 提取服务说明、地理位置、评分、套设施、评论、图片、价格等信息。
调用时需要提供唯一的 hotel_identifier。该值可通过以下方式获取:
- 使用
/v3/serp/google/organic/overview/的高级结果 - 调用
/v3/business_data/google/hotel_searches/task_post/获取搜索结果
结果会受到所选地点和语言参数的影响,因此不同地区、不同语言下返回的 HTML 可能不同。
接口地址
POST https://api.seermartech.cn/v3/business_data/google/hotel_info/live/html
计费说明
该接口按任务请求计费。扣费以响应头 X-SeerMarTech-Charge-CNY 为准。
请求体需使用 UTF-8 编码的 JSON 格式,且 POST 请求体为 JSON 数组:[{ ... }]。
接口频率上限为:每分钟最多 2000 次 API 调用。
请求参数
以下为任务提交时可用字段说明:
| 字段名 | 类型 | 说明 |
|---|---|---|
hotel_identifier | string | 填。在 Google 搜索体系中的唯一标识。可通过 /v3/serp/google/organic/overview/ 响应中的 hotels素,或 /v3/business_data/google/hotel_searches/task_post/ 获取。示例:ChYIq6SB--i6p6cpGgovbS8wN2s5ODZfEAE |
priority | integer | 可选。任务优级。1 表示普通优级(默认),2 表示高优级。高优级会产生额外费用,扣费以响应头 X-SeerMarTech-Charge-CNY 为准。 |
location_name | string | 当未传 location_code 或 location_coordinate 时填。搜索引擎地区名。传该字段时无需再传 location_code 或 location_coordinate。可通过 /v3/business_data/google/locations 获取支持的地区列表。示例:London,England,United Kingdom |
location_code | integer | 当未传 location_name 或 location_coordinate 时填。搜索引擎地区编码。传该字段时无需再传 location_name 或 location_coordinate。可通过 /v3/business_data/google/locations 获取。示例:2840 |
location_coordinate | string | 当未传 location_name 或 location_code 时填。地点 GPS 坐标,格式为 "latitude,longitude",纬度与经度最多 7 位小数。若使用坐标,系统会按最近城镇执行搜索。示例:53.476225,-2.243572 |
language_name | string | 当未传 language_code 时填。搜索语言名。传该字段时无需再传 language_code。可通过 /v3/business_data/google/languages 获取支持语言。示例:English |
language_code | string | 当未传 language_name 时填。搜索语言代码。传该字段时无需再传 language_name。可通过 /v3/business_data/google/languages 获取支持语言代码。示例:en |
check_in | string | 可选。日期,格式为 "yyyy-mm-dd"。默认使用明天日期。示例:"2019-01-15" |
check_out | string | 可选。离店日期,格式为 "yyyy-mm-dd"。默认使用后天日期。示例:"2019-01-15" |
currency | string | 可选。货币代码。示例:"USD" |
adults | integer | 可选。成人人数。默认值为 2。示例:1 |
children | array | 可选。儿童年龄数组。不传则表示不儿童。若 1 名 14 岁儿童,可传 [14];若 1 名 13 岁儿童和 1 名 8 岁儿童,可传 [13, 8] |
tag | string | 可选。自定义任务标识,最多 255 个字符。可用于结果对账与任务匹;响应中的 data 数组会返回该值。 |
请求示例
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_code": 1023191,
"language_code": "en",
"hotel_identifier": "ChYIq6SB--i6p6cpGgovbS8wN2s5ODZfEAE"
}
]'Python
python
import requests
url = "https://api.seermartech.cn/v3/business_data/google/hotel_info/live/html"
payload = [
{
"location_name": "New York,New York,United States",
"language_name": "English",
"hotel_identifier": "ChYIq6SB--i6p6cpGgovbS8wN2s5ODZfEAE"
}
]
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json)TypeScript
typescript
import axios from "axios";
const payload = [
{
location_name: "New York,New York,United States",
language_name: "English",
hotel_identifier: "ChYIq6SB--i6p6cpGgovbS8wN2s5ODZfEAE"
}
];
axios({
method: "post",
url: "https://api.seermartech.cn/v3/business_data/google/hotel_info/live/html",
headers: {
Authorization: "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json"
},
data: payload
})
.then((response) => {
// 输出接口返回结果
console.log(response.data);
})
.catch((error) => {
console.error(error);
});返回结果说明
接口返回 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 | array | 回显请求中提交的参数 |
result | array | 结果数组 |
result 数组字段
| 字段名 | 类型 | 说明 |
|---|---|---|
keyword | string | 请求中的唯一标识,格式通常为 "hotel_id:$" |
type | string | 结果类型,此接口固定为 "hotel_info" |
se_domain | string | 请求使用的搜索引擎域名 |
location_code | integer | 请求中的地区编码 |
language_code | string | 请求中的语言代码 |
datetime | string | 结果采集时间,UTC 格式:yyyy-mm-dd hh-mm-ss +00:00 |
items_count | integer | items 数组中的结果数量 |
items | array | HTML 页面数组 |
items 数组字段
| 字段名 | 类型 | 说明 |
|---|---|---|
page | integer | 返回 HTML 页面的序号 |
date | string | HTML 抓取时间,UTC 格式:yyyy-mm-dd hh-mm-ss +00:00 |
html | string | 页面原始 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": [
{
"data": {
"se_type": "hotel_info",
"se": "google",
"api": "business_data",
"function": "hotel_info",
"language_code": "en",
"location_name": "New York,New York,United States",
"device": "desktop",
"os": "windows"
},
"result": [
{}
]
}
]
}状态码与错误处理
- 顶层
status_code表示整次请求是否成功 tasks[].status_code表示单个任务的执行状态- 建议同时处理顶层状态与任务级状态,批量请求时部分任务失败而未被发现
- 错误码与状态说明可参考
/v3/appendix/errors
常见处理建议:
- 当顶层
status_code != 20000时,直接判定本次请求失败 - 当顶层成功但
tasks_error > 0时,逐个检查tasks中失败项 - 当返回
items为空时,优检查hotel_identifier、地区、语言、日期等参数是否有效 - 对高频调用场景,建议实现重试、限流和异常日志记录机制
使用说明
hotel_identifier是该接口的核心参数,通常需要通过搜索或 SERP 结果获取- 返回的是 非结构化 HTML,适合需要自行解析页面的场景
- 地区与语言会直接影响页面展示,建议按目标市场分别采集
- 若不指定
check_in与check_out,系统将自动使用默认/离店日期 children字段传递的是儿童年龄数组,而不是人数
实用场景
- 抓取页源码,用于解析服务、设施、评分、评论等信息,构建数据库
- 对比不同地区与语言下的页展示差异,支持化 SEO 与本地化分析
- 监测指定页面价格与房态展示变化,为行业竞品跟踪提供数据依据
- 提取页面评论与套信息,生成落地页摘要或增强型搜索标签
- 验证实体在不同日期、人数条件下的页面输出差异,支持预订转化分析