From 6978a732f64a8a2e626a66c3dba8164c94672e6e Mon Sep 17 00:00:00 2001 From: liminqi <736361931@qq.com> Date: Fri, 3 Feb 2023 03:29:49 +0000 Subject: [PATCH 1/4] =?UTF-8?q?Python=E8=AE=BF=E9=97=AEws=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 简易Python客户端/ws.py | 48 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 简易Python客户端/ws.py diff --git a/简易Python客户端/ws.py b/简易Python客户端/ws.py new file mode 100644 index 0000000..344849c --- /dev/null +++ b/简易Python客户端/ws.py @@ -0,0 +1,48 @@ +from websocket import connection +import json + +def ck(data):#type2 + txt=data.get("Data") + load_data=json.loads(txt) + print("感谢"+load_data.get("Content")) + +def welcome(data):#type3 + json1=data.get("Data") + Nickname=json.loads(json1) + json2=Nickname.get("User") + print("欢迎:"+json2["Nickname"]) + +def thank(data):#type5 + txt=data.get("Data") + load_data=json.loads(txt) + print("感谢"+load_data.get("Content")) + +def check(data):#type6 + txt=data.get("Data") + load_data=json.loads(txt) + print(load_data.get("Content")) + +def main(): + try: + ws = create_connection("ws://127.0.0.1:8888") + ws.send("token") + while(True): + result = ws.recv() + load_data=json.loads(result) + type=load_data.get("Type")#标签类型 + if type==1:#1用户发言 + msg(load_data) + elif type==2:#2用户点赞 + ck(load_data) + elif type==3:#3用户入房 + welcome(load_data) + elif type==4:#用户关注 + print(str(load_data)) + elif type==5:#5用户礼物 + thank(load_data) + elif type==6:#6人数统计 + check(load_data) + ws.close() + except: + ws.close +main() \ No newline at end of file From 5c87e38870cf99e69945455c8b0b27273bf7f265 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=85=E6=B5=A9=E4=B8=9C?= <1083092844@qq.com> Date: Mon, 13 Feb 2023 09:21:28 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=B7=BB=E5=8A=A0Demos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- {简易Python客户端 => Demos/Python}/ws.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {简易Python客户端 => Demos/Python}/ws.py (100%) diff --git a/简易Python客户端/ws.py b/Demos/Python/ws.py similarity index 100% rename from 简易Python客户端/ws.py rename to Demos/Python/ws.py From 7a24334619f853458847dc44bea6f2c00ec8208a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=85=E6=B5=A9=E4=B8=9C?= <1083092844@qq.com> Date: Mon, 13 Feb 2023 09:31:50 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=9C=AA=E8=83=BD=E8=AF=86=E5=88=AB?= =?UTF-8?q?=E7=9A=84=E7=A4=BC=E7=89=A9ID=E6=B7=BB=E5=8A=A0=E6=8F=90?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BarrageGrab/WssBarrageGrab.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/BarrageGrab/WssBarrageGrab.cs b/BarrageGrab/WssBarrageGrab.cs index 872306e..f852964 100644 --- a/BarrageGrab/WssBarrageGrab.cs +++ b/BarrageGrab/WssBarrageGrab.cs @@ -17,6 +17,7 @@ namespace BarrageGrab { FiddlerProxy proxy = new FiddlerProxy(); Appsetting appsetting = Appsetting.Get(); + ConsoleWriter console = new ConsoleWriter(); /// /// 进入直播间 @@ -187,6 +188,7 @@ namespace BarrageGrab } else { + console.WriteLine("未能识别的礼物ID:" + arg.giftId, ConsoleColor.Red); break; } } From b44d96871ba968987bf3577b3bbe32dec96f7027 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=85=E6=B5=A9=E4=B8=9C?= <1083092844@qq.com> Date: Mon, 13 Feb 2023 09:34:43 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=9C=AA=E8=83=BD=E8=AF=86=E5=88=AB?= =?UTF-8?q?=E7=A4=BC=E7=89=A9ID=E7=BB=99=E5=87=BA=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E5=8F=B0=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BarrageGrab/WssBarrageGrab.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/BarrageGrab/WssBarrageGrab.cs b/BarrageGrab/WssBarrageGrab.cs index f852964..8d2a961 100644 --- a/BarrageGrab/WssBarrageGrab.cs +++ b/BarrageGrab/WssBarrageGrab.cs @@ -7,6 +7,7 @@ using System.Text; using System.Threading.Tasks; using BarrageGrab.ProtoEntity; using ProtoBuf; +using ColorConsole; namespace BarrageGrab {