Amazon Scraper 端点
本页所有操作均使用 actor scraper.amazon。通过 input.type 选择操作,并提供其对应的输入参数。
请求与鉴权
POST https://api.scrapeless.com/api/v1/scraper/request
x-api-token: YOUR_API_KEY
Content-Type: application/json将 YOUR_API_KEY 替换为你的 Scrapeless API 密钥。发送一个包含 actor 和 input 的 JSON 对象。
选择操作
| 操作 | input.type | 下文使用的输入参数 |
|---|---|---|
| 商品 | product | url、zip_code |
| 卖家 | seller | url、zip_code |
| 关键词搜索 | keywords | keywords、page、domain、zip_code |
| Rufus | rufus | keywords、domain |
商品
提供一个 Amazon 商品 URL。商品 schema 要求 url;zip_code 用于提供配送地点信息。
curl --request POST 'https://api.scrapeless.com/api/v1/scraper/request' \
--header 'x-api-token: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"actor": "scraper.amazon",
"input": {
"type": "product",
"url": "https://www.amazon.com/dp/B0BQXHK363",
"zip_code": ""
}
}'已发布的响应包含 asin、title、availability、final_price、rating、reviews_count、images 和 variations。响应的简化示例请参见 Quickstart。
卖家
提供一个卖家页面 URL。请包含 zip_code:卖家 schema 将其标记为必填,其请求示例使用空字符串。
curl --request POST 'https://api.scrapeless.com/api/v1/scraper/request' \
--header 'x-api-token: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"actor": "scraper.amazon",
"input": {
"type": "seller",
"url": "https://www.amazon.com/sp?seller=A2XZ7JICGUQ1CX",
"zip_code": ""
}
}'卖家参考将成功响应定义为一个 JSON 对象,但没有字段级别的 schema 或示例。在你的应用中映射卖家字段之前,请先检查返回的负载。
关键词搜索
在 keywords 中提供搜索文本。使用 page 选择搜索结果页。下面的示例遵循文档记录的数值型 page 值,并使用 domain: "com" 对应 Amazon.com;它省略了可选的分类筛选项。
curl --request POST 'https://api.scrapeless.com/api/v1/scraper/request' \
--header 'x-api-token: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"actor": "scraper.amazon",
"input": {
"type": "keywords",
"keywords": "Iphone+14+Pro+512GB",
"page": 1,
"domain": "com",
"zip_code": ""
}
}'| 输入参数 | 用途 |
|---|---|
keywords | 搜索关键词;操作 schema 要求必填。 |
page | 搜索结果页码。 |
domain | Amazon 域名设置;官方示例使用 com。 |
department | 可选的分类别名,对应 Amazon 的 i 查询参数。 |
zip_code | 用于配送信息的邮政编码。 |
已发布的响应包含 keyword、page、result、total_results_count 和 url。商品条目出现在 result.organic 下。响应示例针对的是与请求示例不同的查询和页码,因此应将其用于理解字段,而非预测确切结果。
Amazon 参数指南 指定 page 为整数值,且请求示例使用 1;当前生成的操作 schema 将 page 标注为字符串。本指南遵循该参数指南和请求示例。
Rufus
将 type 设置为 rufus。操作 schema 要求 keywords 和 domain 均为必填。请使用完整的 Amazon 域名,例如 www.amazon.es,而非关键词搜索示例中使用的 com 格式。
curl --request POST 'https://api.scrapeless.com/api/v1/scraper/request' \
--header 'x-api-token: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"actor": "scraper.amazon",
"input": {
"type": "rufus",
"keywords": "macbook",
"domain": "www.amazon.es"
}
}'已发布的响应包含:
| 字段 | API 示例中显示的内容 |
|---|---|
html | 包含事件记录和 HTML 片段的原始内容。 |
metadata | 包含 type 和 rawUrl。 |
result.user_query | 查询文本。 |
result.products | 针对该查询返回的商品条目。 |
result.related_questions | 相关问题。 |
操作 schema 还列出了 is_sse_data、is_get_question 和 asin,但未说明其行为。请从上面文档记录的请求开始。
处理任务结果
HTTP 200 响应包含已完成的结果。HTTP 201 响应表示处理仍在进行中;请保存其 taskId 并使用以下方式获取该任务:
curl --request GET 'https://api.scrapeless.com/api/v1/scraper/result/YOUR_TASK_ID' \
--header 'x-api-token: YOUR_API_KEY'将 YOUR_TASK_ID 替换为你的请求返回的 ID。有关轮询间隔和重试限制,请参阅 Results and Polling。
请同时检查错误响应体和 HTTP 状态码。400 响应可能包含 code: 20500 和 message: "scraping failed";它不是成功的数据响应。重试前请检查目标和请求输入。
参数参考
有关分类别名及其他文档记录的输入参数,请使用 Amazon API Parameters。请针对所选的 type 解析结果;商品、关键词搜索、卖家和 Rufus 并不共享单一的字段布局。