catbus
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesecatbus
catbus
catbus(猫巴士)是一个命令行工具,用同一套命令、同一种 JSON 调用 10 个平台的 web 端接口。stdout 只有 JSON,日志、提示、二维码都在 stderr。
先确认它能用:、。找不到 命令时告诉用户安装(npm 包 ,或从源码 ),不要自己去装。
catbus versioncatbus doctorcatbuscatbus-clinpm linkcatbus (Cat Bus) is a command-line tool that uses the same set of commands and the same JSON format to call the web interfaces of 10 platforms. stdout contains only JSON, while logs, prompts, and QR codes go to stderr.
First verify that it works: , . If the command cannot be found, tell the user how to install it (the npm package , or from the source); do not install it yourself.
catbus versioncatbus doctorcatbuscatbus-clinpm link按任务读对应的文件
Read the relevant files for the task
这个文件只放总纲。动手前,按任务再读一两个文件,不需要全读:
| 任务 | 读 |
|---|---|
| 涉及某个平台 | |
| 搜索、采集、导出、翻页、下载、跨平台对比 | workflows/collect.md |
| 发布、评论、点赞、收藏、关注、删除等写操作 | workflows/write.md |
| 直播弹幕监听、私信 | workflows/live-msg.md |
| 命令报错:未登录、风控、不支持、网络 | workflows/errors.md |
| 查某条命令的参数、选项、输出字段 | reference/commands.md |
This file contains only the overview. Before acting, read one or two additional files based on the task; there is no need to read all of them.
| Task | Read |
|---|---|
| Involving a specific platform | |
| Searching, collecting, exporting, pagination, downloading, and cross-platform comparison | workflows/collect.md |
| Write operations such as publishing, commenting, liking, favoriting, following, and deleting | workflows/write.md |
| Live-stream chat monitoring and direct messages | workflows/live-msg.md |
| Command errors: not logged in, risk control, unsupported, or network issues | workflows/errors.md |
| Checking a command's parameters, options, and output fields | reference/commands.md |
平台
Platforms
| 平台 | id | 别名 | | 登录 | 文件 |
|---|---|---|---|---|---|
| 小红书 | | | 笔记 | cookie(扫码常被拦) | platforms/xhs.md |
| 抖音 | | | 作品 | 扫码 | platforms/douyin.md |
| TikTok | | | 视频 | cookie / 会话 JSON | platforms/tiktok.md |
| B 站 | | | 稿件 | 扫码 | platforms/bilibili.md |
| 快手 | | | 作品 | 扫码 | platforms/kuaishou.md |
| 微博 | | | 微博 | cookie | platforms/weibo.md |
| 闲鱼 | | | 闲置商品 | 扫码 | platforms/xianyu.md |
| 淘宝 | | | 商品 | cookie | platforms/taobao.md |
| 京东 | | | 商品 SKU | 扫码 | platforms/jd.md |
| X | | | 推文 | cookie | platforms/x.md |
还不支持:Instagram、YouTube、Facebook、知乎、微信公众号、今日头条、得物、拼多多、美团、大众点评正在开发,现在执行会报「未知的平台」()。用户问到时直接说还不支持,不要尝试调用,也不要拿别的平台凑数。
USAGE| Platform | id | Aliases | What | Login | File |
|---|---|---|---|---|---|
| RedNote | | | Note | cookie (QR-code sign-in is often blocked) | platforms/xhs.md |
| Douyin | | | Work | QR-code sign-in | platforms/douyin.md |
| TikTok | | | Video | cookie / session JSON | platforms/tiktok.md |
| Bilibili | | | Submission | QR-code sign-in | platforms/bilibili.md |
| Kuaishou | | | Work | QR-code sign-in | platforms/kuaishou.md |
| | Post | cookie | platforms/weibo.md | |
| Xianyu | | | Listing | QR-code sign-in | platforms/xianyu.md |
| Taobao | | | Product | cookie | platforms/taobao.md |
| JD | | | Product SKU | QR-code sign-in | platforms/jd.md |
| X | | | Post | cookie | platforms/x.md |
Not yet supported: Instagram, YouTube, Facebook, Zhihu, WeChat Official Accounts, Toutiao, Dewu, Pinduoduo, Meituan, and Dianping are under development. Attempting to execute them now will result in an “Unknown platform” error (). When users ask about them, say directly that they are not supported; do not attempt to invoke them, and do not substitute another platform.
USAGE命令语法
Command syntax
catbus <platform> <resource> <action> [参数...] [选项...]- resource / action 用规范词,所有平台同名:笔记、视频、推文、商品一律叫 ,搜索叫
item,收藏夹叫search,私信叫folder。msg、note、video这类原生叫法会报tweet,UNSUPPORTED里给出规范词。hint - 参数接受 ID、URL(包括分享短链)、平台自然标识(B 站 BV 号、X 用户名);用户参数还可以是 。输出对象都带
me和id,直接当下一条命令的参数,小红书一定要传url。url - 以 开头的位置参数放在
-之后。选项可以出现在任意位置。-- - 都还没实现(
-e app|pc),只用默认的 web 端。NOT_IMPLEMENTED
catbus <platform> <resource> <action> [参数...] [选项...]- Resource and action must use canonical terms, and they are identical across all platforms: notes, videos, posts, and products are all called ; search is called
item; favorites folders are calledsearch; and direct messages are calledfolder. Native terms such asmsg,note, orvideowill cause antweeterror, and theUNSUPPORTEDwill provide the canonical term.hint - Parameters accept IDs, URLs (including shared short links), and native platform identifiers (Bilibili BV IDs and X usernames). The user parameter can also be . Every output object includes
meandid, which can be passed directly to the next command; RedNote always requiresurl.url - Positional arguments beginning with go after
-. Options can appear anywhere.-- - has not been implemented (
-e app|pc); use only the default web interface.NOT_IMPLEMENTED
先查能力,再调用
Check capabilities before making a call
平台之间差别很大,调用前先查,不要猜:
bash
catbus platforms xhs # JSON:每条命令的 status(implemented / planned)、auth、note
catbus xhs item search --help # 参数、选项、筛选取值、登录要求、输出类型- 为
status的命令会报planned,不要调用;NOT_IMPLEMENTED写着限制(例如「只支持 me」),调用前看一眼。note - 筛选取值(
--sort--type)每个平台不同,以--time为准。--help - 平台文件里的「能做 / 做不到」是摘要,与 冲突时以后者为准。
catbus platforms
Capabilities vary significantly between platforms, so check before calling rather than guessing:
bash
catbus platforms xhs # JSON: each command's status (implemented / planned), auth, and note
catbus xhs item search --help # Parameters, options, filter values, login requirements, and output types- A command with a status will cause a
plannederror; do not call it. TheNOT_IMPLEMENTEDfield lists limitations, such as “only supports me,” so check it before invoking the command.note - Filter values for ,
--sort, and--typediffer between platforms; use--timeas the source of truth.--help - The “Can do / Cannot do” section in a platform file is only a summary. If it conflicts with , the latter takes precedence.
catbus platforms
信封与退出码
Envelope and exit codes
stdout 恰好一个信封( 时每行一条 ,摘要信封在 stderr 最后一行):
-o jsonldatajson
{ "ok": true, "platform": "bilibili", "resource": "item", "action": "get", "account": "default",
"data": {}, "page": null, "error": null }失败时 为 false、 为 。先读 ,它是下一步该执行的命令或做法。
okerror{code, message, hint, detail}error.hint| 退出码 | code | 一句话 |
|---|---|---|
| 0 | — | 成功 |
| 2 | | 参数错 / 平台没有 / 危险操作没确认 |
| 3 | | 让用户登录 |
| 4 | | 规划中,别重试 |
| 5 | | 风控,停下,别重试 |
| 6 | | 网络 / 代理 |
| 7 | | 平台业务错误,原始码在 |
| 1 | | 其他 |
每种错误怎么处理见 workflows/errors.md。
stdout contains exactly one envelope. When using , each line contains one object, and the summary envelope is on the final line of stderr:
-o jsonldatajson
{ "ok": true, "platform": "bilibili", "resource": "item", "action": "get", "account": "default",
"data": {}, "page": null, "error": null }On failure, is false and is . Read first; it indicates the next command or action to take.
okerror{code, message, hint, detail}error.hint| Exit code | code | One-line meaning |
|---|---|---|
| 0 | — | Success |
| 2 | | Invalid arguments / platform unavailable / dangerous operation not confirmed |
| 3 | | Ask the user to log in |
| 4 | | Planned; do not retry |
| 5 | | Risk control triggered; stop and do not retry |
| 6 | | Network / proxy issue |
| 7 | | Platform business error; the original code is in |
| 1 | | Other error |
See workflows/errors.md for how to handle each error.
红线
Hard rules
这些规则在任何任务里都成立:
- 登录交给用户。扫码要用户的手机,短信、密码、cookie 要用户本人提供。把 里的登录命令给用户,让他在自己的终端执行;不要索要或保存密码、验证码、cookie,不要读取、打印或修改
hint里的凭证文件。~/.catbus/ - 写操作先确认。发布、评论、点赞、关注、私信、删除会真实改变用户的账号。用户没有明确要求就不做;危险操作只在用户同意这一次之后才加 。
-y - 发布默认仅自己可见(),除非用户明确要公开。平台只支持公开时(闲鱼、X、B 站动态),先告诉用户会公开发出去。
--visibility private - 不主动联系真人:不给别人发私信、评论、@、关注,除非用户给出了对象和内容。不批量发送。
- 风控就停:不要循环重试,连续请求同一平台时留出间隔,不并发。
RISK_CONTROL - 照实汇报:结果为空、字段为 null、命令不支持,都照实告诉用户,不编造数据。
These rules apply to every task:
- Delegate login to the user. QR-code sign-in requires the user's phone, while SMS codes, passwords, and cookies must be provided by the user. Give the user the login command from the and have them run it in their own terminal. Do not request or store passwords, verification codes, or cookies, and do not read, print, or modify credential files under
hint.~/.catbus/ - Confirm write operations first. Publishing, commenting, liking, following, sending direct messages, and deleting will genuinely change the user's account. Do not perform them unless the user explicitly requests it; add to a dangerous operation only after the user approves that specific action.
-y - Published content is private by default () unless the user explicitly wants it to be public. For platforms that only support public visibility, such as Xianyu, X, and Bilibili posts, first tell the user that the content will be published publicly.
--visibility private - Do not proactively contact people: Do not send direct messages, comments, @ mentions, or follow requests to others unless the user has provided both the target and the content. Do not send messages in bulk.
- Stop when risk control is triggered: Do not retry in a loop after . Leave an interval between consecutive requests to the same platform, and do not run them concurrently.
RISK_CONTROL - Report accurately: If the results are empty, fields are null, or a command is unsupported, report the situation honestly and do not fabricate data.