npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

douyin-danma-listener

v0.2.1

Published

douyin danma listener

Readme

简介

抖音弹幕录制

安装

node>=18

npm install douyin-danma-listener

使用

import DouYinDanmaClient from "douyin-danma-listener";

// roomId并非是你看到的房间号,你可以在 https://live.douyin.com/webcast/room/web/enter/ 中找到id_str参数
const client = new DouYinDanmaClient("id_str");
client.on("chat", (message) => {
  console.log("收到弹幕:", message);
});
client.connect();

参数

配置项如下:

  • autoStart (boolean): 是否自动开始连接,默认为 false
  • autoReconnect (number): 自动重连次数,默认为 3
  • heartbeatInterval (number): 心跳包发送间隔,单位为毫秒,默认为 10000
  • cookie (string): 可选的 Cookie 字符串,某些直播间可能需要?
  • timeoutInterval (number): 没有数据返回但ws未被主动关闭时超时后重新连接,单位为秒,默认100

事件

只支持了部分事件的解析

  • open: 连接成功时触发
  • close: 连接关闭时触发
  • reconnect: 重连时触发,参数为重连次数
  • heartbeat: 心跳包发送时触发
  • error: 发生错误时触发,参数为错误对象
  • chat: 收到弹幕消息时触发,参数为弹幕消息对象
  • member: 用户进入房间时触发,参数为用户信息对象
  • like: 收到点赞消息时触发,参数为点赞消息对象
  • social: 收到社交消息时触发,参数为社交消息对象
  • gift: 收到礼物消息时触发,参数为礼物消息对象
  • roomUserSeq: 收到房间用户序列消息时触发,参数为房间用户序列消息对象
  • roomStats: 收到房间统计消息时触发,参数为房间统计消息对象
  • roomRank: 收到房间排名消息时触发,参数为房间排名消息对象
  • message: 收到任意消息时触发,参数为消息对象

协议

GPLV3