xfgryujk / blivedm Goto Github PK
View Code? Open in Web Editor NEW获取bilibili直播弹幕,使用WebSocket协议,支持web端和B站直播开放平台两种接口
License: MIT License
获取bilibili直播弹幕,使用WebSocket协议,支持web端和B站直播开放平台两种接口
License: MIT License
Python 3.12 无法安装 aiohttp
,官方已经发布 3.9.0 版本修复此问题,需要更新 requirements.txt
:
aiohttp==3.8.6
↓
aiohttp==3.9.0
详见:
在使用了重构后的代码后发现,每秒处理新消息时都新建了一个线程,并所有线程都没有关闭。这就导致了并发情况下会使得线程使用量大量上升,运行久了甚至会使服务器线程占满
B站最近更新了隐私政策,直播监听5分钟左右,会提示‘为保护用户隐私,未注册登陆用户将无法查看他人昵称’,所有用户UID都为0了,大佬能解决一下吗?
room_id=24697117 unknown cmd=LOG_IN_NOTICE, command={'cmd': 'LOG_IN_NOTICE', 'data': {'notice_msg': '为保护用户隐私,未注册登陆用户将无法查看他人昵称', 'image_web': 'http://i0.hdslb.com/bfs/dm/75e7c16b99208df259fe0a93354fd3440cbab412.png', 'image_app': ''}}
https://github.com/yjqiang/danmu
这份代码是 fork 自本项目,但我最近有计划将其打包至 pypi。
license 显示为你的名字我还没改,但是你可以看到基本上这份代码与你的代码没有什么关系了,如果不修改 license 应该很奇怪吧,pypi 里面作者是我, 许可名字却是你。
所以想问一下,如果我打包的话,可否把版权时间 Copyright (c) 2018 xfgryujk 这里,fork你的时间之前,代码版权归你,之后到现在,版权归我。
非常感谢此项目带来的帮助。我在本项目基础上,得以做了很多事情。现在我把websocket封装了起来。但是不太想单独做一个项目了。所以就考虑重新反馈到你这里。所以想问一下你这里还更新么
经过几天的使用,发现通过ws发送过来的消息可能发生了变化。比如,用户进入直播间已经无法捕捉到WELCOME
命令,转而成为了INTERACT_WORD
。
而原先当直播间关注人数发生变化时,会产生ROOM_REAL_TIME_MESSAGE_UPDATE
,现在已经无法接收到该命令(但是在网页端与手机app端,仍然可以观察到xxx关注了直播间这样的消息),所以包数据的解析可能存在遗漏。
忽略ssl证书是一种不安全的行为,所以还不如抛弃ssl,使用2244接口
几乎无法接收到新弹幕,换了多个IP和携带ClientSession登陆态也无法解决。
版本 28645d5
你好,请问一下报这个错误是什么回事啊?win10,python3.10
class 'ssl.SSLError'> [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)
这个很诡异 因为电脑上的chrome正常使用 但是脚本运行就ssl错误,试了好几个电脑了
PC网页直接看直播卡,但是如果获取直播源然后用播放器打开就不卡,问题这样不支持弹幕,blivedm可以显示弹幕,问题是blivedm可以发送弹幕吗?
请教一下,获取弹幕的时候无法拿到用户头像,这个有解决方法吗
很多要重写
如题,DanmakuMessage没看到到相关的东西
看着值好像变长了,阿b又改了
这个仓库的代码真的帮助到我了,希望能够持续更新,感谢您的开源
从来没收到过,一直都是USER_TOAST_MSG
最近有一些不兼容的弹幕消息报错,暂时没空研究,先记一下
{'cmd': 'DANMU_MSG:3:7:1:1:1:1', 'info': [
[0, 7, 100, 16777215, 1701789809186, 0, 0, 'f4dbdf21', 0, None, None, None, 0, '{}', '{}', {'mode': 0, 'show_player_type': 0, 'extra': '{"mode":0,"send_from_me":false,"color":16777215,"dm_type":0,"font_size":100,"player_mode":7,"content":"[1.0,0.0,\\"0.8-0.5\\",10.0,\\"辛苦了\\",0.0,0.0,0.0,0.0,10000,0,true,\\"黑体\\",1]"}'}, None, None],
'[1.0,0.0,"0.8-0.5",10.0,"辛苦了",0.0,0.0,0.0,0.0,10000,0,true,"黑体",1]', [0, '***', 1, 0, 0, 10000, 1, ''], None, [], [], 0, 0, None, {'ts': 1701789809, 'ct': '8DB3B1FF'}, 0, 0, None, None, 0, 0, [0]
], 'dm_v2': ''}
{'cmd': 'DANMU_MSG:3:7:1:1:1:1', 'info': [
[0, 7, 100, 16777215, 1701789899411, 0, 0, 'f4dbdf21', 0, None, None, None, 0, '{}', '{}', {'mode': 0, 'show_player_type': 0, 'extra': '{"mode":0,"send_from_me":false,"color":16777215,"dm_type":0,"font_size":100,"player_mode":7,"content":"[1.0,0.0,\\"0.8-0.5\\",10.0,\\"晚安\\",0.0,0.0,0.0,0.0,10000,0,true,\\"黑体\\",1]"}'}, None, None],
'[1.0,0.0,"0.8-0.5",10.0,"晚安",0.0,0.0,0.0,0.0,10000,0,true,"黑体",1]', [0, '***', 1, 0, 0, 10000, 1, ''], None, [], [], 0, 0, None, {'ts': 1701789899, 'ct': '8045F9DF'}, 0, 0, None, None, 0, 0, [0]
], 'dm_v2': ''}
{'cmd': 'DANMU_MSG:3:7:1:1:1:1', 'info': [
[0, 7, 100, 16777215, 1701866650320, 0, 0, 'f4dbdf21', 0, None, None, None, 0, '{}', '{}', {'mode': 0, 'show_player_type': 0, 'extra': '{"mode":0,"send_from_me":false,"color":16777215,"dm_type":0,"font_size":100,"player_mode":7,"content":"[1.0,0.0,\\"0.8-0.5\\",10.0,\\"了不起\\",0.0,0.0,0.0,0.0,10000,0,true,\\"黑体\\",1]"}'}, None, None],
'[1.0,0.0,"0.8-0.5",10.0,"了不起",0.0,0.0,0.0,0.0,10000,0,true,"黑体",1]', [0, '***', 1, 0, 0, 10000, 1, ''], None, [], [], 0, 0, None, {'ts': 1701866650, 'ct': '6AA2F39E'}, 0, 0, None, None, 0, 0, [0]
], 'dm_v2': ''}
https://github.com/lkeme/BiliHelper/pull/49/files
目前听闻b站直播的弹幕协议启用了2.0,我粗略看了一下,在这里讨论了一些。
前几天B站抽风以后,刚开始获取弹幕的时候能正常显示用户名,过一段时间就变成第一个字+***,类似下图。大佬能修复下吗,求求了
!
无标题
python 3.8 ubuntu 20.04 直播间弹幕无肉眼可见异常
await self._ws.send_bytes(packman.pack(heartbeat(), Operation.HEARTBEAT))
File "/usr/local/lib/python3.8/dist-packages/aiohttp/client_ws.py", line 156, in send_bytes
await self._writer.send(data, binary=True, compress=compress)
File "/usr/local/lib/python3.8/dist-packages/aiohttp/http_websocket.py", line 688, in send
await self._send_frame(message, WSMsgType.BINARY, compress)
File "/usr/local/lib/python3.8/dist-packages/aiohttp/http_websocket.py", line 601, in _send_frame
raise ConnectionResetError("Cannot write to closing transport")
ConnectionResetError: Cannot write to closing transport
Job "BLiver.heartbeat (trigger: interval[0:00:30], next run at: 2022-02-18 00:14:06 CST)" raised an exception
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/apscheduler/executors/base_py3.py", line 30, in run_coroutine_job
retval = await job.func(*job.args, **job.kwargs)
File "/usr/local/lib/python3.8/dist-packages/blive/framework.py", line 147, in heartbeat
await self._ws.send_bytes(packman.pack(heartbeat(), Operation.HEARTBEAT))
File "/usr/local/lib/python3.8/dist-packages/aiohttp/client_ws.py", line 156, in send_bytes
await self._writer.send(data, binary=True, compress=compress)
File "/usr/local/lib/python3.8/dist-packages/aiohttp/http_websocket.py", line 688, in send
await self._send_frame(message, WSMsgType.BINARY, compress)
File "/usr/local/lib/python3.8/dist-packages/aiohttp/http_websocket.py", line 601, in _send_frame
raise ConnectionResetError("Cannot write to closing transport")
ConnectionResetError: Cannot write to closing transport
Job "BLiver.heartbeat (trigger: interval[0:00:30], next run at: 2022-02-18 00:14:36 CST)" raised an exception
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/apscheduler/executors/base_py3.py", line 30, in run_coroutine_job
retval = await job.func(*job.args, **job.kwargs)
File "/usr/local/lib/python3.8/dist-packages/blive/framework.py", line 147, in heartbeat
await self._ws.send_bytes(packman.pack(heartbeat(), Operation.HEARTBEAT))
File "/usr/local/lib/python3.8/dist-packages/aiohttp/client_ws.py", line 156, in send_bytes
await self._writer.send(data, binary=True, compress=compress)
File "/usr/local/lib/python3.8/dist-packages/aiohttp/http_websocket.py", line 688, in send
await self._send_frame(message, WSMsgType.BINARY, compress)
File "/usr/local/lib/python3.8/dist-packages/aiohttp/http_websocket.py", line 601, in _send_frame
raise ConnectionResetError("Cannot write to closing transport")
ConnectionResetError: Cannot write to closing transport
Job "BLiver.heartbeat (trigger: interval[0:00:30], next run at: 2022-02-18 00:15:06 CST)" raised an exception
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/apscheduler/executors/base_py3.py", line 30, in run_coroutine_job
retval = await job.func(*job.args, **job.kwargs)
File "/usr/local/lib/python3.8/dist-packages/blive/framework.py", line 147, in heartbeat
await self._ws.send_bytes(packman.pack(heartbeat(), Operation.HEARTBEAT))
File "/usr/local/lib/python3.8/dist-packages/aiohttp/client_ws.py", line 156, in send_bytes
await self._writer.send(data, binary=True, compress=compress)
File "/usr/local/lib/python3.8/dist-packages/aiohttp/http_websocket.py", line 688, in send
await self._send_frame(message, WSMsgType.BINARY, compress)
File "/usr/local/lib/python3.8/dist-packages/aiohttp/http_websocket.py", line 601, in _send_frame
raise ConnectionResetError("Cannot write to closing transport")
ConnectionResetError: Cannot write to closing transport
^CTraceback (most recent call last):
File "main.py", line 44, in <module>
app.run()
File "/usr/local/lib/python3.8/dist-packages/blive/framework.py", line 176, in run
loop.run_forever()
File "/usr/lib/python3.8/asyncio/base_events.py", line 570, in run_forever
self._run_once()
File "/usr/lib/python3.8/asyncio/base_events.py", line 1823, in _run_once
event_list = self._selector.select(timeout)
File "/usr/lib/python3.8/selectors.py", line 468, in select
fd_event_list = self._selector.poll(timeout, max_ev)
环境:Python 3.11.4
我在尝试连接他人直播间的时候有bilibili返回报错白名单限制,请问这个限制的机制是什么样的,blivechat连接其他主播似乎也没有被限制?
2024-03-21 10:56:57 - e:\GitHub_pro\AI-Vtuber\Miniconda3\lib\site-packages\blivedm\clients\open_live.py[line:172] - ERROR: _start_game() failed:
Traceback (most recent call last):
File "e:\GitHub_pro\AI-Vtuber\Miniconda3\lib\site-packages\blivedm\clients\open_live.py", line 157, in _start_game
async with self._request_open_live(
File "e:\GitHub_pro\AI-Vtuber\Miniconda3\lib\site-packages\aiohttp\client.py", line 1167, in __aenter__
self._resp = await self._coro
File "e:\GitHub_pro\AI-Vtuber\Miniconda3\lib\site-packages\aiohttp\client.py", line 493, in _request
with timer:
File "e:\GitHub_pro\AI-Vtuber\Miniconda3\lib\site-packages\aiohttp\helpers.py", line 725, in __exit__
raise asyncio.TimeoutError from None
asyncio.exceptions.TimeoutError
2024-03-21 10:56:57 - e:\GitHub_pro\AI-Vtuber\Miniconda3\lib\site-packages\blivedm\clients\ws_base.py[line:248] - ERROR: room=None _network_coroutine() finished with exception:
Traceback (most recent call last):
File "e:\GitHub_pro\AI-Vtuber\Miniconda3\lib\site-packages\blivedm\clients\ws_base.py", line 243, in _network_coroutine_wrapper
await self._network_coroutine()
File "e:\GitHub_pro\AI-Vtuber\Miniconda3\lib\site-packages\blivedm\clients\ws_base.py", line 264, in _network_coroutine
await self._on_before_ws_connect(retry_count)
File "e:\GitHub_pro\AI-Vtuber\Miniconda3\lib\site-packages\blivedm\clients\open_live.py", line 271, in _on_before_ws_connect
await super()._on_before_ws_connect(retry_count)
File "e:\GitHub_pro\AI-Vtuber\Miniconda3\lib\site-packages\blivedm\clients\ws_base.py", line 306, in _on_before_ws_connect
raise InitError('init_room() failed')
blivedm.clients.ws_base.InitError: init_room() failed
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.