| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
用真实可见的 Chrome 完成电商商品调研、同类商品比价与 Excel 报告生成。
Research products, compare market prices, and generate Excel reports through a real, visible Chrome browser.
🌐 项目官网 / Project website: https://qs3c.github.io/E-commerce-cli/
ecom 是一个面向电商运营、选品团队、市场研究人员与 AI Agent 的本地电商调研 CLI。输入关键词后,它会通过 Chrome DevTools Protocol(CDP)连接本机的可见 Chrome,模拟正常用户的输入、点击和滚动,采集搜索结果与商品详情,并将数据整理为可恢复的批次文件和便于决策的 Excel 报告。
当前 MVP 已支持 京东(JD.com)。淘宝、天猫、拼多多、当当、Amazon、eBay 等国内外电商平台已列入 Roadmap,将通过可扩展的站点适配器逐步接入。
Important
本项目强调低频、串行、可见且可人工接管的浏览器交互,能够减少无头、高并发采集常见的异常行为特征,但 CDP 或人类式节奏不代表“不可检测”,也不能保证不触发平台验证。请遵守目标网站条款、robots 规则和当地法律,仅采集你有权访问的数据。
flowchart LR
A["输入商品关键词"] --> B["可见 Chrome + 本机 CDP"]
B --> C["逐字输入、点击、分段滚动"]
C --> D["串行采集搜索结果与商品详情"]
D --> E["JSONL / CSV 可恢复批次"]
E --> F["价格分析与 Excel 调研报告"]
C -. "登录或验证" .-> G["暂停并等待人工处理"]
G -. "resume" .-> D
| 类别 | 字段 |
|---|---|
| 商品身份 | 商品 ID、搜索排名、标题、canonical 商品链接、主图 |
| 价格与销售 | 展示价格、精确金额、评价数、促销信息 |
| 商家 | 店铺名称、店铺链接、自营标记 |
| 商品详情 | 品牌、规格参数、库存、配送地区与配送信息 |
| 质量与追踪 | 完整/部分采集状态、采集时间、来源页面、商品级错误 |
单次任务可串行处理 1–50 个商品。页面中缺失的非关键字段会记录为 null 或“部分采集”,而不是臆造数据。
完成采集后,可显式生成专业的 Excel 市场调研报告:
Excel 导出依赖可选的 OfficeCLI 1.0.139+,采集功能本身不依赖 Microsoft Office 或 OfficeCLI。详细说明见 Excel 报告文档。
项目没有把“反检测”建立在隐身补丁或指纹伪装上,而是尽量贴近低频、可观察、可中断的正常浏览过程:
这些设计有助于减少不必要的风控触发并保护账号与会话数据,但无法消除平台检测风险。平台规则、页面结构和风控策略可能随时变化。
数据与报告侧也包含额外防护:
npm install --global e-commerce-cli
ecom doctor如需从源码安装:
git clone https://github.com/qs3c/E-commerce-cli.git
cd E-commerce-cli
npm install
npm run build
npm install --global .也可不全局安装,将下文的 ecom 替换为 node dist/cli/index.js。
ecom login jd命令会打开可见 Chrome 后立即返回。请在浏览器中人工完成登录;后续任务复用项目专用 Profile:
%USERPROFILE%\.e-commerce-cli\browser-data
# 采集最多 20 个“机械键盘”搜索结果及商品详情
ecom collect jd "机械键盘" --limit 20
# 查看批次状态
ecom status jd-20260826-103500-a1b2
# 从冻结队列继续被中断的任务
ecom resume jd-20260826-103500-a1b2
# 用户确认后生成 Excel 报告(需要 OfficeCLI 1.0.139+)
ecom report excel jd-20260826-103500-a1b2doctor、collect、status、resume 和 report excel 都支持 --json:
ecom collect jd "机械键盘" --limit 3 --jsonJSON 模式下 stdout 只输出一行成功或失败 envelope,进度与诊断只写入 stderr。因此脚本或 Agent 可以直接解析结果,无需清洗日志。采集命令仅返回建议的 Excel 后续动作,不会在未确认时自动调用 OfficeCLI。
每个批次保存在:
%USERPROFILE%\.e-commerce-cli\batches\<batch-id>\
| 文件 | 用途 |
|---|---|
| manifest.json | 批次状态、冻结搜索队列、进度、运行环境和产物路径 |
| products.jsonl | 每行一个通过 Zod Schema 校验的商品记录 |
| products.csv | 带 UTF-8 BOM、按排名排序且防公式注入的表格数据 |
| errors.jsonl | 商品级警告、失败和任务级错误 |
| report.xlsx | 可选的 Excel 调研报告 |
| 平台 | 状态 | 计划方向 |
|---|---|---|
| 京东 / JD.com | ✅ 已支持(MVP) | 关键词搜索、商品详情、断点恢复、CSV/JSONL、Excel 报告 |
| 淘宝 / Taobao、天猫 / Tmall | 🗺️ 计划中 | 商品搜索、店铺与价格研究 |
| 拼多多 / Pinduoduo | 🗺️ 计划中 | 商品搜索、拼单价与店铺信息 |
| 当当 / Dangdang | 🗺️ 计划中 | 图书与综合商品调研 |
| 苏宁易购、唯品会、1688 | 🗺️ 长期计划 | 国内多平台选品与价格比较 |
| Amazon、eBay、Walmart | 🗺️ 长期计划 | 海外零售商品研究与竞品比价 |
| AliExpress、Shopee、Lazada | 🗺️ 长期计划 | 跨境电商与区域市场研究 |
Roadmap 不代表交付承诺或确定日期。我们会优先依据社区需求、平台可测试性和合规边界逐步实现;欢迎通过 Issue 告诉我们你最需要的平台和数据字段。
程序按以下顺序查找 Chrome:
可覆盖 Chrome 路径与本机 CDP 端口:
$env:ECOM_CHROME_PATH = 'C:\Program Files\Google\Chrome\Application\chrome.exe'
$env:ECOM_BROWSER_REMOTE_DEBUGGING_PORT = '53471'npm run check该命令依次执行 TypeScript 类型检查、全部 Vitest 测试和生产构建。
欢迎提交 Issue、适配器建议、页面选择器更新、测试夹具和 Pull Request。新增平台时,请保留项目现有原则:可见浏览器、低频串行操作、遇验证停止、不复制认证数据,并为页面解析与异常状态补充脱敏测试夹具。
如果这个项目对你的电商调研、竞品分析、选品或价格监控工作有帮助,欢迎点一个 ⭐,也欢迎分享你的使用场景。
ecom is a local e-commerce research CLI for marketplace operators, sourcing teams, market researchers, and AI agents. Give it a product keyword and it connects to a visible local Chrome through the Chrome DevTools Protocol (CDP), performs human-paced page interactions, collects search results and product details, and turns the data into resumable batch artifacts and decision-ready Excel reports.
The current MVP supports JD.com. Taobao, Tmall, Pinduoduo, Dangdang, Amazon, eBay, and other domestic and international marketplaces are on the roadmap and will be added through extensible site adapters.
Important
This project favors low-frequency, serial, visible, and human-supervised browser interaction. That reduces behavioral anomalies commonly associated with headless or high-concurrency collection, but CDP and human-like pacing do not make automation undetectable and cannot guarantee that a platform will not request verification. Follow each website's terms, robots rules, and applicable laws, and collect only data you are authorized to access.
flowchart LR
A["Product keyword"] --> B["Visible Chrome + local CDP"]
B --> C["Typing, clicks, and segmented scrolling"]
C --> D["Serial search and product-detail collection"]
D --> E["Resumable JSONL / CSV batch"]
E --> F["Price analysis and Excel report"]
C -. "Login or verification" .-> G["Pause for human action"]
G -. "resume" .-> D
| Category | Fields |
|---|---|
| Product identity | Product ID, search rank, title, canonical product URL, main image |
| Price and sales | Display price, exact amount, review count, promotions |
| Merchant | Store name, store URL, first-party seller flag |
| Product details | Brand, specifications, stock, delivery region, delivery details |
| Quality and traceability | Complete/partial status, capture time, source pages, per-product errors |
Each job processes 1–50 products serially. Missing optional page fields are recorded as null or partial data instead of being invented.
After collection, explicitly generate a professional market-research workbook:
Excel export uses optional OfficeCLI 1.0.139+. Product collection itself requires neither Microsoft Office nor OfficeCLI. See the Excel report guide for details.
Instead of relying on stealth patches or fingerprint spoofing, the project follows a low-frequency, observable, and interruptible browsing model:
These choices can reduce unnecessary risk-control triggers and protect account/session data, but they cannot eliminate platform detection risk. Platform rules, page structures, and risk-control systems can change at any time.
Additional data and report protections include:
npm install --global e-commerce-cli
ecom doctorTo install from source instead:
git clone https://github.com/qs3c/E-commerce-cli.git
cd E-commerce-cli
npm install
npm run build
npm install --global .Without a global install, replace ecom below with node dist/cli/index.js.
ecom login jdThe command opens visible Chrome and returns immediately. Sign in manually in the browser. Future jobs reuse the project-specific profile at:
%USERPROFILE%\.e-commerce-cli\browser-data
# Collect up to 20 mechanical-keyboard results and product details
ecom collect jd "mechanical keyboard" --limit 20
# Inspect batch status
ecom status jd-20260826-103500-a1b2
# Continue an interrupted frozen queue
ecom resume jd-20260826-103500-a1b2
# Generate Excel after user confirmation (OfficeCLI 1.0.139+ required)
ecom report excel jd-20260826-103500-a1b2doctor, collect, status, resume, and report excel support --json:
ecom collect jd "mechanical keyboard" --limit 3 --jsonIn JSON mode, stdout contains exactly one success or error envelope; progress and diagnostics go to stderr. Scripts and agents can parse results without filtering logs. Collection only suggests a follow-up Excel action and never invokes OfficeCLI without confirmation.
Each batch is stored under:
%USERPROFILE%\.e-commerce-cli\batches\<batch-id>\
| File | Purpose |
|---|---|
| manifest.json | Batch state, frozen result queue, progress, runtime, and artifact paths |
| products.jsonl | One Zod-validated product record per line |
| products.csv | UTF-8 BOM, rank-sorted, formula-injection-safe tabular data |
| errors.jsonl | Per-product warnings/failures and job-level errors |
| report.xlsx | Optional Excel research report |
| Marketplace | Status | Planned scope |
|---|---|---|
| JD.com | ✅ Supported (MVP) | Keyword search, details, resume, CSV/JSONL, Excel reports |
| Taobao and Tmall | 🗺️ Planned | Product search, store research, and price analysis |
| Pinduoduo | 🗺️ Planned | Product search, group pricing, and merchant information |
| Dangdang | 🗺️ Planned | Book and general-product research |
| Suning, Vipshop, and 1688 | 🗺️ Long-term | Multi-marketplace sourcing and price comparison in China |
| Amazon, eBay, and Walmart | 🗺️ Long-term | International retail research and competitor pricing |
| AliExpress, Shopee, and Lazada | 🗺️ Long-term | Cross-border and regional marketplace research |
The roadmap is not a delivery commitment or schedule. Priorities will reflect community demand, testability, and compliance boundaries. Open an Issue to tell us which marketplace and data fields matter most to you.
Chrome is located in this order:
Override the executable or local CDP port when needed:
$env:ECOM_CHROME_PATH = 'C:\Program Files\Google\Chrome\Application\chrome.exe'
$env:ECOM_BROWSER_REMOTE_DEBUGGING_PORT = '53471'npm run checkThis runs TypeScript type checking, the complete Vitest suite, and a production build.
Issues, adapter proposals, selector updates, sanitized fixtures, and pull requests are welcome. New marketplace adapters should preserve the project's existing principles: visible browsing, low-frequency serial interactions, stop-on-verification behavior, no authentication-data copying, and sanitized fixtures for parsing and exceptional states.
If E-commerce CLI helps with your product research, competitor analysis, sourcing, or price-monitoring workflow, consider giving the repository a ⭐ and sharing your use case.
| Back | FazBrowse Home | New Git URL |