主题
获取 Google 评论任务结果
通过任务 ID 获取 Google 评论采集结果。
返回结果与创建任务时指定的本地商户名称、搜索引擎、位置和语言参数一一对应。本平台会尽可能高精度地模拟所设置的位置与搜索环境,以便返回结果尽量贴近任务创建时该条件下的搜索结果。
你可以使用响应中的 check_url 在浏览器无痕模式下打开,核验结果是否与搜索页一致。需要注意的是,用户偏好、搜索历史以及个性化因素不会被纳入模拟,因此这些因素不会反映在返回结果中。
接口地址
GET https://api.seermartech.cn/v3/reviews/google/task_get/{id}
计费说明
该接口本身不重复计费,费用只在创建任务时扣除。任务创建后,30 天可多次获取结果。
扣费以响应头 X-SeerMarTech-Charge-CNY 为准。
路径参数
| 参数名 | 类型 | 说明 |
|---|---|---|
id | string | 任务唯一标识,UUID 格式。可在任务创建后的 30 天随时用于获取结果。 |
返回结构
接口返回 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 数组中返回错误的任务数量。 |
tasks | array | 任务结果列表。 |
tasks[] 字段
| 字段 | 类型 | 说明 |
|---|---|---|
id | string | 任务 ID,UUID 格式。 |
status_code | integer | 任务状态码,范围通常为 10000-60000。完整列表见 /v3/appendix/errors。 |
status_message | string | 任务状态说明。 |
time | string | 任务执行耗时,单位秒。 |
cost | float | 该任务成本,单位 USD。 |
result_count | integer | result 数组数量。 |
path | array | 请求路径。 |
data | array | 与创建任务时传参数一致的数据。 |
result | array | 结果数据。 |
result[] 字段
| 字段 | 类型 | 说明 |
|---|---|---|
keyword | string | 创建任务时传的。返回时会对 %## 进行解码,+ 会被解码为空格。 |
type | string | 创建任务时传的搜索引擎类型。 |
se_domain | string | 创建任务时传的搜索引擎域名。 |
location_code | integer | 创建任务时传的位置代码。 |
language_code | string | 创建任务时传的语言代码。 |
check_url | string | 直达搜索结果页的链接,可用于校验返回结果准确性。 |
datetime | string | 获取结果的时间,UTC 格式:yyyy-mm-dd hh-mm-ss +00:00。示例:2019-11-15 12:57:46 +00:00 |
title | string | 搜索结果页中 reviews 模块标题,通常为本地商户名称。 |
sub_title | string | reviews 模块副标题,通常为地址等附加信息。 |
rating | array | 对应本地商户的评分信息。 |
feature_id | string | 搜索结果页中 reviews 模块的唯一标识。 |
place_id | string | 搜索结果页中 reviews 模块的 XPath。 |
cid | string | 搜索引擎定义的商户唯一客户端 ID。可与 /v3/reviews/google/overview/ 接口合,进一步获取完整评论列表。 |
reviews_count | integer | 评论总数。 |
items_count | integer | 当前结果中返回的评论条数。创建任务时增大 depth 参数可获取更多评论。 |
items | array | 评论明细列表。创建任务时增大 depth 参数可获取更多评论。 |
result[].rating 字段
| 字段 | 类型 | 说明 |
|---|---|---|
rating_type | string | 评分类型。可能值:Max5、Percents、CustomMax。 |
value | float | 基于评论计算的平均分。 |
votes_count | integer | 投票或评分数量。 |
rating_max | integer | 当前 rating_type 对应的最大分值。 |
result[].items[] 字段
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 评论类型。该接口中通常为 "google_reviews_search"。 |
rank_group | integer | 在同类型组的位置。不同 type 的不计该排序。 |
rank_absolute | integer | 在评论中的绝对排名。 |
position | string | 评论在搜索结果页中的位置,可能值:right。 |
xpath | string | 该评论节点的 XPath。 |
review_text | string | 评论正文。 |
time_ago | string | 评论发布时间的相对时间描述。 |
timestamp | string | 评论发布时间,UTC 格式:yyyy-mm-dd hh-mm-ss +00:00。示例:2019-11-15 12:57:46 +00:00 |
rating | array | 评论提交的评分信息。 |
reviews_count | integer | 该评论累计提交的评论数。 |
photos_count | integer | 该评论累计提交的图片数。 |
local_guide | boolean | 是否为本地向导用户。 |
profile_name | string | 评论昵称。 |
profile_url | string | 评论主页链接。 |
profile_image_url | string | 评论头像链接。 |
owner_answer | string | 商户所有对评论的回复。 |
owner_time_ago | string | 商户回复的相对发布时间。 |
result[].items[].rating 字段
| 字段 | 类型 | 说明 |
|---|---|---|
rating_type | string | 评分类型,可能值:Max5。 |
value | float | 评分值。 |
votes_count | integer | 该评论获得的反馈数。 |
rating_max | integer | 当前评分体系下的最大值;Max5 的最大值为 5。 |
请求示例
curl
bash
id="04011058-0696-0199-0000-2196151a15cb"
curl --location --request GET "https://api.seermartech.cn/v3/reviews/google/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/reviews/google/task_get/{task_id}"
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
data = response.json
print(data)TypeScript
typescript
import axios from "axios";
const taskId = "02231934-2604-0066-2000-570459f04879";
axios({
method: "get",
url: `https://api.seermartech.cn/v3/reviews/google/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);
});结合 tasks_ready 拉取已完成任务
如果你是异步采集流程,通常会查询已完成任务列表,再逐个调用本接口获取结果。
Python 示例
python
import requests
base_url = "https://api.seermartech.cn"
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json"
}
# 1. 获取已完成任务列表
ready_resp = requests.get(
f"{base_url}/v3/reviews/google/tasks_ready",
headers=headers
)
ready_data = ready_resp.json
results = []
if ready_data.get("status_code") == 20000:
for task_group in ready_data.get("tasks", []):
for task_item in task_group.get("result", []) or []:
endpoint = task_item.get("endpoint")
task_id = task_item.get("id")
# 2. 方式一:直接请求返回的 endpoint
if endpoint:
resp = requests.get(f"{base_url}{endpoint}", headers=headers)
results.append(resp.json)
# 3. 方式二:通过任务 ID 拼接 task_get 路径
# if task_id:
# resp = requests.get(
# f"{base_url}/v3/reviews/google/task_get/{task_id}",
# headers=headers
# )
# results.append(resp.json)
print(results)TypeScript 示例
typescript
import axios from "axios";
const client = axios.create({
baseURL: "https://api.seermartech.cn",
headers: {
Authorization: "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
},
});
async function fetchCompletedReviewTasks {
const tasksResponses: any[] = [];
const readyResponse = await client.get("/v3/reviews/google/tasks_ready");
const readyData = readyResponse.data;
if (readyData.status_code !== 20000) {
console.error(
`error. Code: ${readyData.status_code} Message: ${readyData.status_message}`
);
return;
}
for (const taskGroup of readyData.tasks || []) {
for (const task of taskGroup.result || []) {
if (task.endpoint) {
// 方式一:直接访问已返回的 endpoint
const taskGetResponse = await client.get(task.endpoint);
tasksResponses.push(taskGetResponse.data);
}
// 方式二:通过任务 ID 查询
// if (task.id) {
// const taskGetResponse = await client.get(
// `/v3/reviews/google/task_get/${task.id}`
// );
// tasksResponses.push(taskGetResponse.data);
// }
}
}
console.log(tasksResponses);
}
fetchCompletedReviewTasks.catch(console.error);响应示例
json
{
"version": "3",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.1234 sec.",
"cost": 0,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"id": "04011058-0696-0199-0000-2196151a15cb",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.0345 sec.",
"cost": 0,
"result_count": 1,
"path": [
"v3",
"reviews",
"google",
"task_get",
"04011058-0696-0199-0000-2196151a15cb"
],
"data": {
"api": "reviews",
"function": "task_get",
"se": "google"
},
"result": [
{
"keyword": "coffee shop near me",
"type": "reviews_google",
"se_domain": "google.com",
"location_code": 2840,
"language_code": "en",
"check_url": "https://www.google.com/search?q=coffee+shop+near+me",
"datetime": "2019-11-15 12:57:46 +00:00",
"title": "Example Coffee",
"sub_title": "123 Main St, City",
"rating": {
"rating_type": "Max5",
"value": 4.6,
"votes_count": 128,
"rating_max": 5
},
"feature_id": "0x89c259af12345678:0x1234567890abcdef",
"place_id": "/html[1]/body[1]/div[3]/div[2]",
"cid": "1234567890123456789",
"reviews_count": 128,
"items_count": 2,
"items": [
{
"type": "google_reviews_search",
"rank_group": 1,
"rank_absolute": 1,
"position": "right",
"xpath": "/html[1]/body[1]/div[3]/div[2]/div[1]",
"review_text": "Great coffee and friendly staff.",
"time_ago": "2 months ago",
"timestamp": "2019-11-15 12:57:46 +00:00",
"rating": {
"rating_type": "Max5",
"value": 5,
"votes_count": 3,
"rating_max": 5
},
"reviews_count": 14,
"photos_count": 6,
"local_guide": true,
"profile_name": "John D.",
"profile_url": "https://example.com/profile/john",
"profile_image_url": "https://example.com/profile/john.jpg",
"owner_answer": "Thank you for your feedback!",
"owner_time_ago": "1 month ago"
},
{
"type": "google_reviews_search",
"rank_group": 2,
"rank_absolute": 2,
"position": "right",
"xpath": "/html[1]/body[1]/div[3]/div[2]/div[2]",
"review_text": "Nice place but a bit crowded.",
"time_ago": "3 months ago",
"timestamp": "2019-10-20 08:30:00 +00:00",
"rating": {
"rating_type": "Max5",
"value": 4,
"votes_count": 1,
"rating_max": 5
},
"reviews_count": 8,
"photos_count": 2,
"local_guide": false,
"profile_name": "Alice W.",
"profile_url": "https://example.com/profile/alice",
"profile_image_url": "https://example.com/profile/alice.jpg",
"owner_answer": "Thanks for visiting us!",
"owner_time_ago": "2 months ago"
}
]
}
]
}
]
}常见状态与错误处理
| 状态码范围/值 | 含义 | 处理建议 |
|---|---|---|
20000 | 请求成功 | 正常解析结果。 |
10000-60000 | 任务级状态码范围 | 按任务状态分别处理成功、处理中、参数错误或系统错误。 |
>= 40000 | 通常表示错误 | 记录 status_message,结合 /v3/appendix/errors 做重试或人工排查。 |
建议重点处理以下:
- 顶层
status_code成功,但tasks[].status_code失败 result为空,说明任务可能尚未完成或无可用数据tasks_ready已返回任务,但结果拉取时单个任务失败- 评论数量较少时,可检查任务创建时是否设置了足够的
depth
使用说明
- 本接口只用于获取已创建任务的结果
- 若要获取更多评论,应在创建任务时提高
depth cid可用于后续更的评论数据采集- 建议将
check_url保存到业务系统中,便于质检和人工复核
实用场景
- 监控门店口碑:按门店维度批量拉取评论结果,快速掌握评分、评论量和负面反馈变化。
- 识别差评主题:提取
review_text与评分字段,分析服务、环境、价格等高频负面问题,指导运营整改。 - 跟踪商家回复率:利用
owner_answer和owner_time_ago评估门店是否及时回复评论,提升本地商户信誉管理水平。 - 构建竞品对比看板:对比不同商户的
rating、reviews_count、本地向导占比等指标,区域竞争分析。 - 质检评论采集结果:通过
check_url回查搜索页,验证位置、语言和商户匹是否准确,降低数据偏差风险。