bilibili-live-danmaku-api

Send Danmaku to Bilibili Live Room

Usage no npm install needed!

<script type="module">
  import bilibiliLiveDanmakuApi from 'https://cdn.skypack.dev/bilibili-live-danmaku-api';
</script>

README

bilibili live danmaku api npm

Install

npm install bilibili-live-danmaku-api -S

Usage

As a package

You need some cookies of the logined user.

const send = require('bilibili-live-danmaku-api')

const msg = /* Message */
const roomid = /* Roomid */
const SESSDATA = /* Cookie: SESSDATA */
const csrf = /* Cookie: bili_jct */
// const extra = {} /* (optional) Extra data append to POST body */

send({
  msg,
  roomid,
  SESSDATA,
  csrf
  // extra
})

Return: Promise<undefined>

Error handling

If the process is not successful, send() will reject.

Fork/stdio (use with other program)

Please use submodule or other ways to clone the repo, install Node.js environment.

Install npm packge got

npm install got -g

And fork file stdio.js with node, use stdin to send danmakus.

stdin format for each line: SESSDATA bili_jct roomid message, a space in between.

If the process is not successful, error message will be printed to stderr.

License

MIT