mirror of
https://github.com/czp3009/bilibili-api.git
synced 2024-12-21 20:30:28 +08:00
增加数据包类型 PK_MATCH, PK_PRE, PK_START, PK_MIC_END
This commit is contained in:
parent
41376bcab1
commit
6e772da153
@ -13,7 +13,7 @@
|
||||
# 添加依赖
|
||||
## Gradle
|
||||
|
||||
compile group: 'com.hiczp', name: 'bilibili-api', version: '0.0.16'
|
||||
compile group: 'com.hiczp', name: 'bilibili-api', version: '0.0.17'
|
||||
|
||||
# 名词解释
|
||||
B站不少参数都是瞎取的, 并且不统一, 经常混用, 以下给出一些常见参数对应的含义
|
||||
@ -329,6 +329,10 @@ API 文档
|
||||
| GuardBuyPackageEvent | 收到 GUARD_BUY 数据包 |
|
||||
| GuardMsgPackageEvent | 收到 GUARD_MSG 数据包 |
|
||||
| LivePackageEvent | 收到 LIVE 数据包 |
|
||||
| PkMatchPackageEvent | 收到 PK_MATCH 数据包 |
|
||||
| PkMicEndPackageEvent | 收到 PK_MIC_END 数据包 |
|
||||
| PkPrePackageEvent | 收到 PK_PRE 数据包 |
|
||||
| PkStartPackageEvent | 收到 PK_START 数据包 |
|
||||
| PreparingPackageEvent | 收到 PREPARING 数据包 |
|
||||
| RaffleEndPackageEvent | 收到 RAFFLE_END 数据包 |
|
||||
| RaffleStartPackageEvent | 收到 RAFFLE_START 数据包 |
|
||||
|
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,6 @@
|
||||
#Wed Jun 27 19:04:23 CST 2018
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
|
||||
|
15
record/bullet_screen_stream_json/PK_MATCH.json
Normal file
15
record/bullet_screen_stream_json/PK_MATCH.json
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"cmd": "PK_MATCH",
|
||||
"pk_status": 100,
|
||||
"pk_id": 3596,
|
||||
"data": {
|
||||
"init_id": 9615419,
|
||||
"match_id": 10185039,
|
||||
"escape_time": 5,
|
||||
"is_portrait": false,
|
||||
"uname": "茉莉艿",
|
||||
"face": "http://i2.hdslb.com/bfs/face/3f2833a3ac598d9757ba33b79ec219cf941bdda8.jpg",
|
||||
"uid": 18963076
|
||||
},
|
||||
"roomid": 9615419
|
||||
}
|
8
record/bullet_screen_stream_json/PK_MIC_END.json
Normal file
8
record/bullet_screen_stream_json/PK_MIC_END.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"cmd": "PK_MIC_END",
|
||||
"pk_id": 3596,
|
||||
"pk_status": 1300,
|
||||
"data": {
|
||||
"type": 0
|
||||
}
|
||||
}
|
15
record/bullet_screen_stream_json/PK_PRE.json
Normal file
15
record/bullet_screen_stream_json/PK_PRE.json
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"cmd": "PK_PRE",
|
||||
"pk_id": 3597,
|
||||
"pk_status": 200,
|
||||
"data": {
|
||||
"init_id": 9615419,
|
||||
"match_id": 10185039,
|
||||
"count_down": 5,
|
||||
"pk_topic": "模仿游戏角色让对方猜",
|
||||
"pk_pre_time": 1529476609,
|
||||
"pk_start_time": 1529476614,
|
||||
"pk_end_time": 1529476914,
|
||||
"end_time": 1529477034
|
||||
}
|
||||
}
|
10
record/bullet_screen_stream_json/PK_START.json
Normal file
10
record/bullet_screen_stream_json/PK_START.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"cmd": "PK_START",
|
||||
"pk_id": 3597,
|
||||
"pk_status": 300,
|
||||
"data": {
|
||||
"init_id": 9615419,
|
||||
"match_id": 10185039,
|
||||
"pk_topic": "模仿游戏角色让对方猜"
|
||||
}
|
||||
}
|
@ -0,0 +1,148 @@
|
||||
package com.hiczp.bilibili.api.live.socket.entity;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class PkMatchEntity implements DataEntity {
|
||||
/**
|
||||
* cmd : PK_MATCH
|
||||
* pk_status : 100
|
||||
* pk_id : 3596
|
||||
* data : {"init_id":9615419,"match_id":10185039,"escape_time":5,"is_portrait":false,"uname":"茉莉艿","face":"http://i2.hdslb.com/bfs/face/3f2833a3ac598d9757ba33b79ec219cf941bdda8.jpg","uid":18963076}
|
||||
* roomid : 9615419
|
||||
*/
|
||||
|
||||
@SerializedName("cmd")
|
||||
private String cmd;
|
||||
@SerializedName("pk_status")
|
||||
private int pkStatus;
|
||||
@SerializedName("pk_id")
|
||||
private long pkId;
|
||||
@SerializedName("data")
|
||||
private Data data;
|
||||
@SerializedName("roomid")
|
||||
private long roomId;
|
||||
|
||||
@Override
|
||||
public String getCmd() {
|
||||
return cmd;
|
||||
}
|
||||
|
||||
public void setCmd(String cmd) {
|
||||
this.cmd = cmd;
|
||||
}
|
||||
|
||||
public int getPkStatus() {
|
||||
return pkStatus;
|
||||
}
|
||||
|
||||
public void setPkStatus(int pkStatus) {
|
||||
this.pkStatus = pkStatus;
|
||||
}
|
||||
|
||||
public long getPkId() {
|
||||
return pkId;
|
||||
}
|
||||
|
||||
public void setPkId(long pkId) {
|
||||
this.pkId = pkId;
|
||||
}
|
||||
|
||||
public Data getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Data data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public long getRoomId() {
|
||||
return roomId;
|
||||
}
|
||||
|
||||
public void setRoomId(long roomId) {
|
||||
this.roomId = roomId;
|
||||
}
|
||||
|
||||
public static class Data {
|
||||
/**
|
||||
* init_id : 9615419
|
||||
* match_id : 10185039
|
||||
* escape_time : 5
|
||||
* is_portrait : false
|
||||
* uname : 茉莉艿
|
||||
* face : http://i2.hdslb.com/bfs/face/3f2833a3ac598d9757ba33b79ec219cf941bdda8.jpg
|
||||
* uid : 18963076
|
||||
*/
|
||||
|
||||
@SerializedName("init_id")
|
||||
private long initId;
|
||||
@SerializedName("match_id")
|
||||
private long matchId;
|
||||
@SerializedName("escape_time")
|
||||
private int escapeTime;
|
||||
@SerializedName("is_portrait")
|
||||
private boolean isPortrait;
|
||||
@SerializedName("uname")
|
||||
private String username;
|
||||
@SerializedName("face")
|
||||
private String face;
|
||||
@SerializedName("uid")
|
||||
private long userId;
|
||||
|
||||
public long getInitId() {
|
||||
return initId;
|
||||
}
|
||||
|
||||
public void setInitId(long initId) {
|
||||
this.initId = initId;
|
||||
}
|
||||
|
||||
public long getMatchId() {
|
||||
return matchId;
|
||||
}
|
||||
|
||||
public void setMatchId(long matchId) {
|
||||
this.matchId = matchId;
|
||||
}
|
||||
|
||||
public int getEscapeTime() {
|
||||
return escapeTime;
|
||||
}
|
||||
|
||||
public void setEscapeTime(int escapeTime) {
|
||||
this.escapeTime = escapeTime;
|
||||
}
|
||||
|
||||
public boolean isIsPortrait() {
|
||||
return isPortrait;
|
||||
}
|
||||
|
||||
public void setIsPortrait(boolean isPortrait) {
|
||||
this.isPortrait = isPortrait;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getFace() {
|
||||
return face;
|
||||
}
|
||||
|
||||
public void setFace(String face) {
|
||||
this.face = face;
|
||||
}
|
||||
|
||||
public long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
package com.hiczp.bilibili.api.live.socket.entity;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class PkMicEndEntity implements DataEntity {
|
||||
/**
|
||||
* cmd : PK_MIC_END
|
||||
* pk_id : 3596
|
||||
* pk_status : 1300
|
||||
* data : {"type":0}
|
||||
*/
|
||||
|
||||
@SerializedName("cmd")
|
||||
private String cmd;
|
||||
@SerializedName("pk_id")
|
||||
private long pkId;
|
||||
@SerializedName("pk_status")
|
||||
private int pkStatus;
|
||||
@SerializedName("data")
|
||||
private Data data;
|
||||
|
||||
@Override
|
||||
public String getCmd() {
|
||||
return cmd;
|
||||
}
|
||||
|
||||
public void setCmd(String cmd) {
|
||||
this.cmd = cmd;
|
||||
}
|
||||
|
||||
public long getPkId() {
|
||||
return pkId;
|
||||
}
|
||||
|
||||
public void setPkId(long pkId) {
|
||||
this.pkId = pkId;
|
||||
}
|
||||
|
||||
public int getPkStatus() {
|
||||
return pkStatus;
|
||||
}
|
||||
|
||||
public void setPkStatus(int pkStatus) {
|
||||
this.pkStatus = pkStatus;
|
||||
}
|
||||
|
||||
public Data getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Data data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static class Data {
|
||||
/**
|
||||
* type : 0
|
||||
*/
|
||||
|
||||
@SerializedName("type")
|
||||
private int type;
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,148 @@
|
||||
package com.hiczp.bilibili.api.live.socket.entity;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class PkPreEntity implements DataEntity {
|
||||
/**
|
||||
* cmd : PK_PRE
|
||||
* pk_id : 3597
|
||||
* pk_status : 200
|
||||
* data : {"init_id":9615419,"match_id":10185039,"count_down":5,"pk_topic":"模仿游戏角色让对方猜","pk_pre_time":1529476609,"pk_start_time":1529476614,"pk_end_time":1529476914,"end_time":1529477034}
|
||||
*/
|
||||
|
||||
@SerializedName("cmd")
|
||||
private String cmd;
|
||||
@SerializedName("pk_id")
|
||||
private long pkId;
|
||||
@SerializedName("pk_status")
|
||||
private int pkStatus;
|
||||
@SerializedName("data")
|
||||
private Data data;
|
||||
|
||||
@Override
|
||||
public String getCmd() {
|
||||
return cmd;
|
||||
}
|
||||
|
||||
public void setCmd(String cmd) {
|
||||
this.cmd = cmd;
|
||||
}
|
||||
|
||||
public long getPkId() {
|
||||
return pkId;
|
||||
}
|
||||
|
||||
public void setPkId(long pkId) {
|
||||
this.pkId = pkId;
|
||||
}
|
||||
|
||||
public int getPkStatus() {
|
||||
return pkStatus;
|
||||
}
|
||||
|
||||
public void setPkStatus(int pkStatus) {
|
||||
this.pkStatus = pkStatus;
|
||||
}
|
||||
|
||||
public Data getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Data data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static class Data {
|
||||
/**
|
||||
* init_id : 9615419
|
||||
* match_id : 10185039
|
||||
* count_down : 5
|
||||
* pk_topic : 模仿游戏角色让对方猜
|
||||
* pk_pre_time : 1529476609
|
||||
* pk_start_time : 1529476614
|
||||
* pk_end_time : 1529476914
|
||||
* end_time : 1529477034
|
||||
*/
|
||||
|
||||
@SerializedName("init_id")
|
||||
private long initId;
|
||||
@SerializedName("match_id")
|
||||
private long matchId;
|
||||
@SerializedName("count_down")
|
||||
private int countDown;
|
||||
@SerializedName("pk_topic")
|
||||
private String pkTopic;
|
||||
@SerializedName("pk_pre_time")
|
||||
private long pkPreTime;
|
||||
@SerializedName("pk_start_time")
|
||||
private long pkStartTime;
|
||||
@SerializedName("pk_end_time")
|
||||
private long pkEndTime;
|
||||
@SerializedName("end_time")
|
||||
private long endTime;
|
||||
|
||||
public long getInitId() {
|
||||
return initId;
|
||||
}
|
||||
|
||||
public void setInitId(long initId) {
|
||||
this.initId = initId;
|
||||
}
|
||||
|
||||
public long getMatchId() {
|
||||
return matchId;
|
||||
}
|
||||
|
||||
public void setMatchId(long matchId) {
|
||||
this.matchId = matchId;
|
||||
}
|
||||
|
||||
public int getCountDown() {
|
||||
return countDown;
|
||||
}
|
||||
|
||||
public void setCountDown(int countDown) {
|
||||
this.countDown = countDown;
|
||||
}
|
||||
|
||||
public String getPkTopic() {
|
||||
return pkTopic;
|
||||
}
|
||||
|
||||
public void setPkTopic(String pkTopic) {
|
||||
this.pkTopic = pkTopic;
|
||||
}
|
||||
|
||||
public long getPkPreTime() {
|
||||
return pkPreTime;
|
||||
}
|
||||
|
||||
public void setPkPreTime(long pkPreTime) {
|
||||
this.pkPreTime = pkPreTime;
|
||||
}
|
||||
|
||||
public long getPkStartTime() {
|
||||
return pkStartTime;
|
||||
}
|
||||
|
||||
public void setPkStartTime(long pkStartTime) {
|
||||
this.pkStartTime = pkStartTime;
|
||||
}
|
||||
|
||||
public long getPkEndTime() {
|
||||
return pkEndTime;
|
||||
}
|
||||
|
||||
public void setPkEndTime(long pkEndTime) {
|
||||
this.pkEndTime = pkEndTime;
|
||||
}
|
||||
|
||||
public long getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(long endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
package com.hiczp.bilibili.api.live.socket.entity;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class PkStartEntity implements DataEntity {
|
||||
/**
|
||||
* cmd : PK_START
|
||||
* pk_id : 3597
|
||||
* pk_status : 300
|
||||
* data : {"init_id":9615419,"match_id":10185039,"pk_topic":"模仿游戏角色让对方猜"}
|
||||
*/
|
||||
|
||||
@SerializedName("cmd")
|
||||
private String cmd;
|
||||
@SerializedName("pk_id")
|
||||
private long pkId;
|
||||
@SerializedName("pk_status")
|
||||
private int pkStatus;
|
||||
@SerializedName("data")
|
||||
private Data data;
|
||||
|
||||
@Override
|
||||
public String getCmd() {
|
||||
return cmd;
|
||||
}
|
||||
|
||||
public void setCmd(String cmd) {
|
||||
this.cmd = cmd;
|
||||
}
|
||||
|
||||
public long getPkId() {
|
||||
return pkId;
|
||||
}
|
||||
|
||||
public void setPkId(long pkId) {
|
||||
this.pkId = pkId;
|
||||
}
|
||||
|
||||
public int getPkStatus() {
|
||||
return pkStatus;
|
||||
}
|
||||
|
||||
public void setPkStatus(int pkStatus) {
|
||||
this.pkStatus = pkStatus;
|
||||
}
|
||||
|
||||
public Data getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Data data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static class Data {
|
||||
/**
|
||||
* init_id : 9615419
|
||||
* match_id : 10185039
|
||||
* pk_topic : 模仿游戏角色让对方猜
|
||||
*/
|
||||
|
||||
@SerializedName("init_id")
|
||||
private long initId;
|
||||
@SerializedName("match_id")
|
||||
private long matchId;
|
||||
@SerializedName("pk_topic")
|
||||
private String pkTopic;
|
||||
|
||||
public long getInitId() {
|
||||
return initId;
|
||||
}
|
||||
|
||||
public void setInitId(long initId) {
|
||||
this.initId = initId;
|
||||
}
|
||||
|
||||
public long getMatchId() {
|
||||
return matchId;
|
||||
}
|
||||
|
||||
public void setMatchId(long matchId) {
|
||||
this.matchId = matchId;
|
||||
}
|
||||
|
||||
public String getPkTopic() {
|
||||
return pkTopic;
|
||||
}
|
||||
|
||||
public void setPkTopic(String pkTopic) {
|
||||
this.pkTopic = pkTopic;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.hiczp.bilibili.api.live.socket.event;
|
||||
|
||||
import com.hiczp.bilibili.api.live.socket.LiveClient;
|
||||
import com.hiczp.bilibili.api.live.socket.entity.PkMatchEntity;
|
||||
|
||||
public class PkMatchPackageEvent extends ReceiveDataPackageEvent<PkMatchEntity> {
|
||||
public PkMatchPackageEvent(LiveClient source, PkMatchEntity entity) {
|
||||
super(source, entity);
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.hiczp.bilibili.api.live.socket.event;
|
||||
|
||||
import com.hiczp.bilibili.api.live.socket.LiveClient;
|
||||
import com.hiczp.bilibili.api.live.socket.entity.PkMicEndEntity;
|
||||
|
||||
public class PkMicEndPackageEvent extends ReceiveDataPackageEvent<PkMicEndEntity> {
|
||||
public PkMicEndPackageEvent(LiveClient source, PkMicEndEntity entity) {
|
||||
super(source, entity);
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.hiczp.bilibili.api.live.socket.event;
|
||||
|
||||
import com.hiczp.bilibili.api.live.socket.LiveClient;
|
||||
import com.hiczp.bilibili.api.live.socket.entity.PkPreEntity;
|
||||
|
||||
public class PkPrePackageEvent extends ReceiveDataPackageEvent<PkPreEntity> {
|
||||
public PkPrePackageEvent(LiveClient source, PkPreEntity entity) {
|
||||
super(source, entity);
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.hiczp.bilibili.api.live.socket.event;
|
||||
|
||||
import com.hiczp.bilibili.api.live.socket.LiveClient;
|
||||
import com.hiczp.bilibili.api.live.socket.entity.PkStartEntity;
|
||||
|
||||
public class PkStartPackageEvent extends ReceiveDataPackageEvent<PkStartEntity> {
|
||||
public PkStartPackageEvent(LiveClient source, PkStartEntity entity) {
|
||||
super(source, entity);
|
||||
}
|
||||
}
|
@ -111,6 +111,23 @@ public class LiveClientHandler extends SimpleChannelInboundHandler<Package> {
|
||||
eventCreationExpression = () -> new WelcomeGuardPackageEvent(liveClient, GSON.fromJson(jsonObject, WelcomeGuardEntity.class));
|
||||
}
|
||||
break;
|
||||
//PK
|
||||
case "PK_MATCH": {
|
||||
eventCreationExpression = () -> new PkMatchPackageEvent(liveClient, GSON.fromJson(jsonObject, PkMatchEntity.class));
|
||||
}
|
||||
break;
|
||||
case "PK_PRE": {
|
||||
eventCreationExpression = () -> new PkPrePackageEvent(liveClient, GSON.fromJson(jsonObject, PkPreEntity.class));
|
||||
}
|
||||
break;
|
||||
case "PK_START": {
|
||||
eventCreationExpression = () -> new PkStartPackageEvent(liveClient, GSON.fromJson(jsonObject, PkStartEntity.class));
|
||||
}
|
||||
break;
|
||||
case "PK_MIC_END": {
|
||||
eventCreationExpression = () -> new PkMicEndPackageEvent(liveClient, GSON.fromJson(jsonObject, PkMicEndEntity.class));
|
||||
}
|
||||
break;
|
||||
//系统消息(小电视等)
|
||||
case "SYS_MSG": {
|
||||
eventCreationExpression = () -> new SysMsgPackageEvent(liveClient, GSON.fromJson(jsonObject, SysMsgEntity.class));
|
||||
|
Loading…
Reference in New Issue
Block a user