Skip to content

按任务 ID 获取 Google店信息 HTML 结果

本接口使用 GET 方法,通过以下路径按任务 ID 获取 Google Hotels 指定实体的原始 HTML 数据:

GET https://api.seermartech.cn/v3/business_data/google/hotel_info/task_get/html/$id

返回结果为非结构化 HTML,对应任务提交时指定的 hotel_identifier、地点和语言参数。本平台会尽可能准确地模拟目标搜索条件,因此返回结果应与任务创建时对应条件下的搜索结果一致。

你可以访问响应中的 check_url,并建议使用无痕模式进行核验。任务结果自任务创建之日起保留 7 天,期间可重复获取,获取结果本身不额外扣费;扣费以响应头 X-SeerMarTech-Charge-CNY 为准。

请求参数

接口通过 URL 路径传任务 ID,无需请求体。

参数类型说明
idstring任务唯一标识符,UUID 格式。任务创建后 7 天可使用该 ID 随时获取结果。

请求示例

cURL

bash
id="09171517-0696-0242-0000-a96bc1ad0bce"

curl --location --request GET \
  "https://api.seermartech.cn/v3/business_data/google/hotel_info/task_get/html/${id}" \
  --header "Authorization: Bearer smt_live_YOUR_KEY" \
  --header "Content-Type: application/json"

TypeScript

typescript
import axios from "axios";

const taskId = "02231934-2604-0066-2000-570459f04879";

axios({
  method: "get",
  url: `https://api.seermartech.cn/v3/business_data/google/hotel_info/task_get/html/${taskId}`,
  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);
  });

Python

python
import requests

task_id = "09171517-0696-0242-0000-a96bc1ad0bce"
url = f"https://api.seermartech.cn/v3/business_data/google/hotel_info/task_get/html/{task_id}"

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

response = requests.get(url, headers=headers, timeout=60)
response.raise_for_status()

data = response.json()
print(data)

PHP

php
<?php

$taskId = '09171517-0696-0242-0000-a96bc1ad0bce';
$url = 'https://api.seermartech.cn/v3/business_data/google/hotel_info/task_get/html/' . $taskId;

$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer smt_live_YOUR_KEY',
        'Content-Type: application/json',
    ],
]);

$response = curl_exec($ch);

if ($response === false) {
    throw new Exception(curl_error($ch));
}

curl_close($ch);

$result = json_decode($response, true);
print_r($result);

响应结构

接口返回 JSON 数据,顶层 tasks 数组指定任务的执行状态和结果。

顶层字段

字段类型说明
versionstring当前 API 版本。
status_codeinteger通用响应状态码。完整错误码列表请参考错误码文档。
status_messagestring通用响应说明。
timestring接口执行耗时,单位为秒。
costfloat平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。
result_countintegertasks 数组中的任务数量。
tasks_countinteger返回的任务总数。部分响应中可能使用此字段。
tasks_errorintegertasks 数组中执行失败的任务数量。
tasksarray任务结果数组。

tasks 数组字段

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

data 字段

data 中会返回创建任务时提交的参数,例如:

字段类型说明
se_typestring搜索类型,例如 hotel_info
sestring搜索引擎,例如 google
apistring所属 API 分类,例如 business_data
functionstring功能名称,例如 hotel_info
language_codestring语言代码。
location_namestring地点名称。
devicestring设备类型,例如 desktop
osstring操作系统,例如 windows

result 数组字段

字段类型说明
hotel_identifierstring店实体标识符,与创建任务时提交的值一致。例如:CgoI-KWyzenM_MV3EAE
location_codeinteger地点代码,与创建任务时提交的值一致。
language_codestring语言代码,与创建任务时提交的值一致。
check_urlstring搜索结果页面的直接 URL,可用于核验返回结果的准确性。
datetimestring获取结果的时间,采用 UTC 格式:yyyy-mm-dd hh-mm-ss +00:00。例如:2019-11-15 12:57:46 +00:00
items_countintegeritems 数组中的结果数量。
itemsarrayHTML 页面数组。

items 数组字段

字段类型说明
pageinteger返回的 HTML 页面序号。
datestringHTML 页面扫描时间,采用 UTC 格式:yyyy-mm-dd hh-mm-ss +00:00
htmlstringHTML 页面原始。

响应示例

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": "09171517-0696-0242-0000-a96bc1ad0bce",
      "status_code": 20000,
      "status_message": "Ok.",
      "time": "0.1800 sec.",
      "cost": 0,
      "result_count": 1,
      "path": [
        "v3",
        "business_data",
        "google",
        "hotel_info",
        "task_get",
        "html"
      ],
      "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": [
        {
          "hotel_identifier": "CgoI-KWyzenM_MV3EAE",
          "location_code": 2840,
          "language_code": "en",
          "check_url": "https://www.google.com/travel/hotels",
          "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": "<!doctype html><html>...</html>"
            }
          ]
        }
      ]
    }
  ]
}

状态码与异常处理

建议客户端同时检查以下字段:

  • 顶层 status_code:判断 API 请求是否成功。
  • tasks[].status_code:判断指定任务是否成功。
  • status_messagetasks[].status_message:获取错误说明。
  • result:任务成功时通常结果数据;失败时可能为空。

当任务状态码表示失败,或 result 为空时,客户端应记录任务 ID、状态码和状态说明,并根据业务需要执行重试或异常告警。

实用场景

  • 抓取页 HTML:保存指定在特定地点和语言条件下的页面原始,用于后续字段解析与信息归档。
  • 核验搜索展示结果:结合 check_url 对比搜索页面,验证实体匹、地点定位和语言参数是否生效。
  • 构建竞品监测数据集:定期获取目标页面 HTML,分析价格、评分、设施和政策等信息的展示变化。
  • 支持历史页面解析:在任务结果保留期重复获取 HTML,为解析规则调试、数据洗和问题排查提供稳定。
  • 监控页面结构变化:对不同时段返回的 HTML 进行差异比较,及时发现页面模板或字段结构调整。

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