xhs-agent

这里只保留所选节点接管抓取所需的操作:运行、下线、登录态刷新和抓取测试。

节点列表
还没有 xhs-agent 节点
让所选节点运行 agent 的一键指令
复制到目标机器终端执行。新启动的节点会自动接管为当前唯一生效实例,旧实例会在下一次心跳或轮询时自动退出。
先选择一个 xhs-agent 节点
所选节点 Worker 启动命令
启动本机 `xiaohongshu-mcp` worker,并检查 18060 与登录态接口。默认用有界面模式,方便登录和排障。
mkdir -p ~/Library/Logs/dnews; [ -d ~/xiaohongshu-mcp/.git ] || git clone https://github.com/xpzouying/xiaohongshu-mcp.git ~/xiaohongshu-mcp; git -C ~/xiaohongshu-mcp fetch origin main; git -C ~/xiaohongshu-mcp checkout main; git -C ~/xiaohongshu-mcp pull --ff-only origin main; cd ~/xiaohongshu-mcp; existing_pid=$(lsof -tiTCP:18060 -sTCP:LISTEN); if [ -n "$existing_pid" ]; then kill $existing_pid; sleep 1; fi; nohup /opt/homebrew/bin/go run . -headless=false > ~/Library/Logs/dnews/xiaohongshu-mcp.log 2> ~/Library/Logs/dnews/xiaohongshu-mcp.err.log < /dev/null &; sleep 2; lsof -nP -iTCP:18060 -sTCP:LISTEN || true; curl -i http://127.0.0.1:18060/api/v1/login/status || true
所选节点登录命令
在目标机器打开浏览器完成小红书登录,登录态会保存在该机器 worker 使用的目录里。
[ -d ~/xiaohongshu-mcp/.git ] || git clone https://github.com/xpzouying/xiaohongshu-mcp.git ~/xiaohongshu-mcp; git -C ~/xiaohongshu-mcp fetch origin main; git -C ~/xiaohongshu-mcp checkout main; git -C ~/xiaohongshu-mcp pull --ff-only origin main; cd ~/xiaohongshu-mcp; go run cmd/login/main.go
让所选节点下线的指令
只关闭该节点上的 xhs-agent 进程,让它不再领取抓取任务。
for pid in $(pgrep -f "node index.mjs" || true); do   cwd=$(lsof -a -d cwd -p "$pid" -Fn 2>/dev/null | sed -n 's/^n//p');   if [ "$cwd" = '$HOME/dnews-xhs-agent/repo/xhs-agent' ]; then kill "$pid"; fi; done
登录态检查刷新
这里检查的是当前选中节点对应机器上的 worker 登录态。
Agent 在线
所选节点未连接后台
Worker 可达
未检测到
登录状态
未登录
抓取测试
只保留所选节点的实际抓取测试,方便确认接管后的节点能正常出结果。