返回顶部
a

amazon-search 亚马逊搜索

Search Amazon product listings for a keyword and return structured JSON results. Results are cached by ASIN/uuid for incremental searches and saved automatically to `results/`.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 0.1.1
安全检测
已通过
114
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

amazon-search

Amazon 搜索技能

根据关键词查询搜索亚马逊商品,并返回结构化的 JSON 结果。

前提条件

安装 Bun 运行时:

bash
curl -fsSL https://bun.sh/install | bash

安装技能依赖:

bash
cd skills/amazon-search
bun install

安装 Playwright 浏览器(亚马逊搜索所需):

bash
cd skills/amazon-search/scripts
npm install
npx playwright install chromium

Cookie

本技能使用 Playwright 在无头浏览器中直接搜索亚马逊,无需手动管理 Cookie。

Playwright 前提条件

安装 npm 依赖和 Playwright 浏览器:

bash
cd skills/amazon-search/scripts
npm install
npx playwright install chromium

输入参数
参数类型描述
keywordstring搜索关键词(例如 t-shirt)
proxy
string | 可选代理 URL。可通过参数值、--proxy 标志或 T2P_PROXY 环境变量设置。支持 HTTP/HTTPS 和 SOCKS5 代理。 |

| price_min | number | 可选最低价格筛选。映射到亚马逊的 low-price。 | | price_max | number | 可选最高价格筛选。映射到亚马逊的 high-price。 | | --pages | number | 最大抓取页数(默认:1)。每页约 20-60 个结果。 | | --num-products | number | 最大抓取商品数量。达到限制后停止,即使还有更多页面。 | | --incremental | 标志 | 仅输出之前未缓存的新结果。 | | --clear-cache | 标志 | 搜索前清除该关键词的缓存。 | | --output | string | 自定义结果输出目录(默认:results/)。 | | --download | 标志 | 搜索后使用 @t2p/image-cache 下载商品图片。 |

输出格式

返回一个包含搜索元数据和亚马逊商品对象数组的 JSON 对象。

结果会自动保存到 results/.json。

json
{
keyword: shirt,
timestamp: 2026-04-06T12:34:56.789Z,
count: 10,
items: [
{
id_: B09TPN9NJ6,
uuid: 418e2c7d-ccaa-4ca3-9d1b-6b4f3bd406b0,
originalimageurl: https://m.media-amazon.com/images/I/91YprRrDB4L.ACUL960FMwebpQL65_.jpg,
title: Amazon Essentials Mens Slim-Fit Crewneck T-Shirts, Short Sleeve,
item_page: https://www.amazon.com/dp/B09TPN9NJ6,
rating: 4.4,
review_count: 1787,
price: $19.99,
description: Amazon Essentials Mens Slim-Fit Crewneck T-Shirts, Short Sleeve
}
]
}

商品字段

字段类型描述
id_string亚马逊 ASIN(亚马逊标准识别号)
uuid
string | 来自亚马逊数据属性的唯一标识符 | | originalimageurl | string | 商品图片 URL(来自 srcset 的最高分辨率) | | title | string | 商品标题 | | item_page | string | 商品页面的完整 URL | | rating | number | 平均评分(1-5) | | review_count | number | 评论数量 | | price | string | 亚马逊上显示的价格(含货币符号) | | description | string | 商品描述(若无单独描述,可能与标题相同) |

执行

使用 scripts/amazon_search.ts 脚本。

所有 TypeScript 文件必须使用 Bun 运行:

bash

简单搜索


bun run scripts/amazon_search.ts shirt

配置工具

使用 scripts/configure.ts 生成环境变量命令和管理缓存:

bash

生成代理设置命令(复制并运行输出)


bun run scripts/configure.ts proxy http://127.0.0.1:7890

列出缓存文件

bun run scripts/configure.ts listcache

清除特定关键词的缓存

bun run scripts/configure.ts clearcache shirt

清除所有缓存

bun run scripts/configure.ts clearcache --all

使用说明

  • - 运行时:所有 TypeScript 文件必须使用 bun run 运行
  • 搜索方式:使用 Playwright 在无头浏览器中直接搜索亚马逊(无需手动管理 Cookie)
  • 代理支持:代理从 T2PPROXY 环境变量(或 --proxy CLI 标志)读取。支持 HTTP/HTTPS 和 SOCKS5 代理(例如 socks5://127.0.0.1:1080)。
  • 缓存与去重:搜索结果缓存到 resultscache/cache.md。每行是一个用于去重的 ASIN/uuid。
  • 增量模式:使用 --incremental 仅输出缓存中不存在的商品。
  • 清除缓存:使用 --clear-cache 在搜索前删除该关键词的缓存,或使用 scripts/configure.ts clearcache。
  • 自定义输出:使用 --output=/path/to/dir 将结果保存到自定义目录。
  • 下载图片:使用 --download 在搜索完成后自动使用 @t2p/image-cache 下载商品图片。

示例

所有命令均使用 bun run:

bash

简单搜索


bun run scripts/amazon_search.ts t-shirt

增量搜索 - 仅输出缓存中不存在的新结果

bun run scripts/amazon_search.ts t-shirt --incremental

搜索前清除缓存

bun run scripts/amazon_search.ts t-shirt --clear-cache --incremental

使用代理

bun run scripts/amazon_search.ts t-shirt --incremental --proxy http://127.0.0.1:10809

多页搜索(抓取 2 页,约 40-120 个结果)

bun run scripts/amazon_search.ts t-shirt --pages=2

多页 + 增量(仅所有页面中的新商品)

bun run scripts/amazon_search.ts t-shirt --pages=2 --incremental

限制特定数量的商品(达到限制后提前停止)

bun run scripts/amazon_search.ts t-shirt --pages=5 --num-products=50

指定自定义输出目录

bun run scripts/amazon_search.ts t-shirt --output=/path/to/custom/results

搜索后下载图片

bun run scripts/amazon_search.ts t-shirt --download

组合:搜索并下载,自定义输出

bun run scripts/amazon_search.ts t-shirt --download --output=/path/to/results

错误处理
情况处理方法
HTTP 4xx/5xx / 搜索被阻止亚马逊可能正在限流;稍后使用不同代理重试,或等待后重试
解析错误 / 结果为空
页面布局可能已更改;尝试不同关键词、页面或筛选条件 |

| Playwright 启动错误 | 确保已安装 Playwright 浏览器:cd scripts && npx playwright install chromium |

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 amazon-search-1775925321 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 amazon-search-1775925321 技能

通过命令行安装

skillhub install amazon-search-1775925321

下载

⬇ 下载 amazon-search v0.1.1(免费)

文件大小: 21.64 KB | 发布时间: 2026-4-12 09:00

v0.1.1 最新 2026-4-12 09:00
- Initial release of amazon-search skill for structured Amazon product searches.
- Supports keyword queries, price filters, paging, proxy configuration, image downloading, and incremental result output.
- Provides output as structured JSON and saves results automatically to the results directory.
- Includes robust caching, cache clearing commands, and deduplication for incremental searches.
- Full documentation for installation, configuration, usage examples, and troubleshooting.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部