E-commerce Logistics Aggregator(电商物流聚合)
Query order logistics from Taobao, JD.com, Pinduoduo, and Douyin with persistent authentication.
Features
- - 🔗 Multi-platform: Taobao, PDD (JD & Douyin not supported due to anti-bot)
- 🔒 Persistent login: Cookie storage, no repeated logins
- 🛡️ Stealth mode: Bypass basic anti-bot detection
- ⏱️ Rate limiting: Built-in request throttling
- 📱 QR login: Graceful handling of expired sessions
- 🚚 In-transit filter: Only show orders currently in transit
Setup
CODEBLOCK0
Usage
First Time: Login to Platforms
CODEBLOCK1
Query Logistics
CODEBLOCK2
QR Login Process
When cookies are missing or expired:
- 1. The skill opens a browser window with the platform login page
- A QR code screenshot is saved to INLINECODE0
- Scan the QR code with the platform's mobile app
- Complete login in the browser window
- Cookies are automatically saved for future use
Note: If you see "Cookie 已过期,需要重新登录", run the login command again.
Cookie Storage
Cookies are stored encrypted in:
- - Default: INLINECODE1
- Each platform has separate cookie file
- Auto-refresh on expiration
Architecture
CODEBLOCK3
Error Handling
| Error | Handling |
|---|
| Cookie expired | Prompt QR re-login |
| Rate limited |
Auto-backoff retry |
| Login page detected | Graceful error with instructions |
| Network timeout | 3 retries with exponential backoff |
Platform Support Status
| Platform | Status | Notes |
|---|
| Taobao | ✅ Available | Order list + logistics info |
| JD |
❌ Unsupported | Anti-bot detection too strict |
| PDD | ✅ Available | Order list + tracking number + pickup code |
| Douyin | ❌ Unsupported | Requires mobile app access |
Implementation Notes
Anti-Detection Measures
The skill implements several stealth techniques:
- 1. navigator.webdriver override - Hides automation flag
- Plugins spoofing - Simulates real browser plugins
- Viewport & User-Agent - Uses realistic desktop/mobile profiles
- Permissions API - Overrides notification permissions
- Playwright-specific cleanup - Removes
__playwright properties
Rate Limiting
Each platform has independent rate limits:
| Platform | Max Requests | Window |
|---|
| Taobao | 10 | 60s |
| JD |
15 | 60s |
| PDD | 8 | 60s |
| Douyin | 10 | 60s |
Cookie Expiration
- - Cookies are considered expired after 30 days
- Expired cookies trigger QR re-login prompt
- Each platform stores cookies independently
Development
Updating Selectors
Platform websites change frequently. Update selectors in:
- -
references/selectors.md - Documentation - INLINECODE4 - Implementation
Testing
CODEBLOCK4
电商物流聚合
从淘宝、京东、拼多多和抖音查询订单物流信息,支持持久化认证。
功能特性
- - 🔗 多平台支持:淘宝、拼多多(京东和抖音因反爬机制暂不支持)
- 🔒 持久化登录:Cookie存储,无需重复登录
- 🛡️ 隐身模式:绕过基础反爬检测
- ⏱️ 速率限制:内置请求节流机制
- 📱 二维码登录:优雅处理会话过期
- 🚚 运输中筛选:仅显示当前运输中的订单
环境配置
bash
安装依赖
cd scripts && npm install
必需的环境变量(可选,用于无头模式运行)
export ECOM
LOGISTICSDATA_DIR=$HOME/.ecommerce-logistics
使用方法
首次使用:登录平台
bash
cd scripts
登录淘宝(打开浏览器进行二维码扫描)
npm run query -- --platform taobao --login
登录拼多多
npm run query -- --platform pdd --login
注意:由于严格的反爬措施,京东和抖音暂不支持
查询物流信息
bash
查询所有平台(需先完成登录)
npm run query -- --all
查询特定平台
npm run query -- --platform taobao
npm run query -- --platform pdd
使用自定义数据目录查询
npm run query -- --all --data-dir /path/to/cookies
以无头模式运行(不显示浏览器窗口)
npm run query -- --all --headless
二维码登录流程
当Cookie缺失或过期时:
- 1. 技能将打开一个包含平台登录页面的浏览器窗口
- 二维码截图将保存至 ~/.ecommerce-logistics/{platform}-qr.png
- 使用对应平台的手机应用扫描二维码
- 在浏览器窗口中完成登录
- Cookie将自动保存以供后续使用
注意: 如果看到Cookie已过期,需要重新登录的提示,请重新运行登录命令。
Cookie存储
Cookie以加密方式存储在:
- - 默认位置:~/.ecommerce-logistics/cookies/
- 每个平台拥有独立的Cookie文件
- 过期后自动刷新
架构设计
scripts/src/
├── index.ts # 命令行入口
├── core/
│ ├── aggregator.ts # 主协调器
│ ├── auth-manager.ts # Cookie与二维码登录管理
│ ├── rate-limiter.ts # 请求节流器
│ └── stealth-browser.ts # 反检测浏览器
├── adapters/
│ ├── base-adapter.ts # 抽象基类
│ ├── taobao-adapter.ts
│ ├── jd-adapter.ts
│ ├── pdd-adapter.ts
│ └── douyin-adapter.ts
└── types/
└── index.ts # TypeScript接口定义
references/
└── selectors.md # 平台特定的CSS选择器
错误处理
| 错误类型 | 处理方式 |
|---|
| Cookie过期 | 提示重新进行二维码登录 |
| 触发速率限制 |
自动回退重试 |
| 检测到登录页面 | 优雅提示并给出操作指引 |
| 网络超时 | 指数退避策略,最多重试3次 |
平台支持状态
| 平台 | 状态 | 说明 |
|---|
| 淘宝 | ✅ 支持 | 订单列表 + 物流信息 |
| 京东 |
❌ 不支持 | 反爬检测过于严格 |
| 拼多多 | ✅ 支持 | 订单列表 + 运单号 + 取件码 |
| 抖音 | ❌ 不支持 | 需通过手机应用访问 |
实现说明
反检测措施
本技能实现了多种隐身技术:
- 1. navigator.webdriver覆盖 - 隐藏自动化标志
- 插件伪装 - 模拟真实浏览器插件
- 视口与用户代理 - 使用逼真的桌面/移动端配置
- 权限API - 覆盖通知权限
- Playwright特定清理 - 移除playwright属性
速率限制
每个平台拥有独立的速率限制:
15 | 60秒 |
| 拼多多 | 8 | 60秒 |
| 抖音 | 10 | 60秒 |
Cookie过期机制
- - Cookie在30天后视为过期
- 过期Cookie将触发二维码重新登录提示
- 各平台独立存储Cookie
开发指南
更新选择器
平台网站会频繁更新。请在以下位置更新选择器:
- - references/selectors.md - 文档说明
- src/adapters/*-adapter.ts - 具体实现
测试方法
bash
编译TypeScript
cd scripts && npm run build
以开发模式运行
npm run dev -- --platform taobao
调试时显示浏览器窗口
npm run query -- --platform taobao --headless=false