diff --git a/record/bullet_screen_stream_json/DANMU_MSG(with comment).json b/record/bullet_screen_stream_json/DANMU_MSG(with comment).json index 9046e09..f53c016 100644 --- a/record/bullet_screen_stream_json/DANMU_MSG(with comment).json +++ b/record/bullet_screen_stream_json/DANMU_MSG(with comment).json @@ -32,7 +32,8 @@ 0, //是否是 svip 10000, - 1 + 1, + "" ], //发送者的粉丝勋章有关信息(没有粉丝勋章的发送者, 这个 JsonArray 将是空的) [ @@ -41,9 +42,9 @@ "夏沫", //勋章名称 "乄夏沫丶", - //勋章主播的名字 + //勋章对应的主播的名字 "1547306", - //勋章主播的直播间 + //勋章对应的主播的直播间 16746162, "" ], @@ -62,7 +63,10 @@ "title-131-1" ], 0, - 0 + 0, + { + "uname_color": "" + } ], "cmd": "DANMU_MSG" } diff --git a/record/bullet_screen_stream_json/DANMU_MSG.json b/record/bullet_screen_stream_json/DANMU_MSG.json index 5c3f25c..08f4d88 100644 --- a/record/bullet_screen_stream_json/DANMU_MSG.json +++ b/record/bullet_screen_stream_json/DANMU_MSG.json @@ -19,7 +19,8 @@ 1, 0, 10000, - 1 + 1, + "" ], [ 13, @@ -37,7 +38,10 @@ ], [], 0, - 0 + 0, + { + "uname_color": "" + } ], "cmd": "DANMU_MSG" } diff --git a/src/main/java/com/hiczp/bilibili/api/live/socket/entity/DanMuMsgEntity.java b/src/main/java/com/hiczp/bilibili/api/live/socket/entity/DanMuMsgEntity.java index 718cd75..ef64ad0 100644 --- a/src/main/java/com/hiczp/bilibili/api/live/socket/entity/DanMuMsgEntity.java +++ b/src/main/java/com/hiczp/bilibili/api/live/socket/entity/DanMuMsgEntity.java @@ -15,7 +15,7 @@ public class DanMuMsgEntity implements DataEntity { }.getType(); /** - * info : [[0,1,25,16777215,1510498713,"1510498712",0,"8a0f75dc",0],"网易云音乐库在当前直播间已停留0天0时39分41秒",[39042255,"夏沫丶琉璃浅梦",0,1,0,10000,1],[13,"夏沫","乄夏沫丶","1547306",16746162,""],[41,0,16746162,6603],[],0,0] + * info : [[0,1,25,16777215,1520664535,1662637384,0,"88874b7b",0],"czpnb",[15723776,"Dough君",0,0,0,"10000",1,""],[],[10,0,9868950,">50000"],[],0,0,{"uname_color":""}] * cmd : DANMU_MSG */ @@ -152,4 +152,9 @@ public class DanMuMsgEntity implements DataEntity { public List getUserTitles() { return GSON.fromJson(info.get(5), STRING_LIST_TYPE); } + + //获得用户名颜色 + public String getUsernameColor() { + return info.get(8).getAsJsonObject().get("uname_color").getAsString(); + } } diff --git a/src/test/java/com/hiczp/bilibili/api/test/SendBulletScreenTest.java b/src/test/java/com/hiczp/bilibili/api/test/SendBulletScreenTest.java index 746b14f..eef26d5 100644 --- a/src/test/java/com/hiczp/bilibili/api/test/SendBulletScreenTest.java +++ b/src/test/java/com/hiczp/bilibili/api/test/SendBulletScreenTest.java @@ -5,7 +5,7 @@ import com.hiczp.bilibili.api.live.entity.BulletScreenEntity; import org.junit.Test; public class SendBulletScreenTest { - private static final long ROOM_ID = 29434; + private static final long ROOM_ID = 1110317; private static final BilibiliAPI BILIBILI_API = Config.getBilibiliAPI(); @Test