<div align="center">
<a href="https://v2.nonebot.dev/store"><img src="doc/nbp_logo.png" width="180" height="180" alt="NoneBotPluginLogo"></a>
<br>
<p><img src="doc/NoneBotPlugin.svg" width="240" alt="NoneBotPluginText"></p>
</div>
<div align="center">
# nonebot_plugin_blive_danmaku
_💫 B站直播间路灯插件 💫_
[![pypi](https://img.shields.io/pypi/v/nonebot-plugin-blive-danmaku.svg)](https://pypi.org/project/nonebot-plugin-blive-danmaku/) ![python](https://img.shields.io/pypi/pyversions/nonebot-plugin-blive-danmaku) [![license](https://img.shields.io/github/license/zangxx66/nonebot_plugin_blive_danmaku.svg)](https://raw.githubusercontent.com/zangxx66/nonebot_plugin_blive_danmaku/main/LICENSE)
</div>
## 简介
- 基于[nonebot2](https://v2.nonebot.dev/)开发的B站直播间弹幕监听插件,参考了Haruka和blivechat的部分代码。
- 起源于[哈鹿hallu](https://space.bilibili.com/3493118494116797)的一条动态,苦于做视频时没有人做路灯,翻录播的时候头都大了,说要花钱请个全职路灯,我寻思与其把钱送给别人,不如交给Bot去做路灯。
![](/doc/screenshot1.png)
- 路灯:指把直播过程中有趣的点记录下来,给剪辑根据记录的时间点和内容做出对应的视频。
## 功能
- 用弹幕的形式记录直播高能点
- 弹幕指令为`#路灯`加上记录的内容
- 仅在开播时弹幕指令才会生效
## 依赖
- Python >= 3.10
- OneBot V11
## 安装
- 方式一:使用`nb-cli`安装插件
```
nb plugin install nonebot-plugin-blive-danmaku
```
- 方式二:使用`pip`安装
```
python -m pip install nonebot-plugin-blive-danmaku
```
## 配置
|名称|类型|默认值|描述|
|-----|-----|-----|-----|
|danmaku_group_notice|bool|False|全局群开播提醒|
|danmaku_host|str||外部访问地址,若配置了公网访问地址请填写此项,以便bot能够发送正确的面板地址,例如:`“http://www.your_domain.com”`,`“http://192.168.0.2"`<br/>非80,443端口需要带上端口号,例如:`“http://www.your_domain.com:12450”`,`“http://192.168.0.2:12450"`|
## 指令
|指令|说明|
|------|------|
|/添加订阅 UID|UID为B站用户的uid,不是直播间id,以下同理|
|/取消订阅 UID|删除订阅|
|/开启路灯 UID|开启直播间弹幕监听|
|/关闭路灯 UID|关闭直播间弹幕监听|
|/订阅列表||
|/查看面板|打开网页版查询|
|/开启统计 UID|开启弹幕统计,包含每场直播弹幕数,平均弹幕数,观看人数,每分钟弹幕数。<br/>`注:开启后磁盘将增加更多的占用空间,如果磁盘空间不足建议关闭数据统计。`|
|/关闭统计 UID|关闭弹幕统计|
|/导入cookie 已登录账号的cookie|添加一个cookie,避免弹幕用户名打码|
## 效果预览
![](/doc/screenshot.png)
![](/doc/screenshot2.png)
![](/doc/screenshot4.png)
![](/doc/screenshot5.png)
![](/doc/screenshot6.png)
## 反向代理(可选,如果需要配置外部网络访问面板)
> 这里仅以最简单的配置为例,不包含SSL访问
Nginx
``` nginx
server {
listen 80;
server_name www.your_domain.com;
location /danmaku/ {
proxy_pass http://127.0.0.1:8080/danmaku/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_cache_bypass $http_upgrade;
}
location /ws {
deny all;
}
}
```
Apache
``` apache
<VirtualHost *:80>
ServerName www.your_domain.com
ProxyRequests Off
ProxyPass "/danmaku/" http://127.0.0.1:8080/danmaku/
ProxyPassReverse "/danmaku/" http://127.0.0.1:8080/danmaku/
</VirtualHost>
```
## 更新日志
- v0.4.0
- 支持添加cookie,避免弹幕用户名打码
- v0.3.4
- 添加词云
- 新增黑暗模式
- v0.3.3
- 修复弹幕用户名打码
- fix [#12](https://github.com/zangxx66/nonebot_plugin_blive_danmaku/issues/12)
- v0.3.0
- 适配nonebot2 2.0.0
- 增加弹幕统计
- 新增记录SuperChat内容,可在面板生成SuperChat图片
- 更新依赖 [#11](https://github.com/zangxx66/nonebot_plugin_blive_danmaku/issues/11)
- v0.2.9
- 面板查询开播历史列表,标题旁展示该场直播的路灯数量
- Bot被踢出群后清除该群的订阅
- fix路灯列表搜索bug
- Clean Up Code
- v0.2.8
- 封面地址不再绑定url,面板地址变更导致封面图片异常的可手动清理 [#10](https://github.com/zangxx66/nonebot_plugin_blive_danmaku/issues/10)
- 面板添加侧边菜单应对多个订阅的展示
- v0.2.7
- 面板支持表情显示
- v0.2.6
- :wink: 节日快乐
- 面板稍微添加了一点小小的工作
- v0.2.5
- 前端添加条件搜索
- v0.2.4
- 移除直播间ws监听多余的输出
- 更新前端
- v0.2.0
- 修复历史bug
- 添加网页面板,外部访问请自行配置反向代理服务器
- v0.1.4
- 添加开播提醒,`.env`新增全局配置项`danmaku_group_notice`开关 [#3](https://github.com/zangxx66/nonebot_plugin_blive_danmaku/issues/3)
- 调整日志级别 [#5](https://github.com/zangxx66/nonebot_plugin_blive_danmaku/issues/5)
- v0.1.3
- bot提醒在时间后面加上直播时长显示,避免直播画面没有当前时间的场景
- v0.1.2
- fix局部变量无法正常更新的bug
- v0.1.0
- 基于nonebot2,实现同步路灯弹幕到qq群
## 感谢
- [HarukaBot](https://github.com/SK-415/HarukaBot)
- [blivechat](https://github.com/xfgryujk/blivechat)
- [nonebot2](https://v2.nonebot.dev/)
- [blive-sc-gen](https://github.com/FangDingli/blive-sc-gen)
Raw data
{
"_id": null,
"home_page": "https://github.com/zangxx66/nonebot_plugin_blive_danmaku",
"name": "nonebot-plugin-blive-danmaku",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10,<4.0",
"maintainer_email": "",
"keywords": "nonebot,nonebot2,bilibili,danmaku",
"author": "ricardo",
"author_email": "thespirit@vip.qq.com",
"download_url": "https://files.pythonhosted.org/packages/78/b2/3714ce6c9a42f9ce509bfb372da00bbed8edf2a4871cbe6b4a8a212b6df7/nonebot_plugin_blive_danmaku-0.4.1.tar.gz",
"platform": null,
"description": "<div align=\"center\">\n <a href=\"https://v2.nonebot.dev/store\"><img src=\"doc/nbp_logo.png\" width=\"180\" height=\"180\" alt=\"NoneBotPluginLogo\"></a>\n <br>\n <p><img src=\"doc/NoneBotPlugin.svg\" width=\"240\" alt=\"NoneBotPluginText\"></p>\n</div>\n\n<div align=\"center\"> \n\n# nonebot_plugin_blive_danmaku \n\n_\ud83d\udcab B\u7ad9\u76f4\u64ad\u95f4\u8def\u706f\u63d2\u4ef6 \ud83d\udcab_ \n\n[![pypi](https://img.shields.io/pypi/v/nonebot-plugin-blive-danmaku.svg)](https://pypi.org/project/nonebot-plugin-blive-danmaku/) ![python](https://img.shields.io/pypi/pyversions/nonebot-plugin-blive-danmaku) [![license](https://img.shields.io/github/license/zangxx66/nonebot_plugin_blive_danmaku.svg)](https://raw.githubusercontent.com/zangxx66/nonebot_plugin_blive_danmaku/main/LICENSE) \n\n</div> \n\n## \u7b80\u4ecb \n- \u57fa\u4e8e[nonebot2](https://v2.nonebot.dev/)\u5f00\u53d1\u7684B\u7ad9\u76f4\u64ad\u95f4\u5f39\u5e55\u76d1\u542c\u63d2\u4ef6\uff0c\u53c2\u8003\u4e86Haruka\u548cblivechat\u7684\u90e8\u5206\u4ee3\u7801\u3002 \n- \u8d77\u6e90\u4e8e[\u54c8\u9e7fhallu](https://space.bilibili.com/3493118494116797)\u7684\u4e00\u6761\u52a8\u6001\uff0c\u82e6\u4e8e\u505a\u89c6\u9891\u65f6\u6ca1\u6709\u4eba\u505a\u8def\u706f\uff0c\u7ffb\u5f55\u64ad\u7684\u65f6\u5019\u5934\u90fd\u5927\u4e86\uff0c\u8bf4\u8981\u82b1\u94b1\u8bf7\u4e2a\u5168\u804c\u8def\u706f\uff0c\u6211\u5bfb\u601d\u4e0e\u5176\u628a\u94b1\u9001\u7ed9\u522b\u4eba\uff0c\u4e0d\u5982\u4ea4\u7ed9Bot\u53bb\u505a\u8def\u706f\u3002 \n![](/doc/screenshot1.png)\n- \u8def\u706f\uff1a\u6307\u628a\u76f4\u64ad\u8fc7\u7a0b\u4e2d\u6709\u8da3\u7684\u70b9\u8bb0\u5f55\u4e0b\u6765\uff0c\u7ed9\u526a\u8f91\u6839\u636e\u8bb0\u5f55\u7684\u65f6\u95f4\u70b9\u548c\u5185\u5bb9\u505a\u51fa\u5bf9\u5e94\u7684\u89c6\u9891\u3002\n\n## \u529f\u80fd\n\n- \u7528\u5f39\u5e55\u7684\u5f62\u5f0f\u8bb0\u5f55\u76f4\u64ad\u9ad8\u80fd\u70b9\n- \u5f39\u5e55\u6307\u4ee4\u4e3a`#\u8def\u706f`\u52a0\u4e0a\u8bb0\u5f55\u7684\u5185\u5bb9\n- \u4ec5\u5728\u5f00\u64ad\u65f6\u5f39\u5e55\u6307\u4ee4\u624d\u4f1a\u751f\u6548\n\n## \u4f9d\u8d56 \n\n- Python >= 3.10\n- OneBot V11\n\n## \u5b89\u88c5\n- \u65b9\u5f0f\u4e00\uff1a\u4f7f\u7528`nb-cli`\u5b89\u88c5\u63d2\u4ef6 \n```\nnb plugin install nonebot-plugin-blive-danmaku\n```\n- \u65b9\u5f0f\u4e8c\uff1a\u4f7f\u7528`pip`\u5b89\u88c5\n```\npython -m pip install nonebot-plugin-blive-danmaku\n``` \n## \u914d\u7f6e \n\n|\u540d\u79f0|\u7c7b\u578b|\u9ed8\u8ba4\u503c|\u63cf\u8ff0|\n|-----|-----|-----|-----|\n|danmaku_group_notice|bool|False|\u5168\u5c40\u7fa4\u5f00\u64ad\u63d0\u9192| \n|danmaku_host|str||\u5916\u90e8\u8bbf\u95ee\u5730\u5740\uff0c\u82e5\u914d\u7f6e\u4e86\u516c\u7f51\u8bbf\u95ee\u5730\u5740\u8bf7\u586b\u5199\u6b64\u9879\uff0c\u4ee5\u4fbfbot\u80fd\u591f\u53d1\u9001\u6b63\u786e\u7684\u9762\u677f\u5730\u5740\uff0c\u4f8b\u5982\uff1a`\u201chttp://www.your_domain.com\u201d`\uff0c`\u201chttp://192.168.0.2\"`<br/>\u975e80\uff0c443\u7aef\u53e3\u9700\u8981\u5e26\u4e0a\u7aef\u53e3\u53f7\uff0c\u4f8b\u5982\uff1a`\u201chttp://www.your_domain.com:12450\u201d`\uff0c`\u201chttp://192.168.0.2:12450\"`|\n\n## \u6307\u4ee4\n\n|\u6307\u4ee4|\u8bf4\u660e|\n|------|------|\n|/\u6dfb\u52a0\u8ba2\u9605 UID|UID\u4e3aB\u7ad9\u7528\u6237\u7684uid\uff0c\u4e0d\u662f\u76f4\u64ad\u95f4id\uff0c\u4ee5\u4e0b\u540c\u7406|\n|/\u53d6\u6d88\u8ba2\u9605 UID|\u5220\u9664\u8ba2\u9605|\n|/\u5f00\u542f\u8def\u706f UID|\u5f00\u542f\u76f4\u64ad\u95f4\u5f39\u5e55\u76d1\u542c|\n|/\u5173\u95ed\u8def\u706f UID|\u5173\u95ed\u76f4\u64ad\u95f4\u5f39\u5e55\u76d1\u542c|\n|/\u8ba2\u9605\u5217\u8868|| \n|/\u67e5\u770b\u9762\u677f|\u6253\u5f00\u7f51\u9875\u7248\u67e5\u8be2| \n|/\u5f00\u542f\u7edf\u8ba1 UID|\u5f00\u542f\u5f39\u5e55\u7edf\u8ba1\uff0c\u5305\u542b\u6bcf\u573a\u76f4\u64ad\u5f39\u5e55\u6570\uff0c\u5e73\u5747\u5f39\u5e55\u6570\uff0c\u89c2\u770b\u4eba\u6570\uff0c\u6bcf\u5206\u949f\u5f39\u5e55\u6570\u3002<br/>`\u6ce8\uff1a\u5f00\u542f\u540e\u78c1\u76d8\u5c06\u589e\u52a0\u66f4\u591a\u7684\u5360\u7528\u7a7a\u95f4\uff0c\u5982\u679c\u78c1\u76d8\u7a7a\u95f4\u4e0d\u8db3\u5efa\u8bae\u5173\u95ed\u6570\u636e\u7edf\u8ba1\u3002`|\n|/\u5173\u95ed\u7edf\u8ba1 UID|\u5173\u95ed\u5f39\u5e55\u7edf\u8ba1|\n|/\u5bfc\u5165cookie \u5df2\u767b\u5f55\u8d26\u53f7\u7684cookie|\u6dfb\u52a0\u4e00\u4e2acookie\uff0c\u907f\u514d\u5f39\u5e55\u7528\u6237\u540d\u6253\u7801|\n\n## \u6548\u679c\u9884\u89c8 \n\n![](/doc/screenshot.png) \n![](/doc/screenshot2.png) \n![](/doc/screenshot4.png) \n![](/doc/screenshot5.png) \n![](/doc/screenshot6.png)\n\n## \u53cd\u5411\u4ee3\u7406\uff08\u53ef\u9009\uff0c\u5982\u679c\u9700\u8981\u914d\u7f6e\u5916\u90e8\u7f51\u7edc\u8bbf\u95ee\u9762\u677f\uff09 \n\n> \u8fd9\u91cc\u4ec5\u4ee5\u6700\u7b80\u5355\u7684\u914d\u7f6e\u4e3a\u4f8b\uff0c\u4e0d\u5305\u542bSSL\u8bbf\u95ee \n\nNginx \n\n``` nginx\nserver {\n listen 80;\n server_name www.your_domain.com;\n\n location /danmaku/ {\n proxy_pass http://127.0.0.1:8080/danmaku/;\n proxy_http_version 1.1;\n\t\t\tproxy_set_header Upgrade $http_upgrade;\n\t\t\tproxy_set_header Connection keep-alive;\n\t\t\tproxy_set_header Host $host;\n\t\t\tproxy_set_header X-Real-IP $remote_addr;\n\t\t\tproxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n\t\t\tproxy_cache_bypass $http_upgrade;\n }\n\n location /ws {\n deny all;\n }\n }\n``` \n\nApache \n\n``` apache\n<VirtualHost *:80>\n ServerName www.your_domain.com\n ProxyRequests Off\n ProxyPass \"/danmaku/\" http://127.0.0.1:8080/danmaku/\n ProxyPassReverse \"/danmaku/\" http://127.0.0.1:8080/danmaku/\n</VirtualHost>\n```\n\n## \u66f4\u65b0\u65e5\u5fd7 \n- v0.4.0 \n - \u652f\u6301\u6dfb\u52a0cookie\uff0c\u907f\u514d\u5f39\u5e55\u7528\u6237\u540d\u6253\u7801\n- v0.3.4\n - \u6dfb\u52a0\u8bcd\u4e91 \n - \u65b0\u589e\u9ed1\u6697\u6a21\u5f0f\n- v0.3.3\n - \u4fee\u590d\u5f39\u5e55\u7528\u6237\u540d\u6253\u7801\n - fix [#12](https://github.com/zangxx66/nonebot_plugin_blive_danmaku/issues/12)\n- v0.3.0\n - \u9002\u914dnonebot2 2.0.0\n - \u589e\u52a0\u5f39\u5e55\u7edf\u8ba1\n - \u65b0\u589e\u8bb0\u5f55SuperChat\u5185\u5bb9\uff0c\u53ef\u5728\u9762\u677f\u751f\u6210SuperChat\u56fe\u7247\n - \u66f4\u65b0\u4f9d\u8d56 [#11](https://github.com/zangxx66/nonebot_plugin_blive_danmaku/issues/11)\n- v0.2.9\n - \u9762\u677f\u67e5\u8be2\u5f00\u64ad\u5386\u53f2\u5217\u8868\uff0c\u6807\u9898\u65c1\u5c55\u793a\u8be5\u573a\u76f4\u64ad\u7684\u8def\u706f\u6570\u91cf\n - Bot\u88ab\u8e22\u51fa\u7fa4\u540e\u6e05\u9664\u8be5\u7fa4\u7684\u8ba2\u9605\n - fix\u8def\u706f\u5217\u8868\u641c\u7d22bug\n - Clean Up Code\n- v0.2.8\n - \u5c01\u9762\u5730\u5740\u4e0d\u518d\u7ed1\u5b9aurl\uff0c\u9762\u677f\u5730\u5740\u53d8\u66f4\u5bfc\u81f4\u5c01\u9762\u56fe\u7247\u5f02\u5e38\u7684\u53ef\u624b\u52a8\u6e05\u7406 [#10](https://github.com/zangxx66/nonebot_plugin_blive_danmaku/issues/10)\n - \u9762\u677f\u6dfb\u52a0\u4fa7\u8fb9\u83dc\u5355\u5e94\u5bf9\u591a\u4e2a\u8ba2\u9605\u7684\u5c55\u793a\n- v0.2.7\n - \u9762\u677f\u652f\u6301\u8868\u60c5\u663e\u793a\n- v0.2.6\n - :wink: \u8282\u65e5\u5feb\u4e50 \n - \u9762\u677f\u7a0d\u5fae\u6dfb\u52a0\u4e86\u4e00\u70b9\u5c0f\u5c0f\u7684\u5de5\u4f5c\n- v0.2.5\n - \u524d\u7aef\u6dfb\u52a0\u6761\u4ef6\u641c\u7d22\n- v0.2.4\n - \u79fb\u9664\u76f4\u64ad\u95f4ws\u76d1\u542c\u591a\u4f59\u7684\u8f93\u51fa\n - \u66f4\u65b0\u524d\u7aef\n- v0.2.0\n - \u4fee\u590d\u5386\u53f2bug \n - \u6dfb\u52a0\u7f51\u9875\u9762\u677f\uff0c\u5916\u90e8\u8bbf\u95ee\u8bf7\u81ea\u884c\u914d\u7f6e\u53cd\u5411\u4ee3\u7406\u670d\u52a1\u5668\n- v0.1.4\n - \u6dfb\u52a0\u5f00\u64ad\u63d0\u9192\uff0c`.env`\u65b0\u589e\u5168\u5c40\u914d\u7f6e\u9879`danmaku_group_notice`\u5f00\u5173 [#3](https://github.com/zangxx66/nonebot_plugin_blive_danmaku/issues/3) \n - \u8c03\u6574\u65e5\u5fd7\u7ea7\u522b [#5](https://github.com/zangxx66/nonebot_plugin_blive_danmaku/issues/5)\n- v0.1.3\n - bot\u63d0\u9192\u5728\u65f6\u95f4\u540e\u9762\u52a0\u4e0a\u76f4\u64ad\u65f6\u957f\u663e\u793a\uff0c\u907f\u514d\u76f4\u64ad\u753b\u9762\u6ca1\u6709\u5f53\u524d\u65f6\u95f4\u7684\u573a\u666f\n- v0.1.2\n - fix\u5c40\u90e8\u53d8\u91cf\u65e0\u6cd5\u6b63\u5e38\u66f4\u65b0\u7684bug\n- v0.1.0\n - \u57fa\u4e8enonebot2\uff0c\u5b9e\u73b0\u540c\u6b65\u8def\u706f\u5f39\u5e55\u5230qq\u7fa4 \n\n## \u611f\u8c22\n- [HarukaBot](https://github.com/SK-415/HarukaBot)\n- [blivechat](https://github.com/xfgryujk/blivechat)\n- [nonebot2](https://v2.nonebot.dev/) \n- [blive-sc-gen](https://github.com/FangDingli/blive-sc-gen)\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A danmaku plugin for Nonebot2",
"version": "0.4.1",
"project_urls": {
"Documentation": "https://github.com/zangxx66/nonebot_plugin_blive_danmaku#readme",
"Homepage": "https://github.com/zangxx66/nonebot_plugin_blive_danmaku"
},
"split_keywords": [
"nonebot",
"nonebot2",
"bilibili",
"danmaku"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7aa8eeef9abb992ec0209d7cb11bc231b0276049d78010d548e363bdfc78eb94",
"md5": "9d98f81b74e304a96e058d90df0d734b",
"sha256": "50c83031cc48d02f87e38949b154d62415f8eab5344b07f412aae1c27b42ae3a"
},
"downloads": -1,
"filename": "nonebot_plugin_blive_danmaku-0.4.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9d98f81b74e304a96e058d90df0d734b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10,<4.0",
"size": 642172,
"upload_time": "2023-10-08T08:54:21",
"upload_time_iso_8601": "2023-10-08T08:54:21.863198Z",
"url": "https://files.pythonhosted.org/packages/7a/a8/eeef9abb992ec0209d7cb11bc231b0276049d78010d548e363bdfc78eb94/nonebot_plugin_blive_danmaku-0.4.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "78b23714ce6c9a42f9ce509bfb372da00bbed8edf2a4871cbe6b4a8a212b6df7",
"md5": "1fc167989663889709766e069bc25696",
"sha256": "da05252f500c07a0194262ffcd9a6c435095189dcf39857e43eec6728d5dac04"
},
"downloads": -1,
"filename": "nonebot_plugin_blive_danmaku-0.4.1.tar.gz",
"has_sig": false,
"md5_digest": "1fc167989663889709766e069bc25696",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10,<4.0",
"size": 621593,
"upload_time": "2023-10-08T08:54:24",
"upload_time_iso_8601": "2023-10-08T08:54:24.167349Z",
"url": "https://files.pythonhosted.org/packages/78/b2/3714ce6c9a42f9ce509bfb372da00bbed8edf2a4871cbe6b4a8a212b6df7/nonebot_plugin_blive_danmaku-0.4.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-08 08:54:24",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "zangxx66",
"github_project": "nonebot_plugin_blive_danmaku",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "nonebot-plugin-blive-danmaku"
}