主题
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"路径参数
| 参数 | 类型 | 说明 |
|---|---|---|
id | string | 任务唯一标识符,UUID 格式。任务创建后 30 天可使用该 ID 随时获取结果。 |
计费说明
- 在创建任务时计费。
- 任务结果可在任务创建后的 30 天获取。
- 实扣费以响应头
X-SeerMarTech-Charge-CNY为准。 - 响应体中的
cost表示任务成本,金额以平台扣费信息为准。
响应结构
接口返回 JSON 数据 tasks 数组。
顶层字段
| 字段 | 类型 | 说明 |
|---|---|---|
version | string | 当前 API 版本。 |
status_code | integer | 通用响应状态码。建议根据状态码设计异常处理机制。 |
status_message | string | 通用状态说明。 |
time | string | 请求执行耗时,单位为秒。 |
cost | float | 平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。 |
tasks_count | integer | tasks 数组中的任务数量。 |
tasks_error | integer | tasks 数组中返回错误的任务数量。 |
tasks | array | 任务结果数组。 |
tasks 数组中的字段
| 字段 | 类型 | 说明 |
|---|---|---|
id | string | 任务唯一标识符,UUID 格式。 |
status_code | integer | 当前任务的状态码,通常在 10000 至 60000 范围。 |
status_message | string | 当前任务的状态说明。 |
time | string | 当前任务的执行耗时,单位为秒。 |
cost | float | 平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。 |
result_count | integer | result 数组中的数量。 |
path | array | 请求 URL 路径。 |
data | object | 创建任务时提交的参数。 |
result | array | 搜索结果数组。 |
result 数组字段
| 字段 | 类型 | 说明 |
|---|---|---|
keyword | string | 创建任务时提交的。如果创建任务时指定了 alias,此处可能返回 alias。 |
se_domain | string | 创建任务时指定的搜索引擎域名。 |
location_code | string | 创建任务时指定的位置代码。 |
language_code | string | 创建任务时指定的语言代码。 |
check_url | string | Tripadvisor 搜索结果的直接 URL,可用于核验返回数据。 |
datetime | string | 获取结果的时间,UTC 格式:yyyy-mm-dd hh-mm-ss +00:00。例如:2019-11-15 12:57:46 +00:00。 |
item_types | array | 当前结果中的项目类型。可能值:tripadvisor_search_organic。 |
se_results_count | integer | 搜索结果总数。 |
items_count | integer | items 数组中的项目数量。使用创建任务时的 depth 参数可以获取更多结果。 |
items | array | Tripadvisor 商家搜索结果列表。 |
items 数组字段
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 搜索结果类型。可能值:tripadvisor_search_organic。 |
rank_group | integer | 当前项目在相同 type 项目组中的排名。不同类型项目之间不会计算该排名。 |
rank_absolute | integer | 当前项目在搜索结果中的绝对排名。 |
title | string | 商家名称。 |
url_path | string | 商家在 Tripadvisor 上的页面路径。可使用该路径进一步采集该商家的评论数据。 |
is_sponsored | boolean | 是否为赞助展示位。true 表示该项目为付费广告。 |
reviews_count | integer | 评论总数。 |
category | string | 商家或地点类别。 |
price_rate | string | 平均价格等级。 |
rating | object | 用户提交的商家评分。 |
rating.rating_type | string | 评分类型。可能值:Max5。 |
rating.value | float | 当前评分值。 |
rating.votes_count | integer | 评分或反馈数量。 |
rating.rating_max | integer | 评分类型对应的最大值。对于 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_readyPython 示例
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定位商家,为后续评论采集和感分析提供。