From 9caecc1cf5bd7b350ab263fdd58e7c577f68b802 Mon Sep 17 00:00:00 2001 From: wbt5 Date: Mon, 5 Jul 2021 00:12:48 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E4=BF=AE=E5=A4=8D=E4=BC=81=E9=B9=85?= =?UTF-8?q?=E7=94=B5=E7=AB=9E=E5=BC=B9=E5=B9=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复:企鹅电竞弹幕解包时,有一类消息type属性为空时导致判断出错的问题。 --- danmu/danmaku/egame.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/danmu/danmaku/egame.py b/danmu/danmaku/egame.py index d03bee3..d1b7d15 100644 --- a/danmu/danmaku/egame.py +++ b/danmu/danmaku/egame.py @@ -51,7 +51,8 @@ class eGame: if body: bin_datas = body['bin_data'] for bin_data in bin_datas: - if bin_data['type'] in (0, 3, 9): + # if bin_data['type'] in (0, 3, 9): + if bin_data.get('type', '') in (0, 3, 9): msg['name'] = bin_data['nick'] msg['content'] = bin_data['content'] msg['msg_type'] = 'danmaku' @@ -230,6 +231,8 @@ class MessageDecode: value, position = self.f9(i, s_position) elif type == 12: value, position = self.f12(i, s_position) + elif type == 13: + value, position = self.f13(i, s_position) i = ''