blivechat
blivechat copied to clipboard
【BUG】房间号连接的时候,同一弹幕出现1000次以上的时候的「DANMU_MSG:3:7:1:1:1:1」消息会导致blivechat报错
报错内容:
2023-12-07 21:23:10,741 ERROR [blivedm]: room=22347054 _handle_command() failed, command={'cmd': 'DANMU_MSG:3:7:1:1:1:1', 'info': [[0, 7, 100, 16777215, 1701955389592, 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,\"www\",0.0,0.0,0.0,0.0,10000,0,true,\"黑体\",1]"}'}, None, None], '[1.0,0.0,"0.8-0.5",10.0,"www",0.0,0.0,0.0,0.0,10000,0,true,"黑体",1]', [0, '', 1, 0, 0, 10000, 1, ''], None, [], [], 0, 0, None, {'ts': 1701955389, 'ct': '69596489'}, 0, 0, None, None, 0, 0, [0]], 'dm_v2': ''} Traceback (most recent call last): File "/root/blivechat/blivedm/blivedm/clients/ws_base.py", line 486, in _handle_command self._handler.handle(self, command) File "/root/blivechat/blivedm/blivedm/handlers.py", line 131, in handle callback(self, client, command) File "/root/blivechat/blivedm/blivedm/handlers.py", line 71, in __danmu_msg_callback client, web_models.DanmakuMessage.from_command(command['info'], command.get('dm_v2', '')) File "/root/blivechat/blivedm/blivedm/models/web.py", line 130, in from_command if len(info[3]) != 0: TypeError: object of type 'NoneType' has no len() 2023-12-07 21:29:39,542 ERROR [blivedm]: room=22347054 _handle_command() failed, command={'cmd': 'DANMU_MSG:3:7:1:1:1:1', 'info': [[0, 7, 100, 16777215, 1701955776995, 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,\"308\",0.0,0.0,0.0,0.0,10000,0,true,\"黑体\",1]"}'}, None, None], '[1.0,0.0,"0.8-0.5",10.0,"308",0.0,0.0,0.0,0.0,10000,0,true,"黑体",1]', [0, '', 1, 0, 0, 10000, 1, ''], None, [], [], 0, 0, None, {'ts': 1701955776, 'ct': 'A0A7AD40'}, 0, 0, None, None, 0, 0, [0]], 'dm_v2': ''} Traceback (most recent call last): File "/root/blivechat/blivedm/blivedm/clients/ws_base.py", line 486, in _handle_command self._handler.handle(self, command) File "/root/blivechat/blivedm/blivedm/handlers.py", line 131, in handle callback(self, client, command) File "/root/blivechat/blivedm/blivedm/handlers.py", line 71, in __danmu_msg_callback client, web_models.DanmakuMessage.from_command(command['info'], command.get('dm_v2', '')) File "/root/blivechat/blivedm/blivedm/models/web.py", line 130, in from_command if len(info[3]) != 0: TypeError: object of type 'NoneType' has no len() 2023-12-07 21:32:19,349 ERROR [blivedm]: room=22347054 _handle_command() failed, command={'cmd': 'DANMU_MSG:3:7:1:1:1:1', 'info': [[0, 7, 100, 16777215, 1701955936354, 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,\"强强nano\",0.0,0.0,0.0,0.0,10000,0,true,\"黑体\",1]"}'}, None, None], '[1.0,0.0,"0.8-0.5",10.0,"强强nano",0.0,0.0,0.0,0.0,10000,0,true,"黑体",1]', [0, '***', 1, 0, 0, 10000, 1, ''], None, [], [], 0, 0, None, {'ts': 1701955936, 'ct': 'DF3CD9BA'}, 0, 0, None, None, 0, 0, [0]], 'dm_v2': ''} Traceback (most recent call last): File "/root/blivechat/blivedm/blivedm/clients/ws_base.py", line 486, in _handle_command self._handler.handle(self, command) File "/root/blivechat/blivedm/blivedm/handlers.py", line 131, in handle callback(self, client, command) File "/root/blivechat/blivedm/blivedm/handlers.py", line 71, in __danmu_msg_callback client, web_models.DanmakuMessage.from_command(command['info'], command.get('dm_v2', '')) File "/root/blivechat/blivedm/blivedm/models/web.py", line 130, in from_command if len(info[3]) != 0: TypeError: object of type 'NoneType' has no len()
自己抓了一下消息,相同弹幕1000次的时候会丢一个这个消息过来,同时表示粉丝牌信息的info[3]为None。
开弹幕的时候大概会有一个非常大的弹幕飘过去,不知道是不是这个消息。
可以考虑直接丢弃掉,毕竟这玩意不表示也可以。。
目前我抓弹幕数据,好像只有这种情况才会【DANMU_MSG:3:7:1:1:1:1】这个消息。
已知,这个报错不影响功能。我猜是给那个+1的新功能做的
https://github.com/xfgryujk/blivedm/issues/46
B站自己也没处理,前端遇到这种消息时会报错。我建议直接忽略,不然要把content那堆JSON展示出来吗