1 Star 0 Fork 1

xfgryujk / blivechat

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

blivechat

用于OBS的仿YouTube风格的bilibili直播评论栏

OBS截图
Chrome截图
样式生成器截图

特性

  • 兼容YouTube直播评论栏的样式
  • 付费礼物模仿醒目留言显示
  • 高亮舰队、房管、主播的用户名
  • 支持屏蔽弹幕、合并相似弹幕等设置
  • 自带两种样式生成器,经典YouTube风格和仿微信风格
  • 支持前端直连B站服务器或者通过后端转发
  • 支持自动翻译弹幕、醒目留言到日语,可以在后台配置翻译目标语言
  • 支持标注打赏用户名的读音,可选拼音或日文假名
  • 支持配置自定义表情,不需要开通B站官方表情

使用方法

以下几种方式任选一种即可

一、本地使用

  1. 下载发布版(仅提供x64 Windows版)
  2. 双击blivechat.exe运行服务器,或者用命令行可以指定host和端口号:
    blivechat.exe --host 127.0.0.1 --port 12450
  3. 用浏览器打开http://localhost:12450,输入房间ID,复制房间URL
  4. 用样式生成器生成样式,复制CSS
  5. 在OBS中添加浏览器源,输入URL和自定义CSS

注意事项:

  • 本地使用时不要关闭blivechat.exe那个黑框,否则不能继续获取头像或弹幕
  • 样式生成器没有列出所有本地字体,但是可以手动输入本地字体
  • 如果需要使用翻译功能,建议看配置官方翻译接口傻瓜式教程

二、公共服务器

请优先在本地使用,使用公共服务器会有更大的延迟,而且服务器故障时可能发生直播事故

三、源代码版(自建服务器或在Windows以外平台)

  1. 由于使用了git子模块,clone时需要加上--recursive参数:
    git clone --recursive https://github.com/xfgryujk/blivechat.git
    如果已经clone,拉子模块的方法:
    git submodule update --init --recursive
  2. 编译前端(需要安装Node.js):
    cd frontend
    npm i
    npm run build
  3. 运行服务器(需要Python3.6以上版本):
    pip3 install -r requirements.txt
    python3 main.py
    或者可以指定host和端口号:
    python3 main.py --host 127.0.0.1 --port 12450
  4. 用浏览器打开http://localhost:12450,以下略

四、Docker(自建服务器)

  1. docker run --name blivechat -d -p 12450:12450 \
      --mount source=blivechat-data,target=/mnt/data \
      xfgryujk/blivechat:latest
  2. 用浏览器打开http://localhost:12450,以下略

自建服务器相关补充

服务器配置

服务器配置在data/config.ini,可以配置数据库和允许自动翻译等,编辑后要重启生效

自建服务器时强烈建议不使用加载器,否则可能因为混合HTTP和HTTPS等原因加载不出来

参考nginx配置

sudo vim /etc/nginx/sites-enabled/blivechat.conf

upstream blivechat {
	keepalive 8;
	# blivechat地址
	server 127.0.0.1:12450;
}

# 强制HTTPS
server {
	listen 80;
	listen [::]:80;
	server_name YOUR.DOMAIN.NAME;

	return 301 https://$server_name$request_uri;
}

server {
	listen 443 ssl;
	listen [::]:443 ssl;
	server_name YOUR.DOMAIN.NAME;

	# SSL
	ssl_certificate /PATH/TO/CERT.crt;
	ssl_certificate_key /PATH/TO/CERT_KEY.key;

	client_body_buffer_size 256k;
	client_max_body_size 1.1m;

	# 代理header
	proxy_http_version 1.1;
	proxy_set_header Host $host;
	proxy_set_header Connection "";
	proxy_set_header X-Real-IP $remote_addr;
	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

	# 静态文件
	location / {
		root /PATH/TO/BLIVECHAT/frontend/dist;
		# 如果文件不存在,交给前端路由
		try_files $uri $uri/ /index.html;
	}
	location /emoticons {
		alias /PATH/TO/BLIVECHAT/data/emoticons;
	}
	# 动态API
	location /api {
		proxy_pass http://blivechat;
	}
	# websocket
	location = /api/chat {
		proxy_pass http://blivechat;

		# 代理websocket必须设置
		proxy_set_header Upgrade $http_upgrade;
		proxy_set_header Connection "Upgrade";

		# 由于这个块有proxy_set_header,这些不会自动继承
		proxy_set_header Host $host;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	}
}
MIT License Copyright (c) 2019 xfgryujk Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

用于OBS的仿YouTube风格的bilibili直播评论栏 展开 收起
JavaScript
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
JavaScript
1
https://gitee.com/xfgryujk/blivechat.git
git@gitee.com:xfgryujk/blivechat.git
xfgryujk
blivechat
blivechat
master

搜索帮助