@deluxebear/bilibilicli
v0.1.0
Published
Local CLI for browser-assisted Bilibili video uploads.
Downloads
29
Maintainers
Readme
bilibilicli
Browser-assisted local CLI for Bilibili video submission.
This project keeps login in a real browser, stores cookies under ~/.bilibilicli, and replays the upload/submission API from the CLI. Do not commit files from ~/.bilibilicli; they contain private account material.
Install
Published package:
npx @deluxebear/bilibilicli --help
npm install -g @deluxebear/bilibilicli
bilibilicli --helpLocal package before publishing:
npm install
npm linkOr install the packed tarball globally:
npm pack
npm install -g ./deluxebear-bilibilicli-0.1.0.tgz
bilibilicli --helpTo publish to npm:
npm login
npm publish --access publicnpx @deluxebear/bilibilicli ... works after the package is published. npm install -g @deluxebear/bilibilicli installs the global bilibilicli command permanently.
Login
bilibilicli auth login --profile default
bilibilicli auth status --profile default
bilibilicli doctor --profile defaultauth login opens Bilibili's member upload page with a persistent browser profile at:
~/.bilibilicli/browser-profiles/default/After logging in, press Enter in the terminal. Cookies are saved to:
~/.bilibilicli/profiles/default/auth.jsonCapture Requests
Use this when Bilibili changes fields or when you need to compare the CLI with the website:
bilibilicli auth capture --profile default --url https://member.bilibili.com/platform/upload/video/framePerform the website workflow in the opened browser, then press Enter. A redacted request summary is saved to:
~/.bilibilicli/profiles/default/capture-summary.jsonCommands
Read-only:
bilibilicli commands list
bilibilicli config list
bilibilicli auth status --profile default
bilibilicli doctor --profile defaultUpload a file but do not submit an archive:
bilibilicli upload file --profile default --file ./video.mp4Upload a cover image:
bilibilicli cover upload --profile default --file ./cover.jpgUpload and attach a subtitle draft to an uploaded video cid:
bilibilicli subtitle save \
--profile default \
--cid "<cid returned by upload file>" \
--file ./subtitle.en.srt \
--lan enSave an uploaded file as a draft:
bilibilicli draft save \
--profile default \
--filename "<filename returned by upload file>" \
--cid "<cid returned by upload file>" \
--title "投稿标题" \
--tid 27 \
--tags "学习" \
--subtitle-lan en \
--description "简介"Delete a draft by draft id:
bilibilicli draft delete --profile default --id 3399934Mark an existing draft as having subtitles:
bilibilicli draft subtitle --profile default --id 3399965 --lan enSubmit an uploaded file:
bilibilicli archive submit \
--profile default \
--filename "<filename returned by upload file>" \
--title "投稿标题" \
--tid 17 \
--tags "标签1,标签2" \
--description "简介"Upload and submit in one command:
bilibilicli video draft \
--profile default \
--file ./video.mp4 \
--cover-file ./cover.jpg \
--subtitle-file ./subtitle.en.srt \
--subtitle-lan en \
--title "投稿标题" \
--tid 27 \
--tags "学习" \
--description "简介"The currently verified website path is "upload and save draft". Direct archive submission is kept as a low-level command and may need another capture of the final submit button before use.
Upload and submit in one command:
bilibilicli video run \
--profile default \
--file ./video.mp4 \
--title "投稿标题" \
--tid 17 \
--tags "标签1,标签2" \
--description "简介"upload file, draft save, video draft, archive submit, and video run are state-changing commands. They upload media, save drafts, and/or create a Bilibili submission.
Known Protocol
The first implementation uses these web endpoints:
GET https://api.bilibili.com/x/web-interface/navfor read-only account diagnostics.POST https://member.bilibili.com/upload/multipart/newfor current video upload initialization.POST https://member.bilibili.com/upload/multipart/part, signedPUT, andPOST https://member.bilibili.com/upload/multipart/completefor current video bytes.POST https://member.bilibili.com/x/vu/web/cover/upfor optional cover upload.POST https://api.bilibili.com/x/upload/web/imagewithbucket=subtitlefor subtitle file upload.POST https://api.bilibili.com/x/v2/dm/subtitle/draft/preSavefor attaching subtitle drafts.POST https://member.bilibili.com/x/vupre/web/draft/addfor saving an upload as a draft.POST https://member.bilibili.com/x/vupre/web/draft/updatefor marking a saved draft subtitle language.POST https://member.bilibili.com/x/vupre/web/draft/deletefor deleting a draft by id.- Legacy
GET https://member.bilibili.com/preuploadand Upos multipart helpers are retained in code for older upload paths. POST https://member.bilibili.com/x/vu/web/add/v3for archive submission.
Bilibili can change required fields, CDN choices, or anti-abuse checks. If a command fails, run auth capture, perform the same action on the website, and compare the redacted capture with the CLI request shape.
