Skip to content

business_data/tripadvisor/search/task_get

GET /v3/business_data/tripadvisor/search/tasks_ready

根据任务 ID 获取 Tripadvisor 商家搜索结果

请求方法:GET
请求路径:/v3/business_data/tripadvisor/search/task_get/$id

本接口用于获取通过 Tripadvisor 商家搜索任务采集的结果。返回数据取决于创建任务时提交的、位置、语言、设备及参数。

接口会尽可能还原指定参数下的搜索结果。你可以访问返回结果中的 check_url,并使用无痕模式进行核验。系统不会考虑用户偏好、搜索历史等个性化因素。

请求示例

bash
curl --location --request GET \
  "https://api.seermartech.cn/v3/business_data/tripadvisor/search/task_get/04011058-0696-0199-0000-2196151a15cb" \
  --header "Authorization: Bearer smt_live_YOUR_KEY" \
  --header "Content-Type: application/json"

路径参数

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

计费说明

  • 在创建任务时计费。
  • 任务结果可在任务创建后的 30 天获取。
  • 实扣费以响应头 X-SeerMarTech-Charge-CNY 为准。
  • 响应体中的 cost 表示任务成本,金额以平台扣费信息为准。

响应结构

接口返回 JSON 数据 tasks 数组。

顶层字段

字段类型说明
versionstring当前 API 版本。
status_codeinteger通用响应状态码。建议根据状态码设计异常处理机制。
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请求 URL 路径。
dataobject创建任务时提交的参数。
resultarray搜索结果数组。

result 数组字段

字段类型说明
keywordstring创建任务时提交的。如果创建任务时指定了 alias,此处可能返回 alias
se_domainstring创建任务时指定的搜索引擎域名。
location_codestring创建任务时指定的位置代码。
language_codestring创建任务时指定的语言代码。
check_urlstringTripadvisor 搜索结果的直接 URL,可用于核验返回数据。
datetimestring获取结果的时间,UTC 格式:yyyy-mm-dd hh-mm-ss +00:00。例如:2019-11-15 12:57:46 +00:00
item_typesarray当前结果中的项目类型。可能值:tripadvisor_search_organic
se_results_countinteger搜索结果总数。
items_countintegeritems 数组中的项目数量。使用创建任务时的 depth 参数可以获取更多结果。
itemsarrayTripadvisor 商家搜索结果列表。

items 数组字段

字段类型说明
typestring搜索结果类型。可能值:tripadvisor_search_organic
rank_groupinteger当前项目在相同 type 项目组中的排名。不同类型项目之间不会计算该排名。
rank_absoluteinteger当前项目在搜索结果中的绝对排名。
titlestring商家名称。
url_pathstring商家在 Tripadvisor 上的页面路径。可使用该路径进一步采集该商家的评论数据。
is_sponsoredboolean是否为赞助展示位。true 表示该项目为付费广告。
reviews_countinteger评论总数。
categorystring商家或地点类别。
price_ratestring平均价格等级。
ratingobject用户提交的商家评分。
rating.rating_typestring评分类型。可能值:Max5
rating.valuefloat当前评分值。
rating.votes_countinteger评分或反馈数量。
rating.rating_maxinteger评分类型对应的最大值。对于 Max5,最大值为 5

响应示例

json
{
  "version": "0.1.20220819",
  "status_code": 20000,
  "status_message": "Ok.",
  "time": "0.0855 sec.",
  "cost": 0,
  "tasks_count": 1,
  "tasks_error": 0,
  "tasks": [
    {
      "id": "04011058-0696-0199-0000-2196151a15cb",
      "status_code": 20000,
      "status_message": "Ok.",
      "time": "0.0400 sec.",
      "cost": 0,
      "result_count": 1,
      "path": [
        "v3",
        "business_data",
        "tripadvisor",
        "search",
        "task_get"
      ],
      "data": {
        "se_type": "organic",
        "se": "tripadvisor",
        "api": "business_data",
        "function": "search",
        "keyword": "pizza",
        "location_code": 1003854,
        "depth": 10,
        "device": "desktop",
        "os": "windows"
      },
      "result": [
        {
          "keyword": "pizza",
          "se_domain": "tripadvisor.com",
          "location_code": "1003854",
          "language_code": "en",
          "check_url": "https://www.tripadvisor.com/Search?q=pizza",
          "datetime": "2019-11-15 12:57:46 +00:00",
          "item_types": [
            "tripadvisor_search_organic"
          ],
          "se_results_count": 30,
          "items_count": 1,
          "items": [
            {
              "type": "tripadvisor_search_organic",
              "rank_group": 1,
              "rank_absolute": 1,
              "title": "示例商家",
              "url_path": "/Restaurant_Review-example",
              "is_sponsored": false,
              "reviews_count": 1250,
              "category": "餐",
              "price_rate": "$$ - $$$",
              "rating": {
                "rating_type": "Max5",
                "value": 4.5,
                "votes_count": 1250,
                "rating_max": 5
              }
            }
          ]
        }
      ]
    }
  ]
}

