version v1.1.0 license MIT type Agent Skill · 无 GUI CLI files 23

MarketSpider Agent

基于 zhangjiancong/MarketSpider 改造的无 GUI Agent 技能:采集淘宝/天猫、京东、1688 的商品搜索结果(链接、名称、价格、图片、销量/评价、店铺等),可导出多种格式,适配 DeepSeek Harness / Claude Code / Codex 等 Agent 环境。

覆盖范围

采集平台

京东 jd淘宝/天猫 taobao1688 批发 1688

导出格式

JSONJSONLCSVXLSX TXTSQLSQLiteMarkdown

适配 Agent

DeepSeek HarnessClaude CodeCodexWorkBuddy

工具能力

  • 登录 Cookie 获取 / 导入 / 校验
  • 分页抓取、选择器诊断(probe)
  • 价格与店铺统计(stats)
  • 离线 fixture 解析自检(selftest)
  • 每个命令输出固定结构的 JSON 信封

安装到本地 Agent 技能目录

把仓库克隆为对应 Agent 技能根下的 marketspider 子目录;技能名以 SKILL.md 的 name: marketspider 为准。

DeepSeek Harness(Linux / macOS)

git clone https://github.com/Rexray117/MarketSpider-Agent-Skill.git ~/.dsh/skills/marketspider

DeepSeek Harness(Windows PowerShell)

git clone https://github.com/Rexray117/MarketSpider-Agent-Skill.git "$env:USERPROFILE\.dsh\skills\marketspider"

其他 Agent

# 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

Python 依赖

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 自检解析与导出链路(无需联网)

标准输出字段(10 个)

字段中文表头说明
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 或 "-" 填充。

运行前提

  • Python 3.10+ 解释器
  • 本机安装 Chrome / Edge 浏览器(driver 由 Selenium 管理器自动匹配;离线可用 --driver-path 指定)
  • 依赖:selenium>=4.20,<5、openpyxl>=3.1,<4、requests>=2.31,<3
  • 淘宝 / 京东 / 1688 通常需要登录态:首次运行在弹出的浏览器内完成扫码登录,Cookie 保存在本机 data/cookie/

关于本 Cloudflare 托管页面

能力边界:本 Pages 站点仅托管技能文档、源码清单与完整压缩包,供查阅与下载。采集引擎是本地 Python + Selenium 工具链,必须在带浏览器(无头或有头)的本机或服务器上运行。

Cloudflare Pages 为静态文件托管,Workers 为 V8 JS 隔离环境:不支持 Python 解释器、无法运行 Selenium / 浏览器自动化,也不能在边缘节点完成平台登录与扫码验证。因此采集引擎本身不能部署到 Cloudflare 上运行;请按上方步骤把技能包安装到本地 Agent 环境使用。

源码文件清单

路径(相对技能根目录)大小
.gitignore192 B
LICENSE1.0 KB
README.md2.4 KB
SKILL.md9.8 KB
config/selectors.json6.1 KB
references/data-schema.md3.6 KB
references/selectors.md3.5 KB
references/upstream-analysis.md4.9 KB
requirements.txt53 B
scripts/ms.py436 B
scripts/msagent/__init__.py292 B
scripts/msagent/__main__.py48 B
scripts/msagent/browser.py19.7 KB
scripts/msagent/cli.py40.9 KB
scripts/msagent/config.py3.3 KB
scripts/msagent/logutil.py1.3 KB
scripts/msagent/markets.py9.8 KB
scripts/msagent/paths.py2.9 KB
scripts/msagent/writers.py10.9 KB
tests/fixtures/1688_search.html1.6 KB
tests/fixtures/jd_search.html1.8 KB
tests/fixtures/taobao_search.html1.8 KB
tests/test_cli.py4.9 KB

完整打包:downloads/MarketSpider-Agent-Skill-v1.1.0.zip(49.8 KB)