主题
按任务 ID 获取 Trustpilot 搜索结果
接口说明
该接口用于根据任务 ID 获取 Trustpilot 搜索任务的结果。返回为与创建任务时提交的 keyword 的商家资料列表。
本接口会尽可能高精度地复现任务创建时指定的搜索参数,因此返回结果通常与对应时间点的搜索结果一致。你也可以通过响应中的 check_url 在浏览器无痕模式下自行核验结果性。
需要注意的是,用户偏好、搜索历史及个性化因素不会被纳采集过程,因此这些因素不会体现在返回结果中。
请求方式
GET https://api.seermartech.cn/v3/business_data/trustpilot/search/task_get/$id
计费说明
在创建任务时扣费,任务结果在后续 30 天 可重复获取。
扣费以响应头 X-SeerMarTech-Charge-CNY 为准。
路径参数
| 参数名 | 类型 | 说明 |
|---|---|---|
id | string | 任务唯一标识,UUID 格式。任务创建后可在 30 天 随时通过该 ID 获取结果。 |
返回数据说明
接口返回 JSON 数据,顶层 tasks 数组。
顶层字段
| 字段名 | 类型 | 说明 |
|---|---|---|
version | string | 当前 API 版本 |
status_code | integer | 通用状态码,完整错误码可参考 /v3/appendix/errors |
status_message | string | 通用状态信息,完整说明可参考 /v3/appendix/errors |
time | string | 执行耗时,单位秒 |
cost | float | 本次请求总成本,单位 USD |
tasks_count | integer | tasks 数组中的任务数量 |
tasks_error | integer | tasks 数组中返回错误的任务数 |
tasks | array | 任务结果数组 |
tasks[] 字段
| 字段名 | 类型 | 说明 |
|---|---|---|
id | string | 任务 ID,UUID 格式 |
status_code | integer | 任务状态码,范围通常为 10000-60000 |
status_message | string | 任务状态信息 |
time | string | 任务执行耗时,单位秒 |
cost | float | 单个任务成本,单位 USD |
result_count | integer | result 数组中的结果数量 |
path | array | 请求路径 |
data | object | 与创建任务时提交参数一致的数据对象 |
result | array | 获取结果数组 |
tasks[].result[] 字段
| 字段名 | 类型 | 说明 |
|---|---|---|
keyword | string | 创建任务时提交的 |
se_domain | string | 创建任务时指定的搜索引擎域名 |
check_url | string | 搜索结果直达链接,可用于校验结果准确性 |
datetime | string | 结果获取时间,UTC 格式:yyyy-mm-dd hh-mm-ss +00:00 |
items_count | integer | 当前结果中的条目数量;如需更多结果,应在创建任务时增大 depth |
items | array | 商家列表结果 |
tasks[].result[].items[] 字段
| 字段名 | 类型 | 说明 |
|---|---|---|
type | string | 结果类型,当前固定为 trustpilot_search_organic |
rank_group | integer | 在相同 type 分组的位置 |
rank_absolute | integer | 在结果中的绝对排名 |
title | string | 商家名称 |
domain | string | 商家域名 |
url | string | 商家页面 URL |
reviews_count | integer | 评论总数 |
rating | object | 商家评分信息 |
rating_type | string | 评分类型,当前为 Max5 |
value | float | 评分值 |
votes_count | integer | 反馈数量,即该商家获得的投票数 |
rating_max | integer | 当前评分类型的最大值;Max5 的最大值为 5 |
Sandbox 调试
你可以通过以下沙箱地址查看该端点支持返回的字段结构,返回数据为模拟值,不会产生费用:
https://api.seermartech.cn/v3/business_data/trustpilot/search/task_get/00000000-0000-0000-0000-000000000000
获取方式说明
通常建议按以下流程使用:
- 创建 Trustpilot 搜索任务;
- 通过
/v3/business_data/trustpilot/search/tasks_ready获取已完成任务列表; - 再通过本接口按任务 ID 拉取详细结果。
请求示例
cURL
bash
id="04011058-0696-0199-0000-2196151a15cb"
curl --location --request GET "https://api.seermartech.cn/v3/business_data/trustpilot/search/task_get/${id}" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json"Python
python
import requests
task_id = "02231934-2604-0066-2000-570459f04879"
url = f"https://api.seermartech.cn/v3/business_data/trustpilot/search/task_get/{task_id}"
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
print(response.status_code)
print(response.json)TypeScript
typescript
const taskId = '02231934-2604-0066-2000-570459f04879';
const response = await fetch(
`https://api.seermartech.cn/v3/business_data/trustpilot/search/task_get/${taskId}`,
{
method: 'GET',
headers: {
'Authorization': 'Bearer smt_live_YOUR_KEY',
'Content-Type': 'application/json',
},
}
);
const result = await response.json;
console.log(result);查询已完成任务后批量获取结果示例
Python
python
import requests
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json"
}
# 1. 获取已完成任务列表
ready_url = "https://api.seermartech.cn/v3/business_data/trustpilot/search/tasks_ready"
ready_resp = requests.get(ready_url, headers=headers).json
results = []
if ready_resp.get("status_code") == 20000:
for task_group in ready_resp.get("tasks", []):
for task_ready in task_group.get("result", []):
endpoint = task_ready.get("endpoint")
task_id = task_ready.get("id")
# 2. 通过 endpoint 直接获取结果
if endpoint:
full_url = f"https://api.seermartech.cn{endpoint}"
task_result = requests.get(full_url, headers=headers).json
results.append(task_result)
# 3. 或通过任务 ID 拼接查询地址
# if task_id:
# full_url = f"https://api.seermartech.cn/v3/business_data/trustpilot/search/task_get/{task_id}"
# task_result = requests.get(full_url, headers=headers).json
# results.append(task_result)
print(results)TypeScript
typescript
const headers = {
'Authorization': 'Bearer smt_live_YOUR_KEY',
'Content-Type': 'application/json',
};
// 1. 获取已完成任务列表
const readyResponse = await fetch(
'https://api.seermartech.cn/v3/business_data/trustpilot/search/tasks_ready',
{
method: 'GET',
headers,
}
);
const readyData = await readyResponse.json;
const taskResponses: any[] = [];
if (readyData.status_code === 20000) {
for (const taskGroup of readyData.tasks || []) {
for (const task of taskGroup.result || []) {
if (task.endpoint) {
// 2. 通过 endpoint 获取单任务结果
const taskGetResponse = await fetch(
`https://api.seermartech.cn${task.endpoint}`,
{
method: 'GET',
headers,
}
);
const taskResult = await taskGetResponse.json;
taskResponses.push(taskResult);
}
// 3. 或通过任务 ID 查询
// if (task.id) {
// const byIdResponse = await fetch(
// `https://api.seermartech.cn/v3/business_data/trustpilot/search/task_get/${task.id}`,
// {
// method: 'GET',
// headers,
// }
// );
// const byIdResult = await byIdResponse.json;
// taskResponses.push(byIdResult);
// }
}
}
}
console.log(taskResponses);响应示例
json
{
"version": "0.1.20220208",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.0752 sec.",
"cost": 0,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"id": "04011058-0696-0199-0000-2196151a15cb",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.0211 sec.",
"cost": 0,
"result_count": 1,
"path": [
"v3",
"business_data",
"trustpilot",
"search",
"task_get",
"04011058-0696-0199-0000-2196151a15cb"
],
"data": {
"se_type": "organic",
"se": "trustpilot",
"api": "business_data",
"function": "search",
"keyword": "pizza restaurant",
"device": "desktop",
"os": "windows"
},
"result": [
{
"keyword": "pizza restaurant",
"se_domain": "trustpilot.com",
"check_url": "https://www.trustpilot.com/search?query=pizza%20restaurant",
"datetime": "2019-11-15 12:57:46 +00:00",
"items_count": 1,
"items": [
{
"type": "trustpilot_search_organic",
"rank_group": 1,
"rank_absolute": 1,
"title": "Example Pizza",
"domain": "example.com",
"url": "https://www.trustpilot.com/review/example.com",
"reviews_count": 1250,
"rating": {
"rating_type": "Max5",
"value": 4.6,
"votes_count": 1250,
"rating_max": 5
}
}
]
}
]
}
]
}状态码说明
| 状态码 | 说明 |
|---|---|
20000 | 请求成功 |
10000-60000 | 任务级状态码范围,处理中、完成、参数错误、额错误等 |
建议在接时对以下场景做好异常处理:
- 顶层
status_code非20000 tasks_error大于 0tasks[].status_code为错误状态tasks[].result为空- 任务 30 天后无法再次获取
使用建议
- 结果获取,但前提是任务已成功创建;
- 如果返回结果条数不足,需在创建任务时提高
depth; - 可结合
check_url进行抽样质检; - 如需批量消费任务结果,建议调用
/v3/business_data/trustpilot/search/tasks_ready再逐个拉取。
实用场景
- 筛选潜在合作品牌:按行业抓取 Trustpilot 商家列表,快速识别评分高、评论量大的潜在合作对象。
- 监控竞品口碑表现:定期查询竞品下的商家排名、评分和评论量,评估品牌声量变化。
- 发现细分市场头部商家:通过如“pizza restaurant”“vpn service”等,定位特定垂类中的高评价商家。
- 构建品牌声誉数据库:将商家标题、域名、评分、评论数等字段库,用于后续舆分析和品牌研究。
- 验证搜索可见性:结合
rank_absolute与check_url,核查目标商家在 Trustpilot 搜索结果中的位置。