主题
根据任务 ID 获取 Amazon ASIN HTML 结果
GET /v3/appendix/errors
接口说明
GET https://api.seermartech.cn/v3/merchant/amazon/asin/task_get/html/$id
根据任务 ID 获取 Amazon ASIN 任务的 HTML 页面及数据。
任务结果可在任务创建后的 7 天重复查询,查询结果不额外收费。费用在提交任务时产生,扣费以响应头 X-SeerMarTech-Charge-CNY 为准。
请求参数
该接口通过 URL 路径传递参数,请求不需要 JSON 请求体。
| 参数 | 类型 | 说明 |
|---|---|---|
id | string | 任务唯一标识符,UUID 格式。任务创建后 7 天可使用该 ID 随时查询结果。 |
请求头
| 请求头 | 类型 | 是否填 | 说明 |
|---|---|---|---|
Authorization | string | 是 | 固定格式:Bearer smt_live_YOUR_KEY |
Content-Type | string | 否 | 建议设置为 application/json |
响应字段
接口返回 JSON 数据,顶层 tasks 数组。
顶层字段
| 字段 | 类型 | 说明 |
|---|---|---|
version | string | 当前 API 版本。 |
status_code | integer | 通用状态码。完整状态码列表请参考 /v3/appendix/errors。建议客户端实现完善的异常和错误处理机制。 |
status_message | string | 通用提示信息。完整提示信息请参考 /v3/appendix/errors。 |
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 范围。完整状态码列表请参考 /v3/appendix/errors。 |
status_message | string | 任务状态说明。 |
time | string | 任务执行耗时,单位为秒。 |
cost | float | 平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。 |
result_count | integer | result 数组中的数量。 |
path | array | 请求 URL 路径信息。 |
data | object | 创建任务时提交的参数。 |
result | array | 任务结果数组。 |
tasks.result 字段
| 字段 | 类型 | 说明 |
|---|---|---|
asin | string | 创建任务时提交的 Amazon ASIN。 |
type | string | 搜索引擎类型。固定值为 asin。 |
se_domain | string | 创建任务时提交的搜索引擎域名。 |
location_code | integer | 创建任务时提交的地区代码。 |
language_code | string | 创建任务时提交的语言代码。 |
datetime | string | 获取结果的日期和时间,UTC 格式:yyyy-mm-dd hh-mm-ss +00:00。示例:2019-11-15 12:57:46 +00:00。 |
items_count | integer | items 数组中的结果数量。 |
items | array | 返回的 HTML 页面及数据。 |
tasks.result.items 字段
| 字段 | 类型 | 说明 |
|---|---|---|
page | integer | 返回的 HTML 页面序号。 |
date | string | HTML 页面抓取时间,UTC 格式:yyyy-mm-dd hh-mm-ss +00:00。示例:2019-11-15 12:57:46 +00:00。 |
html | string | HTML 页面。 |
请求示例
cURL
bash
id="04171455-0696-0192-0000-4c69cc29b945"
curl --location --request GET \
"https://api.seermartech.cn/v3/merchant/amazon/asin/task_get/html/${id}" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json"TypeScript
typescript
import axios from "axios";
const taskId = "02201115-0001-0066-0000-c06c8f23fce5";
axios
.get(
`https://api.seermartech.cn/v3/merchant/amazon/asin/task_get/html/${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);
});Python
python
import requests
task_id = "04171455-0696-0192-0000-4c69cc29b945"
url = (
"https://api.seermartech.cn/v3/merchant/amazon/asin/"
f"task_get/html/{task_id}"
)
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
}
response = requests.get(url, headers=headers)
response_data = response.json()
if response_data.get("status_code") == 20000:
print(response_data)
else:
print(
"请求失败,状态码:%s,提示:%s"
% (
response_data.get("status_code"),
response_data.get("status_message"),
)
)PHP
php
<?php
$taskId = '04171455-0696-0192-0000-4c69cc29b945';
$url = 'https://api.seermartech.cn/v3/merchant/amazon/asin/task_get/html/' . $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);响应示例
json
{
"version": "0.1.20200416",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.2244 sec.",
"cost": 0,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"id": "04171455-0696-0192-0000-4c69cc29b945",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.2100 sec.",
"cost": 0,
"result_count": 1,
"path": [
"v3",
"merchant",
"amazon",
"asin",
"task_get",
"html",
"04171455-0696-0192-0000-4c69cc29b945"
],
"data": {
"se_type": "shopping",
"api": "merchant",
"function": "asin",
"se": "amazon",
"language_code": "en_US",
"location_code": 2840,
"asin": "B0756FCPPN",
"priority": 2,
"device": "desktop",
"os": "windows"
},
"result": [
{
"asin": "B0756FCPPN",
"type": "asin",
"se_domain": "amazon.com",
"location_code": 2840,
"language_code": "en_US",
"datetime": "2019-11-15 12:57:46 +00:00",
"items_count": 1,
"items": [
{
"page": 1,
"date": "2019-11-15 12:57:46 +00:00",
"html": "<html>...</html>"
}
]
}
]
}
]
}状态码处理建议
20000:请求成功。40000及以上:任务处理失败或返回错误,应结合status_message排查。- 当
tasks_error大于0时,应逐个检查tasks数组中任务的status_code和status_message。 - 当
result为空或result_count为0时,应按无结果场景处理,直接访问items字段。
实用场景
- 抓取商品页 HTML:获取指定 ASIN 的完整页面,用于建立商品信息归档、页面快和合规审计记录。
- 分析商品页面 SEO素:解析 HTML 中的标题、描述、结构化数据和页面文本,评估商品页面的搜索可见性。
- 监控商品页面变化:定期查询并对比不同时间获取的 HTML,发现价格、库存、标题或变更,支持竞品监控。
- 提取商品结构化信息:从页面 HTML 中提取商品名称、品牌、规格和评价等,为选品分析和商品数据库建设提供数据。
- 排查页面抓取异常:结合任务状态码、抓取时间和 HTML,定位页面访问失败、返回空或页面结构变化等问题。