bilibili
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesebilibili — read & publish 专栏 via your own cookies
bilibili — 使用自有Cookie读写专栏
Drives the user's real Bilibili 专栏 (article) account through the same
web endpoints the site uses, authenticated by the login
cookie they captured with the ACE extension. No browser, no third-party deps —
+ (the article-list read endpoint needs WBI signing, done
with stdlib).
api.bilibili.comurllibhashlibThe connector injects the cookie jar as an env var:
- — a JSON array of cookies. Secret — never echo or print it. It includes
BILIBILI_COOKIES(auth) andSESSDATA(the CSRF token used for writes).bili_jct
通过B站官方使用的接口操作用户的真实B站专栏账号,使用用户通过ACE扩展获取的登录Cookie进行身份验证。无需浏览器,无第三方依赖——仅使用 + (文章列表读取接口需要WBI签名,通过标准库实现)。
api.bilibili.comurllibhashlib连接器会将Cookie Jar注入为环境变量:
- — Cookie的JSON数组。机密信息——切勿回显或打印。其中包含
BILIBILI_COOKIES(身份验证凭证)和SESSDATA(用于写入操作的CSRF令牌)。bili_jct
CLI
CLI
The skill ships — self-contained, stdlib only.
scripts/bilibili.pysh
BILI=$SKILL_DIR/scripts/bilibili.py
python3 $BILI whoami # who is logged in (mid, name)
python3 $BILI articles --limit 20 # my 专栏 articles + stats
python3 $BILI article <cvid> # one article's stats (cv id)
python3 $BILI drafts --limit 50 # list saved drafts (aid + title)Stats come straight from Bilibili: (阅读), (点赞), (评论),
(收藏), (投币).
viewlikereplyfavoritecoin本技能附带了——独立脚本,仅依赖标准库。
scripts/bilibili.pysh
BILI=$SKILL_DIR/scripts/bilibili.py
python3 $BILI whoami # 查询当前登录用户(mid、昵称)
python3 $BILI articles --limit 20 # 列出我的专栏文章及数据
python3 $BILI article <cvid> # 查看单篇文章的数据(cv id)
python3 $BILI drafts --limit 50 # 列出已保存的草稿(aid + 标题)数据直接来自B站:(阅读量)、(点赞数)、(评论数)、(收藏数)、(投币数)。
viewlikereplyfavoritecoinVerify the connection first
先验证连接
sh
python3 $BILI whoamish
python3 $BILI whoami→ {"mid": 91207595, "name": "...", "level": 4}
→ {"mid": 91207595, "name": "...", "level": 4}
On a not-logged-in / auth error the cookie is expired — have the user reconnect
at <https://auth.acedata.cloud/user/connections>. Do **not** loop-retry.
若未登录或出现身份验证错误,说明Cookie已过期——请用户前往<https://auth.acedata.cloud/user/connections>重新连接。**请勿循环重试**。Publishing — GATED (dry-run unless trailing --confirm
)
--confirm发布功能——受保护(除非末尾添加--confirm
,否则仅为模拟运行)
--confirmpublish--confirm--confirmsh
python3 $BILI publish --title "标题" --content-file a.html # dry-run
python3 $BILI publish --title "标题" --content-file a.html --draft-only --confirm # save a draft
python3 $BILI publish --title "标题" --content-file a.html --confirm # save draft + submit (publish)- saves a draft (no submit) — safe; finish/publish in the editor.
--draft-only - The submit (go public) step is frequently rate-limited by Bilibili
risk-control (HTTP 412). When that happens the CLI reports the saved draft +
edit URL so the user can publish from the web editor. Default to .
--draft-only
publish--confirm--confirmsh
python3 $BILI publish --title "标题" --content-file a.html # 模拟运行
python3 $BILI publish --title "标题" --content-file a.html --draft-only --confirm # 保存为草稿
python3 $BILI publish --title "标题" --content-file a.html --confirm # 保存草稿并提交发布- 仅保存草稿(不提交)——安全操作,可在编辑器中完成后续编辑/发布。
--draft-only - 提交(公开)步骤经常会被B站风控系统限制(HTTP 412错误)。出现此情况时,CLI会返回已保存的草稿及编辑链接,用户可通过网页编辑器完成发布。默认建议使用。
--draft-only
Managing drafts (the 999-draft cap)
草稿管理(999篇草稿上限)
Bilibili caps 专栏 drafts at 999; once full, saving a new draft fails with
. List drafts and delete the ones you don't need:
code 37106 草稿数已达最大上限sh
python3 $BILI drafts --limit 50 # list (aid + title)
python3 $BILI delete-draft <aid> <aid2> ... # dry-run (shows what would delete)
python3 $BILI delete-draft <aid> <aid2> ... --confirm # PERMANENTLY delete those drafts- is GATED (dry-run unless trailing
delete-draft) and deletion is permanent — always show the dry-run + the titles and get an explicit "yes" before--confirm. Pass multiple aids to batch a few per call.--confirm - Never bulk-delete blindly: list first, confirm the titles are junk/duplicates.
B站专栏草稿上限为999篇;达到上限后,保存新草稿会失败并返回。可列出草稿并删除不需要的草稿:
code 37106 草稿数已达最大上限sh
python3 $BILI drafts --limit 50 # 列出草稿(aid + 标题)
python3 $BILI delete-draft <aid> <aid2> ... # 模拟删除(展示将要删除的内容)
python3 $BILI delete-draft <aid> <aid2> ... --confirm # 永久删除指定草稿- 功能受保护(除非末尾添加
delete-draft,否则仅为模拟运行),且删除操作不可恢复——始终先展示模拟运行结果及草稿标题,获取用户明确的“同意”后再添加--confirm。可传入多个aid进行批量删除。--confirm - 切勿盲目批量删除:先列出草稿,确认要删除的是无用/重复的草稿。
Images
图片处理
publish<img src>i0.hdslb.comarticle.biliimg.com37130--no-rehost-imagespublish<img src>i0.hdslb.comarticle.biliimg.com37130--no-rehost-imagesGotchas
注意事项
- This is the user's real Bilibili account. Confirm before any publish.
- submit may 412 (anti-bot) even when the draft saved fine — the draft is the reliable result; don't loop-retry submit.
- A wrong cover layout () / category returns
tid; the CLI auto-retries common-17values.tid - Never print — it is full account access.
BILIBILI_COOKIES - ToS: acts only on the user's own account with their own captured cookie.
- 操作的是用户的真实B站账号。发布前请确认用户意图。
- 即使草稿保存成功,提交操作仍可能返回412错误(反机器人机制)——草稿是可靠的结果,请勿循环重试提交。
- 若封面布局()/分类错误,会返回
tid;CLI会自动重试常见的-17值。tid - 切勿打印——它包含完整的账号访问权限。
BILIBILI_COOKIES - 服务条款:仅在用户自有账号上操作,且使用用户自行获取的Cookie。
Record the output
记录输出结果
After you successfully publish and obtain the live result URL, call the built-in
tool ONCE so the user can track this deliverable in My Outputs:
publish_artifactpublish_artifact(kind="article", channel="bilibili", title="<title>", url="<the REAL returned URL>", status="delivered")Use the real returned URL — never fabricate one. Call it once per published item,
only after delivery is confirmed; skip it (or use ) if publishing failed.
See .
status="failed"_shared/artifacts.md成功发布并获取文章在线链接后,调用内置的工具一次,以便用户在“我的输出”中跟踪该交付物:
publish_artifactpublish_artifact(kind="article", channel="bilibili", title="<title>", url="<the REAL returned URL>", status="delivered")请使用真实返回的链接——切勿伪造。每个已发布内容仅调用一次,且仅在确认交付成功后调用;若发布失败,请跳过调用(或使用)。详情请参阅。
status="failed"_shared/artifacts.md