通过 Bridge Server + 油猴脚本架构,在命令行中操作 BOSS 直聘,包括搜索职位、智能匹配评分、批量打招呼、LLM 招呼语生成等。
⚠️ 重要提示:本项目内置写操作强制节流(最小间隔约 48 秒),仅用于个人求职。禁止用于大规模采集、高频群发或任何违反平台服务条款的行为。详见 免责声明。
┌──────────┐ HTTP (JSON) ┌───────────────┐ WebSocket / HTTP Poll ┌──────────────────┐
│ cli.js │ ────────────────> │ Bridge Server │ <──────────────────────── │ 油猴脚本 (浏览器) │
│ (CLI) │ <──────────────── │ (server.js) │ ────────────────────────> │ boss_zhipin.user │
└──────────┘ └───────────────┘ └──────────────────┘
localhost localhost:19425 zhipin.com (含登录态)
- CLI 将命令编译为 JS 表达式 → Bridge Server → 浏览器 eval → BOSS API
- 所有请求由你已登录的浏览器发起,使用浏览器原生
fetch,自动携带已有的 Cookie 和登录态 - 结果经管线后处理(过滤/排序/评分/精简),通过
@ref引用系统节省上下文
- Node.js >= 18
- Tampermonkey 浏览器扩展
- BOSS 直聘账号 已登录
git clone <repo-url> && cd boss-cli
npm install
cp config.example.json config.json# 1. Bridge Server
node server.js &
# 2. 安装油猴脚本 scripts/boss_zhipin.user.js 到 Tampermonkey
# 3. 浏览器打开 zhipin.com 任意页面
# 4. 验证
node cli.js status
# → totalConnections >= 1 即正常node cli.js search <keyword> [options]
--city <code> 城市代码 (node cli.js city)
--pages N --interval 秒 批量翻页搜索
--min-salary K 最低月薪 (K)
--sort salary-desc 按薪资排序
--limit N --dedup 限制数量 + 去重
--enrich 薪资结构化
--online --no-negotiable HR在线 / 排除面议
--save csv|jsonl|db 导出结果
node cli.js recommend [--city <code>]# 命令行快速评分
node cli.js search python \
--match-skills "Python,FastAPI,PostgreSQL" \
--match-min-salary 15 \
--match-cities "北京,上海,深圳" \
--sort match-score
# JSON 配置文件
node cli.js search python --match-profile my-profile.json# 搜索 + 批量打招呼(写操作自动节流约 48s/条)
node cli.js greet-batch python --city 101290100 --count 10 --min-salary 10
# 预览(强烈建议先预览)
node cli.js greet-batch python --count 5 --dry-run
# 从缓存引用打招呼
node cli.js greet-batch --refs @search-xxx:1,@search-xxx:3
# 单条打招呼
node cli.js contact <securityId> --jobId <id>
node cli.js contact @search-xxx:2 # 用 @ref 引用export LLM_API_KEY=sk-xxx
export LLM_BASE_URL=https://api.deepseek.com
export LLM_MODEL=deepseek-chat
node cli.js llm-greet <securityId|@ref> --jobId <id> --resume cv.txt
node cli.js llm-greet @search-xxx:1 --dry-run # 预览不发送
node cli.js llm-reply @friends-xxx:1 "对方消息" --send # 基于上下文生成回复并发送
node cli.js llm-stats # LLM 调用统计node cli.js me # 用户信息
node cli.js friends [--page 1] # 聊天会话列表(自动缓存,支持 @ref)
node cli.js inbox [--page 1] # 收到的 HR 招呼列表
node cli.js unread # 未读会话看板(待跟进)
node cli.js chat <uid|@ref> # 聊天消息历史
node cli.js chat-send <uid|@ref> "消息" # 发送聊天消息(打招呼后的跟进)
node cli.js exchange <uid|@ref> --type wechat # 请求交换手机号/微信
node cli.js apply [--status 面试] # 我的投递记录(含状态统计)
node cli.js resume # 完整简历(基本信息 + 期望 + 状态 + 完成度)
node cli.js expect # 期望职位求职主链路:
search→contact/greet-batch(打招呼)→inbox/unread(跟进)→chat/chat-send/llm-reply(对话)→exchange(交换联系方式)→apply(追踪投递状态)
node cli.js city # 城市代码
node cli.js filters # 搜索过滤条件
node cli.js industries # 行业分类node cli.js status # Bridge 连接状态
node cli.js refresh # 刷新会话(修复 code:37)
node cli.js token info # 查看 passport_config 缓存
node cli.js token gen # 生成 __zp_stoken__
node cli.js cache list # 结果缓存列表
node cli.js cache clean # 清理过期缓存搜索/推荐/好友结果自动缓存到 ~/.boss/cache/,输出中长 ID 替换为精确引用:
{
"_invId": "search-260714-131522-a3f2",
"jobList": [
{ "jobName": "Python工程师", "salaryDesc": "15-25K", "_ref": "@search-260714-131522-a3f2:1" }
]
}下游命令直接使用 @invId:N 引用,无需复制粘贴长 ID:
node cli.js job @search-260714-131522-a3f2:1
node cli.js contact @search-260714-131522-a3f2:3输出体积对比:15 个岗位从 ~12KB → ~4KB,节省 ~65%。
| 选项 | 说明 |
|---|---|
--min-salary <K> |
最低月薪过滤 |
--sort salary-desc|asc |
薪资排序 |
--sort match-score |
按匹配度排序 |
--limit <N> |
限制数量 |
--dedup |
去重 |
--enrich |
薪资结构化 |
--online |
HR 在线 |
--no-negotiable |
排除面议 |
--skills s1,s2 |
技能过滤 |
--pages N |
批量翻页 |
--interval 秒 |
翻页间隔 |
--save csv|jsonl|db |
导出 |
--no-cache |
不使用缓存(输出含完整 ID) |
--raw |
原始输出 |
--no-log |
不写审计日志 |
| 环境变量 | 说明 | 默认 |
|---|---|---|
LLM_API_KEY |
API Key(必填) | - |
LLM_BASE_URL |
端点 URL | https://api.openai.com/v1 |
LLM_MODEL |
模型名 | gpt-4o-mini |
支持任意 OpenAI 兼容端点:DeepSeek / OpenAI / Claude / 通义千问 / Ollama …
boss-cli/
├── cli.js # CLI 入口
├── server.js # Bridge Server
├── scripts/
│ ├── boss_zhipin.user.js # 油猴脚本(构建产物)
│ ├── userscript.template.js # 油猴脚本框架模板
│ └── build-userscript.js # 从 bridge-api.js 生成油猴脚本
├── lib/
│ ├── client/ # Bridge HTTP 客户端
│ ├── server/ # WebSocket + Router + Registry
│ ├── commands/ # 命令实现 (23个)
│ ├── pipeline/ # 管线 (filter/sort/enrich/match/semantic)
│ ├── cache/ # 结果缓存 + @ref 系统
│ ├── llm/ # LLM 调用封装
│ ├── output/ # 格式化 + CSV/SQLite 导出
│ ├── shared/ # 协议 + bridge-api.js(__bridge 唯一源)+ 自愈代码
│ └── audit.js # 审计日志 + LLM Telemetry
└── docs/
└── platform-notes.md # 平台使用说明
💡
__bridgeAPI 定义唯一事实源在lib/shared/bridge-api.js。修改后运行node scripts/build-userscript.js重新生成油猴脚本,并重新安装到 Tampermonkey (Bridge Server 的自愈注入会自动同步,无需额外操作)。
- DISCLAIMER.md — 免责声明
- CONTRIBUTING.md — 贡献指南
- SECURITY.md — 安全策略
- SKILL.md — AI Agent 使用说明
- docs/platform-notes.md — 平台使用说明
MIT — 详见 LICENSE