基于 zhangjiancong/MarketSpider 改造的无 GUI Agent 技能:采集淘宝/天猫、京东、1688 的商品搜索结果(链接、名称、价格、图片、销量/评价、店铺等),可导出多种格式,适配 DeepSeek Harness / Claude Code / Codex 等 Agent 环境。
把仓库克隆为对应 Agent 技能根下的 marketspider 子目录;技能名以 SKILL.md 的 name: marketspider 为准。
git clone https://github.com/Rexray117/MarketSpider-Agent-Skill.git ~/.dsh/skills/marketspider
git clone https://github.com/Rexray117/MarketSpider-Agent-Skill.git "$env:USERPROFILE\.dsh\skills\marketspider"
# Claude Code
git clone https://github.com/Rexray117/MarketSpider-Agent-Skill.git ~/.claude/skills/marketspider
# Codex
git clone https://github.com/Rexray117/MarketSpider-Agent-Skill.git ~/.codex/skills/marketspider
# WorkBuddy
git clone https://github.com/Rexray117/MarketSpider-Agent-Skill.git ~/.workbuddy/skills/marketspider
cd <技能内容根目录>
pip install -r requirements.txt # selenium>=4.20,<5 · openpyxl>=3.1,<4 · requests>=2.31,<3
在技能内容根目录执行 python scripts/ms.py doctor --launch,ready: true 再继续。
python scripts/ms.py cookie --market jd --action check;无登录态时 cookie --market jd --wait 180,在弹出的浏览器内完成扫码/登录。
python scripts/ms.py search --market jd --keyword "关键词" --pages 1-2 --formats json,csv。
用 stats --input <结果.json> 做价格/店铺统计;用 export --input 结果.json --formats xlsx,csv 转换格式。
| 命令 | 作用 |
|---|---|
doctor | 环境体检(Python / 依赖 / 浏览器 / 数据目录) |
env | 依赖检查与安装(可指定镜像源) |
config | 查看 / 修改运行配置 |
markets | 列出支持的平台与选择器字段 |
cookie | 获取 / 导入 / 检查平台登录 Cookie |
search | 按关键词搜索并导出商品数据 |
probe | 诊断页面与选择器命中情况,可 dump HTML |
export | 把 JSON / JSONL / CSV 结果重新导出为其他格式 |
stats | 对结果做价格 / 店铺统计 |
selftest | 用本地 fixture 自检解析与导出链路(无需联网) |
| 字段 | 中文表头 | 说明 |
|---|---|---|
item_link | 商品链接 | 补全协议、去重键 |
item_name | 商品名称 | 标题节点 / img alt,空白归一 |
item_price | 商品价格 | 剥离 ¥ ¥ 逗号,正则取数字 |
item_image | 商品图片 | img src / data-src / data-lazy-img |
item_payment | 已付款人数 | 京东 / 1688 部分卡片;淘宝不提供 |
item_rates | 已评价数 | 评价节点原文,不做单位换算 |
item_sales | 商品销量 | 淘宝 realSales 等原文 |
item_shop | 店铺名称 | 店铺节点文本 |
shop_link | 店铺链接 | 店铺节点 href |
remarks | 备注 | 非商品链接 / 降级提取等工具标记 |
元字段(仅进 JSON / JSONL / SQLite):market、keyword、page、position、captured_at。平台未提供的字段写空字符串,不以 0 或 "-" 填充。
--driver-path 指定)selenium>=4.20,<5、openpyxl>=3.1,<4、requests>=2.31,<3data/cookie/能力边界:本 Pages 站点仅托管技能文档、源码清单与完整压缩包,供查阅与下载。采集引擎是本地 Python + Selenium 工具链,必须在带浏览器(无头或有头)的本机或服务器上运行。
Cloudflare Pages 为静态文件托管,Workers 为 V8 JS 隔离环境:不支持 Python 解释器、无法运行 Selenium / 浏览器自动化,也不能在边缘节点完成平台登录与扫码验证。因此采集引擎本身不能部署到 Cloudflare 上运行;请按上方步骤把技能包安装到本地 Agent 环境使用。
| 路径(相对技能根目录) | 大小 |
|---|---|
| .gitignore | 192 B |
| LICENSE | 1.0 KB |
| README.md | 2.4 KB |
| SKILL.md | 9.8 KB |
| config/selectors.json | 6.1 KB |
| references/data-schema.md | 3.6 KB |
| references/selectors.md | 3.5 KB |
| references/upstream-analysis.md | 4.9 KB |
| requirements.txt | 53 B |
| scripts/ms.py | 436 B |
| scripts/msagent/__init__.py | 292 B |
| scripts/msagent/__main__.py | 48 B |
| scripts/msagent/browser.py | 19.7 KB |
| scripts/msagent/cli.py | 40.9 KB |
| scripts/msagent/config.py | 3.3 KB |
| scripts/msagent/logutil.py | 1.3 KB |
| scripts/msagent/markets.py | 9.8 KB |
| scripts/msagent/paths.py | 2.9 KB |
| scripts/msagent/writers.py | 10.9 KB |
| tests/fixtures/1688_search.html | 1.6 KB |
| tests/fixtures/jd_search.html | 1.8 KB |
| tests/fixtures/taobao_search.html | 1.8 KB |
| tests/test_cli.py | 4.9 KB |
完整打包:downloads/MarketSpider-Agent-Skill-v1.1.0.zip(49.8 KB)