@weibo-ai/weibo-cli
v0.9.8
Published
Open-source CLI for Weibo platform capabilities.
Readme
weibo-cli
Open-source CLI for the Weibo Open Platform — for humans and AI agents.
npm install -g @weibo-ai/weibo-cliOperate statuses, comments, friendships, search, users, and more from your terminal — with structured JSON / YAML / table output for scripting and agents.
| | |
| --- | --- |
| Agent-friendly | Machine-readable output; pipe to jq or agents |
| Live command catalog | weibo --help syncs with the platform |
| OAuth built-in | Browser or device-code login; tokens in OS keychain |
| Lightweight | Node.js ≥ 18, no native addons |
Quick start
weibo auth login # browser in a desktop TTY; device flow when stdin is not a TTY
# weibo auth login --device # force device flow for SSH / remote / headless use
weibo auth whoami
weibo statuses friends_timeline/bizAuthentication
| Command | Description |
| --- | --- |
| auth login | Auto-select browser (TTY) or device flow (non-TTY) |
| auth login --device | Force device flow (headless, with human approval) |
| auth whoami | Verify session |
| auth logout | Revoke the remote session and clear local credentials |
| auth token | Show token last4 and storage metadata |
| auth token --export | Explicitly export the full access token |
Prefer WEIBO_CLI_TOKEN (or WEIBO_TOKEN) injected by your environment or CI secret manager.
--token remains supported for compatibility, but can expose secrets through process arguments,
shell history, or logs. Avoid putting literal tokens in shell commands.
Commands
Pattern: weibo <group> <action> [flags] — actions may contain / (e.g. show_batch/other).
weibo --help
weibo commands list
weibo commands show users show_batch/otherExamples
weibo statuses friends_timeline/biz --count 5
weibo statuses show_batch/biz --ids 1234567890
weibo comments show/biz --id 1234567890
weibo friendships friends/biz
weibo users show/biz
weibo users show_batch/other --screen_name 来去之间
weibo search statuses/limited --q keywordGlobal flags: --output json|table|yaml|raw · -h, --help · --token <token> (legacy; prefer environment injection)
--help/-h always prints human-readable help. If combined with --output, help takes precedence and the output format is ignored.
When --output is omitted, each command uses its command-specific default (for example, doctor uses a human-readable readiness report).
Platform groups are discovered from the server using commands list, including statuses, comments, friendships, search, users, article, and others according to your account. Built-ins include auth, me, doctor, commands, skill, version, check_update, and upgrade.
upgrade prints the npm install command; it does not install software automatically.
update, check-update, and auth revoke remain supported for compatibility.
Security update compatibility
- Normal platform calls and existing command aliases remain supported.
- Scripts reading
.tokenfromauth token --output jsonmust switch toweibo auth token --export. Default token output now contains metadata only. - Existing OS keychain logins are unchanged. Encrypted-file credentials migrate automatically on use to AES-GCM with a random local key (
~/.weibo-cli/credential-key, owner-only permissions). Keep that key with the encrypted credentials when backing up; losing it requires login again. Older CLI versions cannot read the new format, so downgrading may require login again. Migration needs write permission to the configuration directory. - The local fallback protects against disclosure of an encrypted credential file alone. It does not protect against an attacker who can read both the key and credentials or operate as your OS account. Prefer the OS keychain where available.
- Skill installation requires a ZIP package and valid SHA-256 metadata. Old Hub entries without these must be updated or republished; there is no bypass flag. Already installed skills are not removed. Hashes verify consistency with Hub metadata, not independent publisher identity.
- Installing a skill replaces its directory and removes old files. Back up local edits first. Failed validation leaves the old installation intact.
skill install --globalnow matches the documented~/.config/agents/skills/;--global --claudeuses~/.claude/skills/. Older copies in~/.gemini/config/skills/are not moved or removed automatically; update your Agent's configured path to avoid loading stale copies.- Logout clears local credentials even when remote revocation fails, but now reports an error and exits nonzero instead of claiming the session was revoked.
Output
weibo statuses friends_timeline/biz --output table
weibo statuses friends_timeline/biz --output json | jq '.[] | .text'With an explicit --output, failures also write the API/error body to stderr in that format.
中文文档
微博开放平台命令行工具 — 终端操作微博、评论、关注、搜索等,适合脚本与 AI Agent。
安装与快速开始
npm install -g @weibo-ai/weibo-cli
weibo auth login # 桌面终端默认浏览器;stdin 非 TTY 时自动设备码
# weibo auth login --device # SSH / 远程 / 无图形界面时强制设备码
weibo auth whoami
weibo statuses friends_timeline/biz认证
| 命令 | 说明 |
| --- | --- |
| auth login | 自动选择浏览器(TTY)或设备码(非 TTY) |
| auth login --device | 强制设备码登录(仍需用户在浏览器确认) |
| auth whoami | 验证会话 |
| auth logout | 清除本地凭据 |
命令示例
weibo --help
weibo commands list --group statuses
weibo statuses friends_timeline/biz --count 5
weibo users show_batch/other --screen_name 来去之间
weibo comments to_me/biz用户查询: 已知昵称用 users show_batch/other --screen_name;按关键词搜微博用 search statuses/limited --q。
输出格式: --output json|table|yaml|raw
License
MIT
