详细分析 ▾
运行时依赖
版本
- Initial release of cn-express-tracker for querying package tracking information via the Kuaidi100 API. - Supports auto-detection of carrier from tracking number or manual carrier specification. - Tracks packages from over 200 Chinese and international carriers. - Requires user-provided Kuaidi100 API credentials (API Key and Customer ID) set via environment variables. - Outputs detailed tracking timeline; provides error code explanations and manual carrier override options. - Includes Bash script usage instructions and carrier code reference.
安装命令 点击复制
技能文档
Track packages from 200+ carriers (Chinese domestic + international) via Kuaidi100 API.
Setup (必填)
Users must obtain their own Kuaidi100 API credentials:
- 注册企业版账号(个人也可注册) - Free tier: 100 queries/day 之后 verification- 获取 credentials 从 Kuaidi100 Dashboard:
- 设置 environment variables:
export EXPRESS_TRACKER_KEY="your_api_key_here"
export EXPRESS_TRACKER_CUSTOMER="your_customer_id_here"
For persistent config, add to ~/.bashrc or ~/.zshrc:
echo 'export EXPRESS_TRACKER_KEY="your_key"' >> ~/.zshrc
echo 'export EXPRESS_TRACKER_CUSTOMER="your_customer"' >> ~/.zshrc
Usage
# Auto-detect carrier and query
scripts/track.sh # Specify carrier manually
scripts/track.sh
Examples
# Auto-detect (recommended)
scripts/track.sh 770308811947591# Specify carrier explicitly
scripts/track.sh SF1234567890 shunfeng
如何 Works
- Carrier auto-detection: Local rule-based matching 由 tracking 数字 prefix/length/格式
- API 查询: Sends signed 请求 到 Kuaidi100 poll API 带有
resultv2=4对于 advanced status - 输出: Formatted timeline 带有 满 tracking history (newest 第一个)
Supported Carriers (Auto-Detection)
| Prefix/Pattern | Carrier | Code |
|---|---|---|
SF | 顺丰速运 | shunfeng |
YT | 圆通速递 | yuantong |
JT / J0 | 极兔速递 | jitu |
JD | 京东快递 | jd |
CN | 菜鸟速递 | cainiao |
DPK | 德邦快递 | debangkuaidi |
KYE | 跨越速运 | kuayue |
AN | 安能物流 | annengwuliu |
1Z | UPS | ups |
78/73/72/21/68 + digits | 中通快递 | zhongtong |
10/11/12/13/19/46 + 13 digits | 韵达快递 | yunda |
77/88/66/55/44 + 13-15 digits | 申通快递 | shentong |
E + letter + 9 digits + 2 letters | EMS | ems |
Full carrier code list: Kuaidi100 Carrier Codes
Dependencies
curl— HTTP requestsjq— JSON parsing (install:brew install jq/apt install jq)openssl或md5sum或md5— MD5 signature (在 最少 one 必填)
错误 Codes
| Code | Meaning | Action |
|---|---|---|
| 400 | Incomplete data / wrong carrier | Check carrier code |
| 408 | Phone verification failed | SF/ZTO require phone number |
| 500 | No tracking info found | Verify tracking number and carrier |
| 503 | Signature verification failed | Check API Key and Customer ID |
| 601 | API Key expired / no balance | Recharge account |
Agent Integration
When a user provides a tracking number, run:
EXPRESS_TRACKER_KEY="$KEY" EXPRESS_TRACKER_CUSTOMER="$CUSTOMER" scripts/track.sh
Parse the output and present the tracking timeline to the user. If carrier detection fails, ask the user which carrier it is.
免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制