使用已完成任务列表获取结果

你也可以调用以下接口获取已完成任务,再根据返回的任务 ID 调用本接口:

http
GET /v3/business_data/tripadvisor/search/tasks_ready

Python 示例

python
from client import RestClient

# 使用 SeerMarTech API 密钥初始化客户端
client = RestClient("smt_live_YOUR_KEY")

# 获取已完成任务列表
response = client.get(
    "/v3/business_data/tripadvisor/search/tasks_ready"
)

if response == 20000:
    results = []

    for task_group in response:
        if task_group and len(task_group) > 0:
            for task_id in task_group:
                if task_id:
                    # 根据任务 ID 获取任务结果
                    result = client.get(
                        "/v3/business_data/tripadvisor/search/task_get/"
                        + task_id
                    )
                    results.append(result)

    print(results)
else:
    print("请求失败,状态码:%s" % response)

TypeScript 示例

typescript
import axios from "axios";

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

axios({
  method: "get",
  url:
    "https://api.seermartech.cn/v3/business_data/tripadvisor/search/task_get/" +
    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);
  });

PHP 示例

php
<?php

$taskId = '04011058-0696-0199-0000-2196151a15cb';
$url = 'https://api.seermartech.cn/v3/business_data/tripadvisor/search/task_get/' . $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) {
    echo '请求失败:' . curl_error($ch);
} else {
    $result = json_decode($response, true);
    print_r($result);
}

curl_close($ch);

C# 示例

csharp
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;

public class TripadvisorTaskResult
{
    public static async Task GetTaskResult()
    {
        using var httpClient = new HttpClient();

        httpClient.DefaultRequestHeaders.Authorization =
            new AuthenticationHeaderValue(
                "Bearer",
                "smt_live_YOUR_KEY"
            );

        var url =
            "https://api.seermartech.cn/v3/business_data/tripadvisor/search/task_get/" +
            "04011058-0696-0199-0000-2196151a15cb";

        var response = await httpClient.GetAsync(url);
        var content = await response.Content.ReadAsStringAsync();

        if (response.IsSuccessStatusCode)
        {
            Console.WriteLine(content);
        }
        else
        {
            Console.WriteLine(
                $"请求失败,HTTP 状态码:{(int)response.StatusCode}"
            );
            Console.WriteLine(content);
        }
    }
}

沙箱测试

可以使用沙箱环境测试本接口。沙箱响应会返回 Tripadvisor Search 接口支持的项目类型和字段,但字段为模拟数据,使用沙箱不会产生费用。

text
https://api.seermartech.cn/v3/business_data/tripadvisor/search/task_get/00000000-0000-0000-0000-000000000000

实用场景

  • 监控目标城市的商家排名:按和位置获取 Tripadvisor 商家排名,评估门店在本地搜索中的表现。
  • 分析竞争商家的口碑数据:提取商家评分、评论数量和价格等级,支持竞品对比与市场研究。
  • 筛选潜在合作商家:根据类别、评分和评论规模筛选餐、等本地商家,提升商务拓展效率。
  • 核验 SEO 或本地营销效果:定期保存搜索排名和 check_url,对比不同时间点的搜索可见性变化。
  • 联动采集商家评论:利用结果中的 url_path 定位商家,为后续评论采集和感分析提供。

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