Google 评价(异步)
异步抓取 Google 商家评价,含评分、评论文本、作者、时间等。
Step 1:提交任务
POST
/v3/business_data/google/reviews/task_post参考价:约 ¥0.8000 / 次(实际以请求返回为准)
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| keyword | string | 否 | 商家名称或关键词 |
| location_name | string | 否 | 地区名称 |
| location_code | integer | 否 | 地区代码 |
| cid | string | 否 | Google 商家 CID |
| depth | integer | 否 | 抓取评价数量 |
curl
curl -X POST "https://api.seermartech.cn/v3/business_data/google/reviews/task_post" \
-H "Authorization: Bearer smt_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '[{"keyword": "咖啡店", "location_code": 2156, "language_code": "zh", "depth": 50}]'Python
import time
import requests
API_KEY = "smt_live_YOUR_KEY"
BASE = "https://api.seermartech.cn/v3"
HEADERS = {"Authorization": f"Bearer {API_KEY}"}
post = requests.post(
f"{BASE}/business_data/google/reviews/task_post",
headers={**HEADERS, "Content-Type": "application/json"},
json=[{"keyword": "咖啡店", "location_code": 2156, "language_code": "zh", "depth": 50}],
timeout=60,
)
task_id = post.json()["tasks"][0]["id"]
for _ in range(30):
get = requests.get(
f"{BASE}/business_data/google/reviews/task_get/{task_id}",
headers=HEADERS,
timeout=60,
)
data = get.json()
if data["tasks"][0]["status_code"] == 20000:
print(len(data["tasks"][0]["result"][0]["items"]), "reviews")
break
time.sleep(10)TypeScript
const API_KEY = "smt_live_YOUR_KEY";
const BASE = "https://api.seermartech.cn/v3";
async function fetchGoogleReviews() {
const postResp = await fetch(`${BASE}/business_data/google/reviews/task_post`, {
method: "POST",
headers: { Authorization: `Bearer ${API_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify([{ keyword: "咖啡店", location_code: 2156, language_code: "zh", depth: 50 }]),
});
const taskId = (await postResp.json()).tasks[0].id;
for (let i = 0; i < 30; i++) {
const getResp = await fetch(`${BASE}/business_data/google/reviews/task_get/${taskId}`, {
headers: { Authorization: `Bearer ${API_KEY}` },
});
const data = await getResp.json();
if (data.tasks[0].status_code === 20000) return data;
await new Promise((r) => setTimeout(r, 10_000));
}
}Step 2:获取结果
GET
/v3/business_data/google/reviews/task_get/{task_id}业务场景
- 监控品牌门店评价趋势
- 竞品口碑对比分析