准备用 kotlin 重构

This commit is contained in:
czp3009 2019-02-15 18:14:27 +08:00
parent d014c80c56
commit 4b9d03aade
231 changed files with 113 additions and 23671 deletions

483
README.md
View File

@ -1,483 +1,8 @@
# Bilibili API 调用库
该项目提供 Bilibili API 的 Java 调用, 协议来自 Bilibili Android APP 的逆向工程以及截包分析.
# Bilibili API JVM 调用库
该项目提供 Bilibili API 的 JVM 调用, 协议来自 Bilibili Android APP 的逆向工程以及截包分析.
由于B站即使更新客户端, 也会继续兼容以前的旧版本客户端, 所以短期内不用担心 API 失效的问题.
对于一些 Bilibili Android APP 上没有的功能, 可以先[将 token 转换为 cookie](#sso), 然后再去调用 Bilibili Web API.
# API 不完全
由于本项目还在开发初期, 大量 API 没有完成, 所以很可能没有你想要的 API.
欢迎提交 issue 或者 Merge Request.
# 添加依赖
## Gradle
compile group: 'com.hiczp', name: 'bilibili-api', version: '0.0.20'
# 名词解释
B站不少参数都是瞎取的, 并且不统一, 经常混用, 以下给出一些常见参数对应的含义
| 参数 | 含义 |
| :--- | :--- |
| mid | 用户 ID(与 userId 含义一致, 经常被混用) |
| userId | 用户 ID, 用户在B站的唯一标识, 数字 |
| uid | 用户 ID, 与 userId 同义 |
| userid | 注意这里是全小写, 它的值可能是 'bili_1178318619', 这个东西是没用的, B站并不用这个作为用户唯一标识 |
| showRoomId | 直播间 URL (Web)上的房间号(可能是一个很小的数字, 低于 1000) |
| roomId | 直播间的真实 ID(直播房间号在 1000 以下的房间, 真实 ID 是另外一个数字) |
| cid | 直播间 ID(URL 上的短房间号以及真实房间号都叫 cid) |
| ruid | 直播间房主的用户 ID |
| rcost | 该房间内消费的瓜子数量 |
(上表仅供其他开发者参照, 本调用库中已经封装为 Java 标准全写小驼峰命名法, 例如 userId, roomId, roomUserId)
# 使用
## RESTFul API
由于B站 API 设计清奇, 一些显然不需要登录的 API 也需要登录, 所以所有 API 尽可能登陆后访问以免失败.
### 登录
使用账户名和密码作为登录参数
String username = "yourUsername";
String password = "yourPassword";
BilibiliAPI bilibiliAPI = new BilibiliAPI();
LoginResponseEntity loginResponseEntity = bilibiliAPI.login(String username, String password);
IOException 在网络故障时抛出
LoginException 在用户名密码不匹配时抛出
CaptchaMismatchException 在验证码不正确时抛出, 见下文 [验证码问题](#验证码问题) 一节
login 方法的返回值为 LoginResponseEntity 类型, 使用
BilibiliAccount bilibiliAccount = loginResponseEntity.toBilibiliAccount();
来获得一个 BilibiliAccount 实例, 其中包含了 OAuth2 的用户凭证, 如果有需要, 可以将其持久化保存.
将一个登陆状态恢复出来(从之前保存的 BilibiliAccount 实例)使用如下代码
BilibiliAPI bilibiliAPI = new BilibiliAPI(BilibiliAccount bilibiliAccount);
注意, 如果这个 BilibiliAccount 实例含有的 accessToken 是错误的或者过期的, 需要鉴权的 API 将全部 401.
### 刷新 Token
OAuth2 的重要凭证有两个, token 与 refreshToken, token 到期之后, 并不需要再次用用户名密码登录一次, 仅需要用 refreshToken 刷新一次 token 即可(会得到新的 token 和 refreshToken, refreshToken 的有效期不是无限的. B站的 refreshToken 有效期不明确).
bilibiliAPI.refreshToken();
IOException 在网络故障时抛出
LoginException 在 token 错误,或者 refreshToken 错误或过期时抛出.
refreshToken 操作在正常情况下将在服务器返回 401(实际上 B站 不用 401 来表示未登录)时自动进行, 因此 BilibiliAPI 内部持有的 BilibiliAccount 的实例的内容可能会发生改变, 如果需要在应用关闭时持久化用户 token, 需要这样来取得最后的 BilibiliAccount 状态
BilibiliAccount bilibiliAccount = bilibiliAPI.getBilibiliAccount();
### 登出
bilibiliAPI.logout();
IOException 在网络故障时抛出
LoginException 在 accessToken 错误或过期时抛出
### 验证码问题
当对一个账户在短时间内(时长不明确)尝试多次错误的登录(密码错误)后, 再尝试登录该账号, 会被要求验证码.
此时登录操作会抛出 CaptchaMismatchException 异常, 表示必须调用另一个接口
public LoginResponseEntity login(String username,
String password,
String captcha,
String cookie) throws IOException, LoginException, CaptchaMismatchException
这个接口将带 captcha 参数地去登录, 注意这里还有一个 cookie 参数.
下面先给出一段正确使用该接口的代码, 随后会解释其步骤
String username = "yourUsername";
String password = "yourPassword";
BilibiliAPI bilibiliAPI = new BilibiliAPI();
try {
bilibiliAPI.login(username, password);
} catch (CaptchaMismatchException e) { //如果该账号现在需要验证码来进行登录, 就会抛出异常
cookie = "sid=123456"; //自己造一个 cookie 或者从服务器取得
Response response = bilibiliAPI.getCaptchaService()
.getCaptcha(cookie)
.execute();
InputStream inputStream = response.body().byteStream();
String captcha = letUserInputCaptcha(inputStream); //让用户根据图片输入验证码
bilibiliAPI.login(
username,
password,
captcha,
cookie
);
}
验证码是通过访问 https://passport.bilibili.com/captcha 这个地址获得的.
访问这个地址需要带有一个 cookie, cookie 里面要有 "sid=xxx", 然后服务端会记录下对应关系, 也就是 sid xxx 对应验证码 yyy, 然后就可以验证了.
我们会发现, 访问任何 passport.bilibili.com 下面的地址, 都会被分发一个 cookie, 里面带有 sid 的值. 我们访问 /captcha 也会被分发一个 cookie, 但是这个通过访问 captcha 而被分发得到的 cookie 和访问得到的验证码图片, 没有对应关系. 推测是因为 cookie 的发放在请求进入甚至模块运行完毕后才进行.
所以我们如果不带 cookie 去访问 /captcha, 我们这样拿到的由 /captcha 返回的 cookie 和 验证码, 是不匹配的.
所以我们要先从其他地方获取一个 cookie.
我们可以用 /api/oauth2/getKey(获取加密密码用的 hash 和公钥) 来获取一个 cookie
String cookie = bilibiliAPI.getPassportService()
.getKey()
.execute()
.headers()
.get("Set-cookie");
/captcha 不验证 cookie 正确性, 我们可以直接使用假的 cookie (比如 123456)对其发起验证码请求, 它会记录下这个假的 cookie 和 验证码 的对应关系, 一样能验证成功. 但是不推荐这么做.
简单地说, 只要我们是带 cookie 访问 /captcha 的, 那么我们得到的验证码, 是和这个 cookie 绑定的. 我们接下去用这个 cookie 和 这个验证码的值 去进行带验证码的登录, 就可以成功登陆.
至于验证码怎么处理, 可以显示给最终用户, 让用户来输入, 或者用一些预训练模型自动识别验证码.
这个带验证码的登录接口也会继续抛出 CaptchaMismatchException, 如果验证码输入错误的话.
### SSO
通过 SSO API 可以将 accessToken 转为 cookie, 用 cookie 就可以访问 B站 的 Web API.
B站客户端内置的 WebView 就是通过这种方式来工作的(WebView 访问页面时, 处于登录状态).
首先, 我们需要登录
String username = "yourUsername";
String password = "yourPassword";
BilibiliAPI bilibiliAPI = new BilibiliAPI();
bilibiliAPI.login(String username, String password);
通过
bilibiliAPI.toCookies();
来得到对应的 cookies, 类型为 Map<String, List\<Cookie>>, key 为 domain(可能是通配类型的, 例如 ".bilibili.com"), value 为此 domain 对应的 cookies.
如果只想得到用于进行 SSO 操作的那条 URL, 可以这么做
String goUrl = "https://account.bilibili.com/account/home";
bilibiliAPI.getSsoUrl(goUrl);
返回值是一个 HttpUrl, 里面 url 的值差不多是这样的
https://passport.bilibili.com/api/login/sso?access_key=c3bf6002bd2e539f5bfce56308f14789&appkey=1d8b6e7d45233436&build=515000&gourl=https%3A%2F%2Faccount.bilibili.com%2Faccount%2Fhome&mobi_app=android&platform=android&ts=1520079995&sign=654e2d00aa827aa1d7acef6fbeb9ee70
如果 access_key 是正确的话, 这个 url 访问一下就登录 B站 了.
如果想跟 B站 客户端一样弄一个什么内嵌 WebView 的话, 这个 API 就可以派上用场(只需要在 WebView 初始化完毕后让 WebView 去访问这个 url, 就登陆了)(goUrl 可以是任意值, 全部的 302 重定向完成后将进入这个地址, 如果 goUrl 不存在或为空则将跳转到B站首页).
### Web API
上文讲到, 通过 SSO API, 可以将 token 转为 cookie, 在本项目中, Web API 封装在 BilibiliWebAPI 中, 可以通过如下方式得到一个已经登录了的 BilibiliWebAPI 实例
String username = "yourUsername";
String password = "yourPassword";
BilibiliAPI bilibiliAPI = new BilibiliAPI();
bilibiliAPI.login(String username, String password);
BilibiliWebAPI bilibiliWebAPI = bilibiliAPI.getBilibiliWebAPI();
IOException 在网络错误时抛出(获取 cookie 时需要进行网络请求)
如果将之前的 bilibiliAPI.toCookies() 的返回值(cookiesMap)持久化了下来的话, 下次可以通过以下方式直接获得一个已经登录了的 BilibiliWebAPI 实例(注意, cookie 没有 refreshToken 机制, 过期不会自动刷新, 因此不推荐持久化 cookie)
Map<String, List<Cookie>> cookiesMap = bilibiliAPI.toCookies();
//序列化后存储
//...
//反序列化后得到上次存储的 cookiesMap
BilibiliWebAPI bilibiliWebAPI = new BilibiliWebAPI(cookiesMap);
有了 BilibiliWebAPI 实例之后, 通过类似以下代码的形式来获取对应的 Service, API 调用方法和基于 Token 方式的 API 一致
LiveService liveService = bilibiliWebAPI.getLiveService();
(这个 LiveService 是 Web API 里的 LiveService)
由于 Web API 是有状态的, 每个 BilibiliWebAPI 内部维护的 CookieJar 是同一个, 一些验证有关的 API 可能会改变 cookie.
通过以下代码来获得一个 BilibiliWebAPI 中目前持有的 CookieJar 的引用
bilibiliWebAPI.getCookieJar();
### API 调用示例
打印一个直播间的历史弹幕
long roomId = 3;
new BilibiliAPI()
.getLiveService()
.getHistoryBulletScreens(roomId)
.execute()
.body()
.getData()
.getRoom()
.forEach(liveHistoryBulletScreenEntity ->
System.out.printf("[%s]%s: %s\n",
liveHistoryBulletScreenEntity.getTimeline(),
liveHistoryBulletScreenEntity.getNickname(),
liveHistoryBulletScreenEntity.getText())
);
签到
String username = "yourUsername";
String password = "yourPassword";
BilibiliAPI bilibiliAPI = new BilibiliAPI();
bilibiliAPI.login(username, password);
bilibiliAPI.getLiveService()
.getSignInfo()
.execute();
发送一条弹幕到指定直播间
long roomId = 3;
String username = "yourUsername";
String password = "yourPassword";
BilibiliAPI bilibiliAPI = new BilibiliAPI();
bilibiliAPI.login(username, password);
bilibiliAPI.getLiveService()
.sendBulletScreen(
new BulletScreenEntity(
roomId,
bilibiliAPI.getBilibiliAccount().getUserId(), //实际上并不需要包含 mid 就可以正常发送弹幕, 但是真实的 Android 客户端确实发送了 mid
"这是自动发送的弹幕"
)
)
.execute();
(如果要调用需要鉴权的 API, 需要先登录)
API 文档
//TODO 文档编写中
## Socket
### 获取直播间实时弹幕
long roomId = 3;
EventLoopGroup eventLoopGroup = new NioEventLoopGroup();
LiveClient liveClient = new BilibiliAPI()
.getLiveClient(eventLoopGroup, roomId)
.registerListener(new MyListener())
.connect();
.connect() 会抛出 IOException 当网络故障时.
(connect 是阻塞的)
使用 .getLiveClient() 前可以先登录也可以不登陆直接用, 如果 API 已经登录, 那么进房数据包中会带有用户ID, 尚不明确有什么作用, 可能与一些统计有关.
多个 LiveClient 可以复用同一个 EventLoopGroup.
(connect 方法运行结束只代表 socket 确实是连上了, 但是服务器还没有响应进房请求数据包)
(当服务器响应进房请求数据包时才代表真的连上了, 此时会有一个连接成功的事件, 见下文)
事件机制使用 Google Guava EventBus 实现, 监听器不需要继承任何类或者接口.
public class MyListener {
@Subscribe
public void onConnectSucceed(ConnectSucceedEvent connectSucceedEvent) {
//do something
}
@Subscribe
public void onConnectionClose(ConnectionCloseEvent connectionCloseEvent) {
//do something
}
@Subscribe
public void onDanMuMsg(DanMuMsgPackageEvent danMuMsgPackageEvent) {
DanMuMsgEntity danMuMsgEntity = danMuMsgPackageEvent.getEntity();
System.out.pintf("%s: %s\n", danMuMsgEntity.getUsername(), danMuMsgEntity.getMessage());
}
}
如果持续 40 秒(心跳包为 30 秒)没有收到任何消息, 将视为掉线, 会跟服务器主动断开连接一样(这通常是发送了服务器无法读取的数据包)触发一次 ConnectionCloseEvent.
liveClient.closeChannel();
即可阻塞关闭连接.
liveClient.closeChannelAsync();
即可异步关闭连接.
eventLoopGroup.shutdownGracefully();
即可关闭事件循环, 结束 Nio 工作线程(所有使用这个 EventLoopGroup 的 LiveClient 也将在此时被关闭).
如果需要在直播间发送弹幕可以直接使用如下代码(需要先登录)
String message = "这是一条弹幕";
liveClient.sendBulletScreen(message);
所有的事件(有些数据包我也不知道它里面的一些值是什么含义, /record 目录下面有抓取到的 Json, 可以用来查看):
| 事件 | 抛出条件 | 含义 |
| :--- | :--- | :--- |
| ActivityEventPackageEvent | 收到 ACTIVITY_EVENT 数据包 | 活动事件 |
| ChangeRoomInfoPackageEvent | 收到 CHANGE_ROOM_INFO 数据包 | 更换房间背景图片 |
| ComboEndPackageEvent | 收到 COMBO_END 数据包 | 礼物连发结束 |
| ComboSendPackageEvent | 收到 COMBO_SEND 数据包 | 礼物连发开始 |
| ConnectionCloseEvent | 连接断开(主动或被动) | |
| ConnectSucceedEvent | 进房成功 | |
| CutOffPackageEvent | 收到 CUT_OFF 数据包 | 被 B站 管理员强制中断 |
| DanMuMsgPackageEvent | 收到 DANMU_MSG 数据包 | 弹幕消息 |
| EntryEffectPackageEvent | 收到 ENTRY_EFFECT 数据包 | 尚不明确 |
| EventCmdPackageEvent | 收到 EVENT_CMD 数据包 | 尚不明确 |
| GuardBuyPackageEvent | 收到 GUARD_BUY 数据包 | 船票购买 |
| GuardLotteryStartPackageEvent | 收到 GUARD_LOTTERY_START 数据包 | 船票购买后的抽奖活动 |
| GuardMsgPackageEvent | 收到 GUARD_MSG 数据包 | 舰队消息(登船) |
| LivePackageEvent | 收到 LIVE 数据包 | 开始直播 |
| NoticeMsgPackageEvent | 收到 NOTICE_MSG 数据包 | 获得大奖的通知消息 |
| PkAgainPackageEvent | 收到 PK_AGAIN 数据包 | 下面几个都是 PK 有关的事件 |
| PkClickAgainPackageEvent | 收到 PK_CLICK_AGAIN 数据包 |
| PkEndPackageEvent | 收到 PK_END 数据包 |
| PkInviteFailPackageEvent | 收到 PK_INVITE_FAIL 数据包 |
| PkInviteInitPackageEvent | 收到 PK_INVITE_INIT 数据包 |
| PkInviteSwitchClosePackageEvent | 收到 PK_INVITE_SWITCH_CLOSE 数据包 |
| PkInviteSwitchOpenPackageEvent | 收到 PK_INVITE_SWITCH_OPEN 数据包 |
| PkMatchPackageEvent | 收到 PK_MATCH 数据包 |
| PkMicEndPackageEvent | 收到 PK_MIC_END 数据包 |
| PkPrePackageEvent | 收到 PK_PRE 数据包 |
| PkProcessPackageEvent | 收到 PK_PROCESS 数据包 |
| PkSettlePackageEvent | 收到 PK_SETTLE 数据包 |
| PkStartPackageEvent | 收到 PK_START 数据包 |
| PreparingPackageEvent | 收到 PREPARING 数据包 | 停止直播 |
| RaffleEndPackageEvent | 收到 RAFFLE_END 数据包 | 抽奖结束(小奖, 通常是不定期活动) |
| RaffleStartPackageEvent | 收到 RAFFLE_START 数据包 | 抽奖开始(小奖) |
| ReceiveDataPackageDebugEvent | 该事件用于调试, 收到任何 Data 数据包时都会触发 | |
| RoomAdminsPackageEvent | 收到 ROOM_ADMINS 数据包 | 房管变更 |
| RoomBlockMsgPackageEvent | 收到 ROOM_BLOCK_MSG 数据包 | 房间黑名单(房间管理员添加了一个用户到黑名单) |
| RoomLockPackageEvent | 收到 ROOM_LOCK 数据包 | 房间被封 |
| RoomRankPackageEvent | 收到 ROOM_RANK 数据包 | 小时榜 |
| RoomShieldPackageEvent | 收到 ROOM_SHIELD 数据包 | 房间屏蔽 |
| RoomSilentOffPackageEvent | 收到 ROOM_SILENT_OFF 数据包 | 房间结束禁言 |
| RoomSilentOnPackageEvent | 收到 ROOM_SILENT_ON 数据包 | 房间开启了禁言(禁止某一等级以下的用户发言) |
| SendGiftPackageEvent | 收到 SEND_GIFT 数据包 | 送礼 |
| SendHeartBeatPackageEvent | 每次发送心跳包后触发一次 | |
| SpecialGiftPackageEvent | 收到 SPECIAL_GIFT 数据包 | 节奏风暴(20 倍以下的)(只在对应房间内有, 不会全站广播) |
| SysGiftPackageEvent | 收到 SYS_GIFT 数据包 | 系统礼物(20 倍以上节奏风暴, 活动抽奖等) |
| SysMsgPackageEvent | 收到 SYS_MSG 数据包 | 系统消息(小电视等) |
| TVEndPackageEvent | 收到 TV_END 数据包 | 小电视抽奖结束(大奖的获得者信息) |
| TVStartPackageEvent | 收到 TV_START 数据包 | 小电视抽奖开始 |
| UnknownPackageEvent | B站新增了新种类的数据包, 出现此情况请提交 issue | |
| ViewerCountPackageEvent | 收到 房间人数 数据包(不是 Json) | |
| WarningPackageEvent | 收到 WARNING 数据包 | 警告信息 |
| WelcomeActivityPackageEvent | 收到 WELCOME_ACTIVITY 数据包 | 欢迎(活动) |
| WelcomePackageEvent | 收到 WELCOME 数据包 | 欢迎(通常是 VIP) |
| WelcomeGuardPackageEvent | 收到 WELCOME_GUARD 数据包 | 欢迎(舰队) |
| WishBottlePackageEvent | 收到 WISH_BOTTLE 数据包 | 许愿瓶 |
事件里面可以取到解析好的 POJO, 然后可以从里面取数据, 见上面的监听器示例.
# 特别说明
## DANMU_MSG 中的各个字段含义
在直播间实时弹幕推送流中, 存在一种类型为 DANMU_MSG 的数据包, 它里面存储的 JSON, 全部都是 JsonArray, 并且每个元素类型不一样, 含义不一样.
简单地说, 这个 JSON 完全无法自描述而且很多字段猜不到是什么含义, 它的示例见 /record 文件夹(还有一份带备注的版本, 里面记录了已经猜出的字段含义).
已经猜出的字段, 可以直接从 DanMuMsgEntity 里面用对应的方法取得, 对于没有猜出的字段, 需要类似这样来获取:
int something = danMuMsgEntity.getInfo().get(0).getAsJsonArray().get(2).getAsInt();
如果你可以明确其中的字段含义, 欢迎提交 issue.
## 直播间 ID 问题
一个直播间, 我们用浏览器去访问它, 他可能是这样的
http://live.bilibili.com/3
我们可能会以为后面的 3 就是这个直播间的 room_id, 其实并不是.
我们能直接看到的这个号码, 其实是 show_room_id.
所有直播间号码小于 1000 的直播间, show_room_id 和 room_id 是不相等的(room_id 在不少 API 里又叫 cid).
一些 API 能提供自动跳转功能, 也就是用这个 show_room_id 作为参数, 返回的信息是跳转到对应的 room_id 之后的返回信息.
简单地说, 一些 API 用 show_room_id 作为参数可以正常工作, 而另一些不能. 所以尽可能使用 room_id 作为参数来调用 API.
room_id 的获取要通过
http://api.live.bilibili.com/AppRoom/index?room_id=3&platform=android
其中, response.data.room_id 就是其真实的 room_id, 例子中的这个直播间的真实 room_id 为 23058
在代码中我们这样做
long showRoomId = 3;
long roomId = bilibiliAPI.getLiveService()
.getRoomInfo(showRoomId)
.execute()
.body()
.getData()
.getRoomId();
由此, 我们获得了直播间的真实 room_id, 用它访问其他 API 就不会出错了.
## 服务器返回非 0 返回值时
当服务器返回的 JSON 中的 code 字段非 0 时(有错误发生), 该 JSON 可能是由服务端过滤器统一返回的, 因此其 JSON 格式(字段类型)将和实体类不一样, 此时会导致 JsonParseErrorException.
为了让调用代码不需要写很多 try catch, 因此当服务器返回的 code 非 0 时, 封装好的 OkHttpClientInterceptor 将把 data 字段变为 null(发生错误时, data 字段没有实际有效的数据).
因此只需要判断 code 是否是 0 即可知道 API 是否成功执行, 不需要异常捕获.
(B站所有 API 无论是否执行成功, HttpStatus 都是 200, 判断 HTTP 状态码是无用的, 必须通过 JSON 中的 code 字段来知道 API 是否执行成功).
# 测试
测试前需要先设置用户名和密码, 在 src/test/resources 目录下, 找到 config-template.json, 将其复制一份到同目录下并命名为 config.json 然后填写其中的字段即可.
本项目使用 JUnit 作为单元测试框架. 命令行只需要执行
gradle test
如果要在 IDEA 上进行测试, 需要运行 test 目录中的 RuleSuite 类(在 IDEA 中打开这个类, 点击行号上的重叠的两个向右箭头图标).
# 继续开发
如果您想加入到开发中, 欢迎提交 Merge Request.
本项目的 Http 请求全部使用 Retrofit 完成, 因此请求的地址和参数需要放在接口中统一管理, 如果您对 Retrofit 不是很熟悉, 可以看[这篇文章](http://square.github.io/retrofit/).
服务器返回值将被 Gson 转换为 Java POJO(Entity), 通过[这篇文章](https://github.com/google/gson/blob/master/UserGuide.md)来了解 Gson.
POJO 使用 IDEA 插件 [GsonFormat](https://plugins.jetbrains.com/plugin/7654-gsonformat) 自动化生成, 而非手动编写, 并且尽可能避免对自动生成的结果进行修改以免导致可能出现混淆或含义不明确的情况.
(插件必须开启 "use SerializedName" 选项从而保证字段名符合小驼峰命名法)
由于 B站 一些 JSON 是瞎鸡巴来的, 比如可能出现以下这种情况
"list": [
{
"name": "value",
},
...
]
此时自动生成的类型将是
List<List> lists
因此必须要为内层元素指定一个具有语义的名称, 例如 Name, 此时类型变为
List<Name> names
API 尽可能按照 UI 位置来排序, 例如
侧拉抽屉 -> 直播中心 -> 我的关注
这是 "直播中心" 页面的第一个可点击控件, 那么下一个 API 或 API 组就应该是第二个可点击组件 "观看历史".
和 UI 不对应的 API, 按照执行顺序排序, 例如进入直播间会按顺序访问一系列 API, 这些 API 就按照时间顺序排序.
对于不知道怎么排的 API, 瞎鸡巴排就好了.
# 重构
使用 Kotlin 重构中...
# License
GPL V3

View File

@ -1,109 +1,35 @@
buildscript {
ext {
kotlin_version = '1.3.21'
jvm_target = JavaVersion.VERSION_1_10
}
repositories {
gradlePluginPortal()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
group = 'com.hiczp'
version = '0.0.22'
description = 'Bilibili android client API library written in Java'
version = '0.1.0'
description = 'Bilibili Android client API library for Kotlin'
apply plugin: 'idea'
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'signing'
sourceCompatibility = 1.8
apply plugin: 'kotlin'
repositories {
mavenCentral()
}
//kotlin
dependencies {
// https://mvnrepository.com/artifact/com.squareup.retrofit2/retrofit
compile group: 'com.squareup.retrofit2', name: 'retrofit', version: '2.4.0'
// https://mvnrepository.com/artifact/com.squareup.retrofit2/converter-gson
compile group: 'com.squareup.retrofit2', name: 'converter-gson', version: '2.4.0'
// https://mvnrepository.com/artifact/com.google.code.gson/gson
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.5'
// https://mvnrepository.com/artifact/com.squareup.okhttp3/logging-interceptor
compile group: 'com.squareup.okhttp3', name: 'logging-interceptor', version: '3.11.0'
// https://mvnrepository.com/artifact/org.slf4j/slf4j-api
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25'
// https://mvnrepository.com/artifact/io.netty/netty-all
compile group: 'io.netty', name: 'netty-all', version: '4.1.29.Final'
// https://mvnrepository.com/artifact/com.google.guava/guava
compile group: 'com.google.guava', name: 'guava', version: '26.0-jre'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
}
dependencies {
// https://mvnrepository.com/artifact/junit/junit
testCompile group: 'junit', name: 'junit', version: '4.12'
// https://mvnrepository.com/artifact/org.slf4j/slf4j-log4j12
testCompile group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.7.25'
compileKotlin {
kotlinOptions.jvmTarget = jvm_target
}
task sourcesJar(type: Jar, dependsOn: classes) {
description 'Package source code to jar,'
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
description 'Package javadoc to jar,'
classifier = 'javadoc'
from javadoc
}
artifacts {
archives sourcesJar
archives javadocJar
}
signing {
required { gradle.taskGraph.hasTask(uploadArchives) }
sign configurations.archives
}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment ->
signing.signPom(deployment)
}
if (!project.hasProperty('ossUsername')) {
ext.ossUsername = ''
}
if (!project.hasProperty('ossPassword')) {
ext.ossPassword = ''
}
repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2/') {
authentication(userName: ossUsername, password: ossPassword)
}
pom.project {
name project.name
description project.description
url 'https://github.com/czp3009/bilibili-api'
scm {
connection 'scm:git@github.com:czp3009/bilibili-api.git'
developerConnection 'scm:git@github.com:czp3009/bilibili-api.git'
url 'git@github.com:czp3009/bilibili-api.git'
}
licenses {
license {
name 'GNU GENERAL PUBLIC LICENSE Version 3'
url 'https://www.gnu.org/licenses/gpl-3.0.txt'
}
}
developers {
developer {
id 'czp'
//noinspection SpellCheckingInspection
name 'ZhiPeng Chen'
email 'czp3009@gmail.com'
url 'https://www.hiczp.com/'
}
}
}
}
}
compileTestKotlin {
kotlinOptions.jvmTarget = jvm_target
}

Binary file not shown.

View File

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2-all.zip

View File

@ -1,6 +0,0 @@
package com.hiczp.bilibili.api;
public class BaseUrlDefinition {
public static final String PASSPORT = "https://passport.bilibili.com/";
public static final String LIVE = "https://api.live.bilibili.com/";
}

View File

@ -1,439 +0,0 @@
package com.hiczp.bilibili.api;
import com.hiczp.bilibili.api.interceptor.*;
import com.hiczp.bilibili.api.live.LiveService;
import com.hiczp.bilibili.api.live.socket.LiveClient;
import com.hiczp.bilibili.api.passport.CaptchaService;
import com.hiczp.bilibili.api.passport.PassportService;
import com.hiczp.bilibili.api.passport.SsoService;
import com.hiczp.bilibili.api.passport.entity.InfoEntity;
import com.hiczp.bilibili.api.passport.entity.LoginResponseEntity;
import com.hiczp.bilibili.api.passport.entity.LogoutResponseEntity;
import com.hiczp.bilibili.api.passport.entity.RefreshTokenResponseEntity;
import com.hiczp.bilibili.api.passport.exception.CaptchaMismatchException;
import com.hiczp.bilibili.api.provider.*;
import com.hiczp.bilibili.api.web.BilibiliWebAPI;
import com.hiczp.bilibili.api.web.BrowserProperties;
import com.hiczp.bilibili.api.web.cookie.SimpleCookieJar;
import io.netty.channel.EventLoopGroup;
import okhttp3.*;
import okhttp3.logging.HttpLoggingInterceptor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.security.auth.login.LoginException;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
public class BilibiliAPI implements BilibiliServiceProvider, BilibiliCaptchaProvider, BilibiliSsoProvider, BilibiliWebAPIProvider, LiveClientProvider {
private static final Logger LOGGER = LoggerFactory.getLogger(BilibiliAPI.class);
private final Long apiInitTime = Instant.now().getEpochSecond(); //记录当前类被实例化的时间
private final BilibiliClientProperties bilibiliClientProperties;
private final BilibiliAccount bilibiliAccount;
private Boolean autoRefreshToken = true;
//用于阻止进行多次错误的 refreshToken 操作
private String invalidToken;
private String invalidRefreshToken;
private PassportService passportService;
private CaptchaService captchaService;
private LiveService liveService;
private BilibiliWebAPI bilibiliWebAPI;
public BilibiliAPI() {
this.bilibiliClientProperties = BilibiliClientProperties.defaultSetting();
this.bilibiliAccount = BilibiliAccount.emptyInstance();
}
public BilibiliAPI(BilibiliClientProperties bilibiliClientProperties) {
this.bilibiliClientProperties = bilibiliClientProperties;
this.bilibiliAccount = BilibiliAccount.emptyInstance();
}
public BilibiliAPI(BilibiliSecurityContext bilibiliSecurityContext) {
this.bilibiliClientProperties = BilibiliClientProperties.defaultSetting();
this.bilibiliAccount = new BilibiliAccount(bilibiliSecurityContext);
}
public BilibiliAPI(BilibiliClientProperties bilibiliClientProperties, BilibiliSecurityContext bilibiliSecurityContext) {
this.bilibiliClientProperties = bilibiliClientProperties;
this.bilibiliAccount = new BilibiliAccount(bilibiliSecurityContext);
}
@Override
public PassportService getPassportService() {
if (passportService == null) {
passportService = getPassportService(Collections.emptyList(), HttpLoggingInterceptor.Level.BASIC);
}
return passportService;
}
public PassportService getPassportService(@Nonnull List<Interceptor> interceptors, @Nonnull HttpLoggingInterceptor.Level logLevel) {
OkHttpClient.Builder okHttpClientBuilder = new OkHttpClient.Builder();
//TODO 不明确客户端访问 passport.bilibili.com 时使用的 UA
okHttpClientBuilder
.addInterceptor(new AddFixedHeadersInterceptor(
"Buvid", bilibiliClientProperties.getBuvId(),
"User-Agent", "bili-universal/6560 CFNetwork/894 Darwin/17.4.0" //这是 IOS UA
))
.addInterceptor(new AddDynamicHeadersInterceptor(
() -> "Display-ID", () -> String.format("%s-%d", bilibiliAccount.getUserId() == null ? bilibiliClientProperties.getBuvId() : bilibiliAccount.getUserId(), apiInitTime)
))
.addInterceptor(new AddFixedParamsInterceptor(
"build", bilibiliClientProperties.getBuild(),
"mobi_app", "android",
"platform", "android"
))
.addInterceptor(new AddDynamicParamsInterceptor(
() -> "ts", () -> Long.toString(Instant.now().getEpochSecond())
))
.addInterceptor(new AddAppKeyInterceptor(bilibiliClientProperties))
.addInterceptor(new SortParamsAndSignInterceptor(bilibiliClientProperties))
.addInterceptor(new ErrorResponseConverterInterceptor());
interceptors.forEach(okHttpClientBuilder::addInterceptor);
okHttpClientBuilder
.addNetworkInterceptor(new HttpLoggingInterceptor().setLevel(logLevel));
return new Retrofit.Builder()
.baseUrl(BaseUrlDefinition.PASSPORT)
.addConverterFactory(GsonConverterFactory.create())
.client(okHttpClientBuilder.build())
.build()
.create(PassportService.class);
}
@Override
public LiveService getLiveService() {
if (liveService == null) {
liveService = getLiveService(Collections.emptyList(), HttpLoggingInterceptor.Level.BASIC);
}
return liveService;
}
public LiveService getLiveService(@Nonnull List<Interceptor> interceptors, @Nonnull HttpLoggingInterceptor.Level logLevel) {
OkHttpClient.Builder okHttpClientBuilder = new OkHttpClient.Builder();
okHttpClientBuilder
.addInterceptor(new AddFixedHeadersInterceptor(
"Buvid", bilibiliClientProperties.getBuvId(),
"User-Agent", String.format("Mozilla/5.0 BiliDroid/%s (bbcallen@gmail.com)", bilibiliClientProperties.getSimpleVersion()),
"Device-ID", bilibiliClientProperties.getHardwareId()
))
.addInterceptor(new AddDynamicHeadersInterceptor(
//Display-ID 的值在未登录前为 Buvid-客户端启动时间, 在登录后为 mid-客户端启动时间
() -> "Display-ID", () -> String.format("%s-%d", bilibiliAccount.getUserId() == null ? bilibiliClientProperties.getBuvId() : bilibiliAccount.getUserId(), apiInitTime)
))
.addInterceptor(new AddFixedParamsInterceptor(
"_device", "android",
"_hwid", bilibiliClientProperties.getHardwareId(),
"actionKey", "appkey",
"build", bilibiliClientProperties.getBuild(),
"mobi_app", "android",
"platform", "android",
"scale", bilibiliClientProperties.getScale(),
"src", "google",
"version", bilibiliClientProperties.getVersion()
))
.addInterceptor(new AddDynamicParamsInterceptor(
() -> "ts", () -> Long.toString(Instant.now().getEpochSecond()),
() -> "trace_id", () -> new SimpleDateFormat("yyyyMMddHHmm000ss").format(new Date())
))
.addInterceptor(new AddAppKeyInterceptor(bilibiliClientProperties))
.addInterceptor(new AutoRefreshTokenInterceptor(
this,
ServerErrorCode.Common.UNAUTHORIZED,
ServerErrorCode.Live.USER_NO_LOGIN,
ServerErrorCode.Live.PLEASE_LOGIN,
ServerErrorCode.Live.PLEASE_LOGIN0,
ServerErrorCode.Live.NO_LOGIN
))
.addInterceptor(new AddAccessKeyInterceptor(bilibiliAccount))
.addInterceptor(new SortParamsAndSignInterceptor(bilibiliClientProperties))
.addInterceptor(new ErrorResponseConverterInterceptor());
interceptors.forEach(okHttpClientBuilder::addInterceptor);
okHttpClientBuilder
.addNetworkInterceptor(new HttpLoggingInterceptor().setLevel(logLevel));
return new Retrofit.Builder()
.baseUrl(BaseUrlDefinition.LIVE)
.addConverterFactory(GsonConverterFactory.create())
.client(okHttpClientBuilder.build())
.build()
.create(LiveService.class);
}
@Override
public CaptchaService getCaptchaService() {
if (captchaService == null) {
captchaService = getCaptchaService(Collections.emptyList(), HttpLoggingInterceptor.Level.BASIC);
}
return captchaService;
}
public CaptchaService getCaptchaService(@Nonnull List<Interceptor> interceptors, @Nonnull HttpLoggingInterceptor.Level logLevel) {
OkHttpClient.Builder okHttpClientBuilder = new OkHttpClient.Builder();
interceptors.forEach(okHttpClientBuilder::addInterceptor);
okHttpClientBuilder.addInterceptor(new HttpLoggingInterceptor().setLevel(logLevel));
return new Retrofit.Builder()
.baseUrl(BaseUrlDefinition.PASSPORT)
.client(okHttpClientBuilder.build())
.build()
.create(CaptchaService.class);
}
public SsoService getSsoService() {
return getSsoService(new SimpleCookieJar());
}
//sso 需要保存 cookie, 不对 SsoService 进行缓存
@Override
public SsoService getSsoService(CookieJar cookieJar) {
return getSsoService(cookieJar, Collections.emptyList(), HttpLoggingInterceptor.Level.BASIC);
}
public SsoService getSsoService(@Nonnull CookieJar cookieJar, @Nonnull List<Interceptor> interceptors, @Nonnull HttpLoggingInterceptor.Level logLevel) {
OkHttpClient.Builder okHttpClientBuilder = new OkHttpClient.Builder();
okHttpClientBuilder
.cookieJar(cookieJar)
.addInterceptor(new AddFixedParamsInterceptor(
"build", bilibiliClientProperties.getBuild(),
"mobi_app", "android",
"platform", "android"
))
.addInterceptor(new AddDynamicParamsInterceptor(
() -> "ts", () -> Long.toString(Instant.now().getEpochSecond())
))
.addInterceptor(new AddAccessKeyInterceptor(bilibiliAccount))
.addInterceptor(new AddAppKeyInterceptor(bilibiliClientProperties))
.addInterceptor(new SortParamsAndSignInterceptor(bilibiliClientProperties));
interceptors.forEach(okHttpClientBuilder::addInterceptor);
okHttpClientBuilder
.addNetworkInterceptor(new HttpLoggingInterceptor().setLevel(logLevel));
return new Retrofit.Builder()
.baseUrl(BaseUrlDefinition.PASSPORT)
.client(okHttpClientBuilder.build())
.build()
.create(SsoService.class);
}
@Override
public HttpUrl getSsoUrl(@Nullable String goUrl) {
CancelRequestInterceptor cancelRequestInterceptor = new CancelRequestInterceptor();
try {
getSsoService(new SimpleCookieJar(), Collections.singletonList(cancelRequestInterceptor), HttpLoggingInterceptor.Level.BASIC)
.sso(goUrl)
.execute();
} catch (IOException ignored) {
}
return cancelRequestInterceptor.getRequest().url();
}
@Override
public Map<String, List<Cookie>> toCookies() throws IOException {
//用这个地址是因为这个地址一定不会改变( B站 未来的更新中)并且很省流量
return toCookies(BaseUrlDefinition.PASSPORT + "api/oauth2/getKey");
}
public Map<String, List<Cookie>> toCookies(@Nullable String goUrl) throws IOException {
SimpleCookieJar simpleCookieJar = new SimpleCookieJar();
getSsoService(simpleCookieJar).sso(goUrl).execute();
return simpleCookieJar.getCookiesMap();
}
@Override
public BilibiliWebAPI getBilibiliWebAPI() throws IOException {
return getBilibiliWebAPI(BrowserProperties.defaultSetting());
}
public BilibiliWebAPI getBilibiliWebAPI(BrowserProperties browserProperties) throws IOException {
if (bilibiliWebAPI == null) {
bilibiliWebAPI = new BilibiliWebAPI(browserProperties, toCookies());
}
return bilibiliWebAPI;
}
public LoginResponseEntity login(@Nonnull String username, @Nonnull String password) throws IOException, LoginException, CaptchaMismatchException {
return login(username, password, null, null);
}
public synchronized LoginResponseEntity login(@Nonnull String username,
@Nonnull String password,
String captcha,
String cookie) throws IOException, LoginException, CaptchaMismatchException {
LOGGER.info("Login attempting with username '{}'", username);
LoginResponseEntity loginResponseEntity = BilibiliSecurityHelper.login(
this,
username,
password,
captcha,
cookie
);
//判断返回值
switch (loginResponseEntity.getCode()) {
case ServerErrorCode.Common.OK: {
}
break;
case ServerErrorCode.Passport.USERNAME_OR_PASSWORD_INVALID: {
throw new LoginException("username or password invalid");
}
case ServerErrorCode.Passport.CANT_DECRYPT_RSA_PASSWORD: {
throw new LoginException("password error or hash expired");
}
case ServerErrorCode.Passport.CAPTCHA_NOT_MATCH: {
throw new CaptchaMismatchException("captcha mismatch");
}
default: {
throw new IOException(loginResponseEntity.getMessage());
}
}
bilibiliAccount.copyFrom(loginResponseEntity.toBilibiliAccount());
bilibiliWebAPI = null;
LOGGER.info("Login succeed with username: {}", username);
return loginResponseEntity;
}
public synchronized RefreshTokenResponseEntity refreshToken() throws IOException, LoginException {
if (isCurrentTokenAndRefreshTokenInvalid()) {
throw new LoginException("access token or refresh token not been set yet or invalid");
}
LOGGER.info("RefreshToken attempting with userId '{}'", bilibiliAccount.getUserId());
RefreshTokenResponseEntity refreshTokenResponseEntity = BilibiliSecurityHelper.refreshToken(
this,
bilibiliAccount.getAccessToken(),
bilibiliAccount.getRefreshToken()
);
switch (refreshTokenResponseEntity.getCode()) {
case ServerErrorCode.Common.OK: {
}
break;
case ServerErrorCode.Passport.NO_LOGIN: {
markCurrentTokenAndRefreshTokenInvalid();
throw new LoginException("access token invalid");
}
case ServerErrorCode.Passport.REFRESH_TOKEN_NOT_MATCH: {
markCurrentTokenAndRefreshTokenInvalid();
throw new LoginException("access token and refresh token mismatch");
}
default: {
throw new IOException(refreshTokenResponseEntity.getMessage());
}
}
bilibiliAccount.copyFrom(refreshTokenResponseEntity.toBilibiliAccount());
bilibiliWebAPI = null;
LOGGER.info("RefreshToken succeed with userId: {}", bilibiliAccount.getUserId());
return refreshTokenResponseEntity;
}
public synchronized LogoutResponseEntity logout() throws IOException, LoginException {
LOGGER.info("Logout attempting with userId '{}'", bilibiliAccount.getUserId());
Long userId = bilibiliAccount.getUserId();
LogoutResponseEntity logoutResponseEntity = BilibiliSecurityHelper.logout(this, bilibiliAccount.getAccessToken());
switch (logoutResponseEntity.getCode()) {
case ServerErrorCode.Common.OK: {
}
break;
case ServerErrorCode.Passport.NO_LOGIN: {
throw new LoginException("access token invalid");
}
default: {
throw new IOException(logoutResponseEntity.getMessage());
}
}
bilibiliAccount.reset();
LOGGER.info("Logout succeed with userId: {}", userId);
return logoutResponseEntity;
}
public InfoEntity getAccountInfo() throws IOException, LoginException {
InfoEntity infoEntity = getPassportService()
.getInfo(bilibiliAccount.getAccessToken())
.execute()
.body();
switch (infoEntity.getCode()) {
case ServerErrorCode.Common.OK: {
}
break;
case ServerErrorCode.Passport.NO_LOGIN: {
throw new LoginException("no login");
}
default: {
throw new IOException(infoEntity.getMessage());
}
}
return infoEntity;
}
/**
* 2018-05-11 现在用假的房间 Id 也能正常连接弹幕推送服务器
*
* @param eventLoopGroup 用于连接弹幕推送服务器的 EventLoop
* @param roomId 房间 ID, 可以是真 ID 也可以是假 ID
* @param isRealRoomId 使用的 roomId 是否是真 ID
* @return LiveClient 实例
*/
@Override
public LiveClient getLiveClient(EventLoopGroup eventLoopGroup, long roomId, boolean isRealRoomId) {
return bilibiliAccount.getUserId() == null ?
new LiveClient(this, eventLoopGroup, roomId, isRealRoomId) :
new LiveClient(this, eventLoopGroup, roomId, isRealRoomId, bilibiliAccount.getUserId());
}
private void markCurrentTokenAndRefreshTokenInvalid() {
invalidToken = bilibiliAccount.getAccessToken();
invalidRefreshToken = bilibiliAccount.getRefreshToken();
}
public boolean isCurrentTokenAndRefreshTokenInvalid() {
//如果 accessToken refreshToken 没有被设置或者已经尝试过并明确他们是无效的
return bilibiliAccount.getAccessToken() == null ||
bilibiliAccount.getRefreshToken() == null ||
(bilibiliAccount.getAccessToken().equals(invalidToken) && bilibiliAccount.getRefreshToken().equals(invalidRefreshToken));
}
public BilibiliClientProperties getBilibiliClientProperties() {
return bilibiliClientProperties;
}
public BilibiliAccount getBilibiliAccount() {
return bilibiliAccount;
}
public boolean isAutoRefreshToken() {
return autoRefreshToken;
}
public BilibiliAPI setAutoRefreshToken(boolean autoRefreshToken) {
this.autoRefreshToken = autoRefreshToken;
return this;
}
}

View File

@ -1,97 +0,0 @@
package com.hiczp.bilibili.api;
public class BilibiliAccount implements BilibiliSecurityContext {
private String accessToken;
private String refreshToken;
private Long userId;
private Long expirationTime;
private Long loginTime;
private BilibiliAccount() {
}
public BilibiliAccount(String accessToken, String refreshToken, Long userId, Long expirationTime, Long loginTime) {
this.accessToken = accessToken;
this.refreshToken = refreshToken;
this.userId = userId;
this.expirationTime = expirationTime;
this.loginTime = loginTime;
}
public BilibiliAccount(BilibiliSecurityContext bilibiliSecurityContext) {
copyFrom(bilibiliSecurityContext);
}
public static BilibiliAccount emptyInstance() {
return new BilibiliAccount();
}
public BilibiliAccount copyFrom(BilibiliSecurityContext bilibiliSecurityContext) {
this.accessToken = bilibiliSecurityContext.getAccessToken();
this.refreshToken = bilibiliSecurityContext.getRefreshToken();
this.userId = bilibiliSecurityContext.getUserId();
this.expirationTime = bilibiliSecurityContext.getExpirationTime();
this.loginTime = bilibiliSecurityContext.getLoginTime();
return this;
}
public BilibiliAccount reset() {
this.accessToken = null;
this.refreshToken = null;
this.userId = null;
this.expirationTime = null;
this.loginTime = null;
return this;
}
@Override
public String getAccessToken() {
return accessToken;
}
public BilibiliAccount setAccessToken(String accessToken) {
this.accessToken = accessToken;
return this;
}
@Override
public String getRefreshToken() {
return refreshToken;
}
public BilibiliAccount setRefreshToken(String refreshToken) {
this.refreshToken = refreshToken;
return this;
}
@Override
public Long getUserId() {
return userId;
}
public BilibiliAccount setUserId(Long userId) {
this.userId = userId;
return this;
}
@Override
public Long getExpirationTime() {
return expirationTime;
}
public BilibiliAccount setExpirationTime(Long expirationTime) {
this.expirationTime = expirationTime;
return this;
}
@Override
public Long getLoginTime() {
return loginTime;
}
public BilibiliAccount setLoginTime(Long loginTime) {
this.loginTime = loginTime;
return this;
}
}

View File

@ -1,91 +0,0 @@
package com.hiczp.bilibili.api;
import javax.annotation.Nonnull;
public class BilibiliClientProperties {
private String appKey = "1d8b6e7d45233436";
private String appSecret = "560c52ccd288fed045859ed18bffd973";
private String hardwareId = "JxdyESFAJkcjEicQbBBsCTlbal5uX2Y";
private String scale = "xxhdpi";
private String version = "5.15.0.515000";
private String simpleVersion;
private String build;
private String buvId = "JxdyESFAJkcjEicQbBBsCTlbal5uX2Yinfoc";
private BilibiliClientProperties() {
onVersionChange();
}
public static BilibiliClientProperties defaultSetting() {
return new BilibiliClientProperties();
}
private void onVersionChange() {
int lastIndexOfDot = version.lastIndexOf(".");
this.simpleVersion = version.substring(0, lastIndexOfDot);
this.build = version.substring(lastIndexOfDot + 1);
}
public String getAppKey() {
return appKey;
}
public BilibiliClientProperties setAppKey(String appKey) {
this.appKey = appKey;
return this;
}
public String getAppSecret() {
return appSecret;
}
public BilibiliClientProperties setAppSecret(String appSecret) {
this.appSecret = appSecret;
return this;
}
public String getHardwareId() {
return hardwareId;
}
public BilibiliClientProperties setHardwareId(String hardwareId) {
this.hardwareId = hardwareId;
return this;
}
public String getScale() {
return scale;
}
public BilibiliClientProperties setScale(String scale) {
this.scale = scale;
return this;
}
public String getVersion() {
return version;
}
public BilibiliClientProperties setVersion(@Nonnull String version) {
this.version = version;
onVersionChange();
return this;
}
public String getSimpleVersion() {
return simpleVersion;
}
public String getBuild() {
return build;
}
public String getBuvId() {
return buvId;
}
public BilibiliClientProperties setBuvId(String buvId) {
this.buvId = buvId;
return this;
}
}

View File

@ -1,13 +0,0 @@
package com.hiczp.bilibili.api;
public interface BilibiliSecurityContext {
String getAccessToken();
String getRefreshToken();
Long getUserId();
Long getExpirationTime();
Long getLoginTime();
}

View File

@ -1,199 +0,0 @@
package com.hiczp.bilibili.api;
import com.hiczp.bilibili.api.passport.entity.KeyEntity;
import com.hiczp.bilibili.api.passport.entity.LoginResponseEntity;
import com.hiczp.bilibili.api.passport.entity.LogoutResponseEntity;
import com.hiczp.bilibili.api.passport.entity.RefreshTokenResponseEntity;
import com.hiczp.bilibili.api.provider.BilibiliServiceProvider;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import java.io.IOException;
import java.math.BigInteger;
import java.security.*;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.X509EncodedKeySpec;
import java.util.Arrays;
import java.util.Base64;
import java.util.List;
import java.util.stream.Collectors;
public class BilibiliSecurityHelper {
/**
* 加密一个明文密码
*
* @param bilibiliServiceProvider BilibiliServiceProvider 实例
* @param password 明文密码
* @return 密文密码
* @throws IOException 网络错误
*/
private static String cipherPassword(@Nonnull BilibiliServiceProvider bilibiliServiceProvider,
@Nonnull String password) throws IOException {
KeyEntity keyEntity = bilibiliServiceProvider.getPassportService().getKey().execute().body();
//服务器返回异常错误码
if (keyEntity.getCode() != 0) {
throw new IOException(keyEntity.getMessage());
}
//构造无备注的 RSA 公钥字符串
String rsaPublicKeyString = Arrays.stream(keyEntity.getData().getKey().split("\n"))
.filter(string -> !string.startsWith("-"))
.collect(Collectors.joining());
//解析 RSA 公钥
PublicKey publicKey;
try {
X509EncodedKeySpec x509EncodedKeySpec = new X509EncodedKeySpec(Base64.getDecoder().decode(rsaPublicKeyString.getBytes()));
publicKey = KeyFactory.getInstance("RSA").generatePublic(x509EncodedKeySpec);
} catch (NoSuchAlgorithmException e) {
throw new Error(e);
} catch (InvalidKeySpecException e) {
throw new IOException("get broken RSA public key");
}
//加密密码
String cipheredPassword;
try {
Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
cipheredPassword = new String(
Base64.getEncoder().encode(
cipher.doFinal((keyEntity.getData().getHash() + password).getBytes())
)
);
} catch (NoSuchAlgorithmException | NoSuchPaddingException | IllegalBlockSizeException | BadPaddingException e) {
throw new Error(e);
} catch (InvalidKeyException e) {
throw new IOException("get broken RSA public key");
}
return cipheredPassword;
}
/**
* 计算 sign
*
* @param nameAndValues 传入值为 name1=value1 形式, 传入值必须已经排序. value 必须已经经过 URLEncode
* @param appSecret APP 密钥
* @return sign
*/
public static String calculateSign(@Nonnull List<String> nameAndValues, @Nonnull String appSecret) {
return calculateSign(nameAndValues.stream().collect(Collectors.joining("&")), appSecret);
}
/**
* 计算 sign
*
* @param encodedQuery 已经经过 URLEncode 处理的 Query 参数字符串
* @param appSecret APP 密钥
* @return sign
*/
public static String calculateSign(@Nonnull String encodedQuery, @Nonnull String appSecret) {
try {
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
messageDigest.update((encodedQuery + appSecret).getBytes());
String md5 = new BigInteger(1, messageDigest.digest()).toString(16);
//md5 不满 32 位时左边加 0
return ("00000000000000000000000000000000" + md5).substring(md5.length());
} catch (NoSuchAlgorithmException e) {
throw new Error(e);
}
}
/**
* 向一个 Query 参数字符串中添加 sign
*
* @param nameAndValues 传入值为 name1=value1 形式, 传入值必须已经排序. value 必须已经经过 URLEncode
* @param appSecret APP 密钥
* @return 添加了 sign Query 参数字符串
*/
public static String addSignToQuery(@Nonnull List<String> nameAndValues, @Nonnull String appSecret) {
return addSignToQuery(nameAndValues.stream().collect(Collectors.joining("&")), appSecret);
}
/**
* 向一个 Query 参数字符串中添加 sign
*
* @param encodedQuery 已经经过 URLEncode 处理的 Query 参数字符串
* @param appSecret APP 密钥
* @return 添加了 sign Query 参数字符串
*/
public static String addSignToQuery(@Nonnull String encodedQuery, @Nonnull String appSecret) {
return encodedQuery + String.format("&%s=%s", "sign", calculateSign(encodedQuery, appSecret));
}
/**
* 登录
*
* @param bilibiliServiceProvider BilibiliServiceProvider 实例
* @param username 用户名
* @param password 明文密码
* @return 返回值包含有 token refreshToken
* @throws IOException 网络错误
*/
public static LoginResponseEntity login(@Nonnull BilibiliServiceProvider bilibiliServiceProvider,
@Nonnull String username,
@Nonnull String password) throws IOException {
return login(bilibiliServiceProvider, username, password, null, null);
}
/**
* 带验证码的登录
* 在一段时间内使用错误的密码尝试登录多次, 再次使用这个 IP 地址登录这个账号会被要求验证码
*
* @param bilibiliServiceProvider BilibiliServiceProvider 实例
* @param username 用户名
* @param password 明文密码
* @param captcha 验证码
* @param cookie 与验证码对应的 cookies
* @return 返回值包含有 token refreshToken
* @throws IOException 网络错误
* @see com.hiczp.bilibili.api.passport.CaptchaService
*/
public static LoginResponseEntity login(@Nonnull BilibiliServiceProvider bilibiliServiceProvider,
@Nonnull String username,
@Nonnull String password,
@Nullable String captcha,
@Nullable String cookie) throws IOException {
return bilibiliServiceProvider.getPassportService()
.login(
username,
cipherPassword(bilibiliServiceProvider, password),
captcha,
cookie
).execute()
.body();
}
/**
* 刷新 Token
*
* @param bilibiliServiceProvider BilibiliServiceProvider 实例
* @param accessToken token
* @param refreshToken refreshToken
* @return 返回值包含一个新的 token refreshToken
* @throws IOException 网络错误
*/
public static RefreshTokenResponseEntity refreshToken(@Nonnull BilibiliServiceProvider bilibiliServiceProvider,
@Nonnull String accessToken,
@Nonnull String refreshToken) throws IOException {
return bilibiliServiceProvider.getPassportService().refreshToken(accessToken, refreshToken)
.execute()
.body();
}
/**
* 注销
*
* @param bilibiliServiceProvider BilibiliServiceProvider 实例
* @param accessToken token
* @return 返回 0 表示成功
* @throws IOException 网络错误
*/
public static LogoutResponseEntity logout(@Nonnull BilibiliServiceProvider bilibiliServiceProvider,
@Nonnull String accessToken) throws IOException {
return bilibiliServiceProvider.getPassportService().logout(accessToken)
.execute()
.body();
}
}

View File

@ -1,121 +0,0 @@
package com.hiczp.bilibili.api;
/**
* 不知道为什么错误码都要加负号
* 根据推断, 负数错误码表示是 APP 专用的 API, 正数错误码表示是 Web API 或者共用的 API
*/
public class ServerErrorCode {
/**
* 服务网关上鉴权失败的话, 会返回这些标准错误码
* B站 后台设计很混乱, 不是所有鉴权都在服务网关上完成
*/
public static class Common {
public static final int API_SIGN_INVALID = -3;
public static final int OK = 0;
/**
* 参数错误或已达 API 每日访问限制(比如银瓜子换硬币每日只能访问一次)
*/
public static final int BAD_REQUEST = -400;
public static final int UNAUTHORIZED = -401;
public static final int FORBIDDEN = -403;
public static final int NOT_FOUND = -404;
/**
* 一些 API 在参数错误的情况下也会引起 -500
*/
public static final int INTERNAL_SERVER_ERROR = -500;
}
/**
* 现在 access token 错误统一返回 -101
*/
public static class Passport {
/**
* "access_key not found"
*/
public static final int NO_LOGIN = -101;
/**
* 短时间内进行多次错误的登录将被要求输入验证码
*/
public static final int CAPTCHA_NOT_MATCH = -105;
/**
* 用户名不存在
*/
public static final int USERNAME_OR_PASSWORD_INVALID = -629;
/**
* 密码不可解密或者密码错误
*/
public static final int CANT_DECRYPT_RSA_PASSWORD = -662;
/**
* B站换了错误码, 现在 "access_key not found." 对应 -101
*/
@Deprecated
public static final int ACCESS_TOKEN_NOT_FOUND = -901;
/**
* refreshToken token 不匹配
*/
public static final int REFRESH_TOKEN_NOT_MATCH = -903;
}
/**
* 一些 API 未登录时返回 3, 一些返回 -101, 还有一些返回 401, 在网关上鉴权的 API 返回 -401, 甚至有一些 API 返回 32205 这种奇怪的错误码
*/
public static class Live {
/**
* "invalid params"
*/
public static final int INVALID_PARAMS = 1;
/**
* "user no login"
*/
public static final int USER_NO_LOGIN = 3;
/**
* "请登录"
*/
public static final int PLEASE_LOGIN = 401;
/**
* "每天最多能兑换 1 个"
*/
public static final int FORBIDDEN = 403;
/**
* 送礼物时房间号与用户号不匹配
* "只能送给主播(591)"
*/
public static final int ONLY_CAN_SEND_TO_HOST = 200012;
/**
* 赠送一个不存在的礼物
* "获取包裹数据失败"
*/
public static final int GET_BAG_DATA_FAIL = 200019;
/**
* "请登录"
*/
public static final int PLEASE_LOGIN0 = 32205;
/**
* "message": "invalid request"
* "data": "bad token"
*/
public static final int INVALID_REQUEST = 65530;
/**
* "请先登录"
*/
public static final int NO_LOGIN = -101;
/**
* 访问的房间号不存在
* "message": "Document is not exists."
*/
public static final int DOCUMENT_IS_NOT_EXISTS = -404;
/**
* 搜索时, 关键字字数过少或过多
* "关键字不能小于2个字节或大于50字节"
*/
public static final int KEYWORD_CAN_NOT_LESS_THAN_2_BYTES_OR_GREATER_THAN_50_BYTES = -609;
/**
* 已经领取过这个宝箱
*/
public static final int THIS_SILVER_TASK_ALREADY_TOOK = -903;
/**
* 今天所有的宝箱已经领完
*/
public static final int NO_MORE_SILVER_TASK = -10017;
}
}

View File

@ -1,21 +0,0 @@
package com.hiczp.bilibili.api.exception;
import java.io.IOException;
public class UserCancelRequestException extends IOException {
public UserCancelRequestException() {
}
public UserCancelRequestException(String message) {
super(message);
}
public UserCancelRequestException(String message, Throwable cause) {
super(message, cause);
}
public UserCancelRequestException(Throwable cause) {
super(cause);
}
}

View File

@ -1,30 +0,0 @@
package com.hiczp.bilibili.api.interceptor;
import com.google.common.base.Strings;
import com.hiczp.bilibili.api.BilibiliSecurityContext;
import okhttp3.HttpUrl;
import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;
import java.io.IOException;
public class AddAccessKeyInterceptor implements Interceptor {
private BilibiliSecurityContext bilibiliSecurityContext;
public AddAccessKeyInterceptor(BilibiliSecurityContext bilibiliSecurityContext) {
this.bilibiliSecurityContext = bilibiliSecurityContext;
}
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
HttpUrl.Builder httpUrlBuilder = request.url().newBuilder();
String accessKey = bilibiliSecurityContext.getAccessToken();
if (!Strings.isNullOrEmpty(accessKey)) {
httpUrlBuilder.removeAllQueryParameters("access_key")
.addQueryParameter("access_key", accessKey);
}
return chain.proceed(request.newBuilder().url(httpUrlBuilder.build()).build());
}
}

View File

@ -1,26 +0,0 @@
package com.hiczp.bilibili.api.interceptor;
import com.hiczp.bilibili.api.BilibiliClientProperties;
import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;
import java.io.IOException;
public class AddAppKeyInterceptor implements Interceptor {
private BilibiliClientProperties bilibiliClientDefinition;
public AddAppKeyInterceptor(BilibiliClientProperties bilibiliClientDefinition) {
this.bilibiliClientDefinition = bilibiliClientDefinition;
}
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
return chain.proceed(request.newBuilder().url(
request.url().newBuilder()
.addQueryParameter("appkey", bilibiliClientDefinition.getAppKey())
.build()
).build());
}
}

View File

@ -1,29 +0,0 @@
package com.hiczp.bilibili.api.interceptor;
import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;
import java.io.IOException;
import java.util.function.Supplier;
public class AddDynamicHeadersInterceptor implements Interceptor {
private Supplier<String>[] headerAndValues;
@SafeVarargs
public AddDynamicHeadersInterceptor(Supplier<String>... headerAndValues) {
if (headerAndValues.length % 2 != 0) {
throw new IllegalArgumentException("Header must have value");
}
this.headerAndValues = headerAndValues;
}
@Override
public Response intercept(Chain chain) throws IOException {
Request.Builder requestBuilder = chain.request().newBuilder();
for (int i = 0; i < headerAndValues.length; i += 2) {
requestBuilder.addHeader(headerAndValues[i].get(), headerAndValues[i + 1].get());
}
return chain.proceed(requestBuilder.build());
}
}

View File

@ -1,31 +0,0 @@
package com.hiczp.bilibili.api.interceptor;
import okhttp3.HttpUrl;
import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;
import java.io.IOException;
import java.util.function.Supplier;
public class AddDynamicParamsInterceptor implements Interceptor {
private Supplier<String>[] paramAndValues;
@SafeVarargs
public AddDynamicParamsInterceptor(Supplier<String>... paramAndValues) {
if (paramAndValues.length % 2 != 0) {
throw new IllegalArgumentException("Parameter must have value");
}
this.paramAndValues = paramAndValues;
}
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
HttpUrl.Builder httpUrlBuilder = request.url().newBuilder();
for (int i = 0; i < paramAndValues.length; i += 2) {
httpUrlBuilder.addQueryParameter(paramAndValues[i].get(), paramAndValues[i + 1].get());
}
return chain.proceed(request.newBuilder().url(httpUrlBuilder.build()).build());
}
}

View File

@ -1,27 +0,0 @@
package com.hiczp.bilibili.api.interceptor;
import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;
import java.io.IOException;
public class AddFixedHeadersInterceptor implements Interceptor {
private String[] headerAndValues;
public AddFixedHeadersInterceptor(String... headerAndValues) {
if (headerAndValues.length % 2 != 0) {
throw new IllegalArgumentException("Header must have value");
}
this.headerAndValues = headerAndValues;
}
@Override
public Response intercept(Chain chain) throws IOException {
Request.Builder requestBuilder = chain.request().newBuilder();
for (int i = 0; i < headerAndValues.length; i += 2) {
requestBuilder.addHeader(headerAndValues[i], headerAndValues[i + 1]);
}
return chain.proceed(requestBuilder.build());
}
}

View File

@ -1,29 +0,0 @@
package com.hiczp.bilibili.api.interceptor;
import okhttp3.HttpUrl;
import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;
import java.io.IOException;
public class AddFixedParamsInterceptor implements Interceptor {
private String[] paramAndValues;
public AddFixedParamsInterceptor(String... paramAndValues) {
if (paramAndValues.length % 2 != 0) {
throw new IllegalArgumentException("Parameter must have value");
}
this.paramAndValues = paramAndValues;
}
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
HttpUrl.Builder httpUrlBuilder = request.url().newBuilder();
for (int i = 0; i < paramAndValues.length; i += 2) {
httpUrlBuilder.addQueryParameter(paramAndValues[i], paramAndValues[i + 1]);
}
return chain.proceed(request.newBuilder().url(httpUrlBuilder.build()).build());
}
}

View File

@ -1,66 +0,0 @@
package com.hiczp.bilibili.api.interceptor;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.hiczp.bilibili.api.BilibiliAPI;
import com.hiczp.bilibili.api.ServerErrorCode;
import okhttp3.Interceptor;
import okhttp3.Response;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.stream.IntStream;
/**
* 自动刷新 token
* 如果一次请求的返回值表示鉴权失败, 会尝试刷新一次 token 然后自动重放请求
* 刷新 token 的行为将只发生一次, 如果刷新 token 失败, 下次请求的时候不会再次执行刷新 token 操作而会直接返回原本的返回内容
*/
public class AutoRefreshTokenInterceptor implements Interceptor {
private static final Logger LOGGER = LoggerFactory.getLogger(AutoRefreshTokenInterceptor.class);
private BilibiliAPI bilibiliAPI;
private int[] codes;
public AutoRefreshTokenInterceptor(BilibiliAPI bilibiliAPI, int... codes) {
this.bilibiliAPI = bilibiliAPI;
this.codes = codes;
}
@Override
public Response intercept(Chain chain) throws IOException {
Response response = chain.proceed(chain.request());
if (!bilibiliAPI.isAutoRefreshToken()) {
return response;
}
JsonObject jsonObject = InterceptorHelper.getJsonInBody(response);
JsonElement codeElement = jsonObject.get("code");
if (codeElement == null) {
return response;
}
int codeValue = codeElement.getAsInt();
if (codeValue == ServerErrorCode.Common.OK) {
return response;
}
if (IntStream.of(codes).noneMatch(code -> code == codeValue)) {
return response;
}
if (bilibiliAPI.isCurrentTokenAndRefreshTokenInvalid()) {
return response;
}
try {
bilibiliAPI.refreshToken();
response = chain.proceed(chain.request());
} catch (Exception e) {
LOGGER.error("refresh token failed: {}", e.getMessage());
}
return response;
}
}

View File

@ -1,28 +0,0 @@
package com.hiczp.bilibili.api.interceptor;
import com.hiczp.bilibili.api.exception.UserCancelRequestException;
import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;
import java.io.IOException;
/**
* 这个拦截器用于取消请求
* 如果需要让数据经过其他拦截器处理, 但是不想发生真实的网络请求, 就可以使用这个
*
* @see UserCancelRequestException
*/
public class CancelRequestInterceptor implements Interceptor {
private Request request;
@Override
public Response intercept(Chain chain) throws IOException {
request = chain.request();
throw new UserCancelRequestException();
}
public Request getRequest() {
return request;
}
}

View File

@ -1,60 +0,0 @@
package com.hiczp.bilibili.api.interceptor;
import com.google.gson.*;
import com.hiczp.bilibili.api.ServerErrorCode;
import okhttp3.Interceptor;
import okhttp3.Response;
import okhttp3.ResponseBody;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
/**
* 错误返回码内容转换拦截器
* 由于服务器返回错误时的 data 字段类型不固定, 会导致 json 反序列化出错.
* 该拦截器将在返回的 code 不为 0 , response 转换为包含一个空 data json 字符串.
*/
public class ErrorResponseConverterInterceptor implements Interceptor {
private static final Logger LOGGER = LoggerFactory.getLogger(ErrorResponseConverterInterceptor.class);
private static final Gson GSON = new Gson();
@Override
public Response intercept(Chain chain) throws IOException {
Response response = chain.proceed(chain.request());
ResponseBody responseBody = response.body();
JsonObject jsonObject = InterceptorHelper.getJsonInBody(response);
JsonElement code = jsonObject.get("code");
//code 字段不存在
if (code == null || code.isJsonNull()) {
return response;
}
//code 0
try {
if (code.getAsInt() == ServerErrorCode.Common.OK) {
return response;
}
} catch (NumberFormatException e) { //如果 code 不是数字的话直接返回
return response;
}
//打印 body
LOGGER.error("Get error response below: \n{}",
new GsonBuilder()
.setPrettyPrinting()
.create()
.toJson(jsonObject)
);
//data 字段不存在
if (jsonObject.get("data") == null) {
return response;
}
jsonObject.add("data", JsonNull.INSTANCE);
return response.newBuilder()
.body(ResponseBody.create(
responseBody.contentType(),
GSON.toJson(jsonObject))
).build();
}
}

View File

@ -1,26 +0,0 @@
package com.hiczp.bilibili.api.interceptor;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import okhttp3.Response;
import okhttp3.ResponseBody;
import okio.Buffer;
import okio.BufferedSource;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
class InterceptorHelper {
private static final JsonParser JSON_PARSER = new JsonParser();
static JsonObject getJsonInBody(Response response) throws IOException {
ResponseBody responseBody = response.body();
BufferedSource bufferedSource = responseBody.source();
bufferedSource.request(Long.MAX_VALUE);
Buffer buffer = bufferedSource.buffer();
return JSON_PARSER.parse(
//必须要 clone 一次, 否则将导致流关闭
buffer.clone().readString(StandardCharsets.UTF_8)
).getAsJsonObject();
}
}

View File

@ -1,51 +0,0 @@
package com.hiczp.bilibili.api.interceptor;
import com.hiczp.bilibili.api.BilibiliClientProperties;
import com.hiczp.bilibili.api.BilibiliSecurityHelper;
import okhttp3.HttpUrl;
import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class SortParamsAndSignInterceptor implements Interceptor {
private BilibiliClientProperties bilibiliClientProperties;
public SortParamsAndSignInterceptor(BilibiliClientProperties bilibiliClientProperties) {
this.bilibiliClientProperties = bilibiliClientProperties;
}
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
HttpUrl httpUrl = request.url();
List<String> nameAndValues = new ArrayList<>(httpUrl.querySize() + 1);
httpUrl.queryParameterNames().stream()
.filter(parameterName -> !parameterName.equals("sign"))
.forEach(name ->
httpUrl.queryParameterValues(name).forEach(value -> {
try {
nameAndValues.add(String.format("%s=%s", name, URLEncoder.encode(value, StandardCharsets.UTF_8.toString())));
} catch (UnsupportedEncodingException e) {
throw new Error(e);
}
}
)
);
Collections.sort(nameAndValues);
return chain.proceed(
request.newBuilder()
.url(httpUrl.newBuilder()
.encodedQuery(BilibiliSecurityHelper.addSignToQuery(nameAndValues, bilibiliClientProperties.getAppSecret()))
.build()
).build()
);
}
}

View File

@ -1,635 +0,0 @@
package com.hiczp.bilibili.api.live;
import com.hiczp.bilibili.api.BilibiliClientProperties;
import com.hiczp.bilibili.api.live.entity.*;
import retrofit2.Call;
import retrofit2.http.*;
/**
* 常见参数含义
* mid: 用户 id, 也可能是指主播的用户 id
* cid: 房间 id, 可以指 room_id 也可以指 show_room_id, 推荐所有 API 都使用 room_id 进行访问
*/
public interface LiveService {
/**
* 获取弹幕设置
*
* @param type 必须是 "all", 否则返回的所有字段的值都是 0
*/
@GET("AppRoom/danmuConfig")
Call<BulletScreenConfigEntity> getBulletScreenConfig(@Query("type") String type);
/**
* 获取弹幕设置的快捷调用
*/
default Call<BulletScreenConfigEntity> getBulletScreenConfig() {
return getBulletScreenConfig("all");
}
/**
* 获得房间的历史弹幕(十条)
*
* @param roomId 房间号
*/
@GET("AppRoom/msg")
Call<LiveHistoryBulletScreensEntity> getHistoryBulletScreens(@Query("room_id") long roomId);
/**
* 获取直播间信息
* 登录后访问该 API 将在服务器新增一条直播间观看历史
*
* 2018-05-11 现在用假的房间 ID 也能获得正确的信息
*
* @param roomId 房间号
*/
@GET("AppRoom/index")
Call<LiveRoomInfoEntity> getRoomInfo(@Query("room_id") long roomId);
/**
* 获得是否关注了一个主播
*
* @param hostUserId 主播的用户 ID
* @return 未登录时返回 401
*/
@POST("feed/v1/feed/isFollowed")
Call<IsFollowedResponseEntity> isFollowed(@Query("follow") long hostUserId);
//TODO sendDaily
// API 意义不明
@GET("AppBag/sendDaily")
Call<SendDailyResponseEntity> sendDaily();
/**
* 获得所有礼物的列表
*/
@GET("AppIndex/getAllItem")
Call<ItemsEntity> getAllItem();
/**
* 查看可用的小电视抽奖
*
* @param roomId 房间号
* @return 当目标房间没有可用的小电视抽奖时返回 -400
*/
@GET("AppSmallTV/index")
Call<AppSmallTVEntity> getAppSmallTV(@Query("roomid") long roomId);
/**
* 参与小电视抽奖
* 房间号必须与小电视号对应
* SYS_MSG 里面取得的小电视编号是一个字符串, 实际上它肯定是一个数字
*
* @param roomId 房间号
* @param tvId 小电视号
* @return 目标小电视不存在时(房间号与小电视号不匹配时也视为不存在)返回 -400 "不存在小电视信息"
*/
@POST("AppSmallTV/join")
Call<JoinAppSmallTVResponseEntity> joinAppSmallTV(@Query("roomid") long roomId, @Query("id") String tvId);
/**
* 通过 getAppSmallTV 取得的小电视编号是一个数字
*
* @param roomId 房间号
* @param tvId 小电视号
*/
default Call<JoinAppSmallTVResponseEntity> joinAppSmallTV(long roomId, long tvId) {
return joinAppSmallTV(roomId, String.valueOf(tvId));
}
/**
* 获得小电视抽奖结果(不访问这个 API, 奖励也会自动进入背包)
*
* @param tvId 小电视号
* @return 返回内容中的 status 0 , 表示返回正常开奖结果, 1 为没有参与抽奖或小电视已过期, 2 为正在开奖过程中
*/
@GET("AppSmallTV/getReward")
Call<GetAppSmallTVRewardResponseEntity> getAppSmallTVReward(@Query("id") long tvId);
/**
* 获得所有头衔的列表
* 这里的 Title 是头衔的意思
*/
@GET("appUser/getTitle")
Call<TitlesEntity> getTitle();
//TODO 查看房间里是否有节奏风暴
@GET("SpecialGift/room/{roomId}")
Call<SpecialGiftEntity> getSpecialGift(@Path("roomId") long roomId);
//TODO 参与节奏风暴抽奖
//TODO 查看节奏风暴奖励
/**
* 获取自己的用户信息(live 站的个人信息, 非总站)
*
* @return 未登录时返回 3
*/
@GET("mobile/getUser")
Call<UserInfoEntity> getUserInfo();
/**
* 获取一个直播间的流地址(flv)
*
* @param cid 必须用实际的 room_id, 不能使用 show_room_id, 否则得不到 playUrl. 实际 room_id 要首先通过 getRoomInfo() 获取
* @param outputType 为固定值 "json", 否则返回一个空的 JsonArray (以前是返回一个 XML)
*/
@GET("api/playurl")
Call<PlayUrlEntity> getPlayUrl(@Query("cid") long cid, @Query("otype") String outputType);
/**
* 获取直播间推流地址的快捷调用
*
* @param cid 房间号
*/
default Call<PlayUrlEntity> getPlayUrl(long cid) {
return getPlayUrl(cid, "json");
}
/**
* 获取当前这段时间的活动(不定期活动, 每次持续几周)和信仰任务
*
* @param roomId 房间号
*/
@GET("activity/v1/Common/mobileActivity")
Call<MobileActivityEntity> getMobileActivity(@Query("roomid") long roomId);
/**
* 获取用户的信仰任务列表
*
* @return 2018-02 现在只有 double_watch_task 这个任务是有效的
*/
@GET("activity/v1/task/user_tasks")
Call<UserTasksEntity> getUserTasks();
/**
* 领取一个信仰任务
*
* @param taskId 任务名
* @return 任务未完成或者已领取返回 -400
*/
@POST("activity/v1/task/receive_award")
Call<ReceiveUserTaskAward> receiveUserTaskAward(@Query("task_id") String taskId);
/**
* 领取 double_watch_task 任务的奖励
*/
default Call<ReceiveUserTaskAward> receiveDoubleWatchTaskAward() {
return receiveUserTaskAward("double_watch_task");
}
//TODO 查看一个房间是否有活动抽奖
//TODO 参与活动抽奖
//TODO 查看活动抽奖奖励
/**
* 发送一个 Restful 心跳包, 五分钟一次. 这被用于统计观看直播的时间, 可以提升观众等级
* 2018-03-06 开始, 只有老爷才能通过观看直播获得经验
*
* @param roomId 房间号
* @param scale 屏幕大小
* @return 未登录时返回 3
*/
@POST("mobile/userOnlineHeart")
@FormUrlEncoded
Call<SendOnlineHeartResponseEntity> sendOnlineHeart(@Field("room_id") long roomId, @Field("scale") String scale);
/**
* 发送心跳包的快捷调用
*
* @param roomId 房间号
*/
default Call<SendOnlineHeartResponseEntity> sendOnlineHeart(long roomId) {
return sendOnlineHeart(roomId, BilibiliClientProperties.defaultSetting().getScale());
}
/**
* 发送一条弹幕
*
* @param roomId 房间号
* @param userId 自己的用户 ID
* @param message 内容
* @param random 随机数
* @param mode 弹幕模式
* @param pool 弹幕池
* @param type 必须为 "json"
* @param color 颜色
* @param fontSize 字体大小
* @param playTime 播放时间
* @see BulletScreenEntity
*/
@POST("api/sendmsg")
@FormUrlEncoded
Call<SendBulletScreenResponseEntity> sendBulletScreen(@Field("cid") long roomId,
@Field("mid") long userId,
@Field("msg") String message,
@Field("rnd") long random,
@Field("mode") int mode,
@Field("pool") int pool,
@Field("type") String type,
@Field("color") int color,
@Field("fontsize") int fontSize,
@Field("playTime") String playTime);
/**
* 发送弹幕的快捷调用
*
* @param bulletScreenEntity 弹幕实体类
*/
default Call<SendBulletScreenResponseEntity> sendBulletScreen(BulletScreenEntity bulletScreenEntity) {
return sendBulletScreen(
bulletScreenEntity.getRoomId(),
bulletScreenEntity.getUserId(),
bulletScreenEntity.getMessage(),
bulletScreenEntity.getRandom(),
bulletScreenEntity.getMode(),
bulletScreenEntity.getPool(),
bulletScreenEntity.getType(),
bulletScreenEntity.getColor(),
bulletScreenEntity.getFontSize(),
bulletScreenEntity.getPlayTime()
);
}
/**
* 获取下一个宝箱任务的信息
*/
@GET("mobile/freeSilverCurrentTask")
Call<FreeSilverCurrentTaskEntity> getFreeSilverCurrentTask();
/**
* 领取宝箱
*/
@GET("mobile/freeSilverAward")
Call<FreeSilverAwardEntity> getFreeSilverAward();
/**
* 查看自己的背包(礼物)
*/
@GET("AppBag/playerBag")
Call<PlayerBagEntity> getPlayerBag();
/**
* 查看哪些礼物是活动礼物, 在客户端上, 活动礼物会有一个右上角标记 "活动"
*
* @param roomId 房间号
*/
@GET("AppRoom/activityGift")
Call<ActivityGiftsEntity> getActivityGifts(@Query("room_id") long roomId);
/**
* 送礼物
*
* @param giftId 礼物 ID
* @param number 数量
* @param roomUserId 主播的用户 ID
* @param roomId 房间号
* @param timeStamp 时间戳
* @param bagId 礼物在自己背包里的 ID
* @param random 随机数
* @return roomUserId roomId 不匹配时返回 200012
* bagId 错误时(背包里没有这个礼物)返回 200019
*/
@POST("AppBag/send")
@FormUrlEncoded
Call<SendGiftResponseEntity> sendGift(@Field("giftId") long giftId,
@Field("num") long number,
@Field("ruid") long roomUserId,
@Field("roomid") long roomId,
@Field("timestamp") long timeStamp,
@Field("bag_id") long bagId,
@Field("rnd") long random);
/**
* 送礼物的快捷调用
*
* @param giftEntity 礼物实体类
*/
default Call<SendGiftResponseEntity> sendGift(GiftEntity giftEntity) {
return sendGift(
giftEntity.getGiftId(),
giftEntity.getNumber(),
giftEntity.getRoomUserId(),
giftEntity.getRoomId(),
giftEntity.getTimeStamp(),
giftEntity.getBagId(),
giftEntity.getRandom()
);
}
/**
* 获得礼物榜(七日榜)
*
* @param roomId 房间号
*/
@GET("AppRoom/getGiftTop")
Call<GiftTopEntity> getGiftTop(@Query("room_id") int roomId);
/**
* "直播" 页面(这个页面对应的后台数据, 包括 banner, 推荐主播, 各种分区的推荐等)
*
* @param device 这个 API 会读取 "_device"(固定参数) 或者 "device" 来判断平台, 只需要有一个就能正常工作, 客户端上是两个都有, 且值都为 "android"
*/
@GET("room/v1/AppIndex/getAllList")
Call<AllListEntity> getAllList(@Query("device") String device);
/**
* 获取 "直播" 页面数据的快捷调用
*/
default Call<AllListEntity> getAllList() {
return getAllList("android");
}
/**
* 刷新 "推荐主播" 区域, 必须有 device, platform, scala
* scala xxhdpi 时返回 12 , 客户端显示六个, 刷新两次后再次访问该 API
* API 返回的内容结构与 getAllList 返回的内容中的 recommend_data 字段是一样的
* API 返回的 banner_data 是在普通分区的推荐的上面的那个 banner, 在新版 APP , 点击这个 banner 会固定的跳转到 bilibili 相簿的 画友 标签页
*
* @param device 设备类型
*/
@GET("room/v1/AppIndex/recRefresh")
Call<RecommendRoomRefreshResponseEntity> recommendRefresh(@Query("device") String device);
/**
* 刷新 "推荐主播" 区域 的快捷调用
*/
default Call<RecommendRoomRefreshResponseEntity> recommendRefresh() {
return recommendRefresh("android");
}
/**
* 获取对应分类和状态的直播间
*
* @param areaId 分区 ID
* @param categoryId 不明确其含义
* @param parentAreaId 父分区 ID
* @param sortType 排序方式
* @param page 页码, 可以为 null(第一页)
*/
@GET("room/v1/Area/getRoomList")
Call<RoomListEntity> getRoomList(
@Query("area_id") int areaId,
@Query("cate_id") int categoryId,
@Query("parent_area_id") int parentAreaId,
@Query("sort_type") String sortType,
@Query("page") Long page
);
/**
* 直播页面 下面的 普通分区(复数) 的刷新, 一次会返回 20 个结果, 客户端显示 6 , 数据用完了之后再次访问该 API
*
* @param parentAreaId 父分区 ID
*/
default Call<RoomListEntity> getRoomList(int parentAreaId) {
return getRoomList(0, 0, parentAreaId, "dynamic", null);
}
/**
* 直播 -> 某个分区 -> 查看更多
* 获取该页面上方的分类标签
*
* @param parentAreaId 父分区 ID
*/
@GET("room/v1/Area/getList")
Call<AreaListEntity> getAreaList(@Query("parent_id") int parentAreaId);
/**
* 获取该页面下的的直播间(areaId 0 表示选择了 "全部"(上方的分类标签), areaId 如果和 parentAreaId 不匹配将返回空的 data 字段)
*
* @param areaId 分区 ID
* @param parentAreaId 父分区 ID
* @param page 页码
*/
default Call<RoomListEntity> getRoomList(int areaId, int parentAreaId, long page) {
return getRoomList(areaId, 0, parentAreaId, "online", page);
}
/**
* 直播 -> 全部直播(直播页面的最下面的一个按钮)
*
* @param areaId 分区 ID
* @param page 页码
* @param sort 分类
*/
@GET("mobile/rooms")
Call<RoomsEntity> getRooms(@Query("area_id") int areaId, @Query("page") int page, @Query("sort") String sort);
/**
* 推荐直播
*
* @param page 页码
*/
default Call<RoomsEntity> getSuggestionRooms(int page) {
return getRooms(0, page, "suggestion");
}
/**
* 最热直播
*
* @param page 页码
*/
default Call<RoomsEntity> getHottestRooms(int page) {
return getRooms(0, page, "hottest");
}
/**
* 最新直播
*
* @param page 页码
*/
default Call<RoomsEntity> getLatestRooms(int page) {
return getRooms(0, page, "latest");
}
/**
* 视频轮播
*
* @param page 页码
*/
default Call<RoomsEntity> getRoundRooms(int page) {
return getRooms(0, page, "roundroom");
}
/**
* live 站的搜索("直播" 页面)
*
* @param keyword 关键字
* @param page 页码
* @param pageSize 页容量
* @param type room 时只返回 房间 的搜索结果, user 时只返回 用户 的搜索结果, all 房间 用户 的搜索结果都有
*/
@GET("AppSearch/index")
Call<SearchResponseEntity> search(@Query("keyword") String keyword, @Query("page") long page, @Query("pagesize") long pageSize, @Query("type") String type);
/**
* 搜索的快捷调用
*
* @param keyword 关键字
* @param page 页码
* @param pageSize 页容量
*/
default Call<SearchResponseEntity> search(String keyword, long page, long pageSize) {
return search(keyword, page, pageSize, "all");
}
/**
* 侧拉抽屉 -> 直播中心 -> 右上角日历图标
* 签到(live 站签到, 非总站(虽然我也不知道总站有没有签到功能))
*
* @return 无论是否已经签到, 返回的 code 都是 0. 除了字符串比对, 要想知道是否已经签到要通过 getUserInfo().getIsSign()
*/
@GET("AppUser/getSignInfo")
Call<SignInfoEntity> getSignInfo();
/**
* 侧拉抽屉 -> 直播中心 -> 我的关注
* 获得关注列表
* 未登录时返回 32205
*
* @param page 页码
* @param pageSize 页容量
*/
@GET("AppFeed/index")
Call<FollowedHostsEntity> getFollowedHosts(@Query("page") long page, @Query("pagesize") long pageSize);
/**
* 侧拉抽屉 -> 直播中心 -> 观看历史
*
* @param page 页码
* @param pageSize 页容量
*/
@GET("AppUser/history")
Call<HistoryEntity> getHistory(@Query("page") long page, @Query("pagesize") long pageSize);
/**
* 佩戴中心
* 侧拉抽屉 -> 直播中心 -> 佩戴中心 -> 粉丝勋章
* 获得用户拥有的粉丝勋章
*/
@GET("AppUser/medal")
Call<MyMedalListEntity> getMyMedalList();
/**
* 佩戴粉丝勋章
*
* @param medalId 勋章 ID
*/
@POST("AppUser/wearMedal")
Call<WearMedalResponseEntity> wearMedal(@Query("medal_id") int medalId);
/**
* 取消佩戴粉丝勋章(取消佩戴当前佩戴着的粉丝勋章)
* URL 上的 canel 不是拼写错误, 它原本就是这样的
*/
@GET("AppUser/canelMedal")
Call<CancelMedalResponseEntity> cancelMedal();
/**
* 侧拉抽屉 -> 直播中心 -> 佩戴中心 -> 我的头衔
* 获得用户拥有的头衔
*/
@GET("appUser/myTitleList")
Call<MyTitleListEntity> getMyTitleList();
/**
* 获得当前佩戴着的头衔的详情
*
* @return 当前未佩戴任何东西时, 返回的 code -1, message "nodata"
*/
@GET("appUser/getWearTitle")
Call<WearTitleEntity> getWearTitle();
/**
* 佩戴头衔
*
* @param title 头衔名
*/
@POST("AppUser/wearTitle")
Call<WearTitleResponseEntity> wearTitle(@Query("title") String title);
/**
* 取消佩戴头衔(取消佩戴当前佩戴着的头衔)
*/
@GET("appUser/cancelTitle")
Call<CancelTitleResponseEntity> cancelTitle();
//TODO 头衔工坊(没有可升级头衔, 暂不明确此 API)
/**
* 侧拉抽屉 -> 直播中心 -> 获奖记录
* 获得用户的获奖记录
*/
@GET("AppUser/awards")
Call<AwardsEntity> getAwardRecords();
/**
* 瓜子商店
* 侧拉抽屉 -> 直播中心 -> 瓜子商店 -> 银瓜子兑换 -> 硬币银瓜子互换 -> 兑换硬币
* 700 银瓜子兑换为 1 硬币, 每个用户每天只能换一次
*
* @return 已经兑换过时返回 403
* 2018-03-15 访问此 API 必须有一个合法的 UA, 否则返回 65530
*/
@POST("AppExchange/silver2coin")
Call<Silver2CoinResponseEntity> silver2Coin();
/**
* 扭蛋机
* 侧拉抽屉 -> 直播中心 -> 扭蛋机 -> 普通扭蛋
* 获得 扭蛋机(普通扭蛋) 这个页面对应的后台数据
*/
@GET("AppUser/capsuleInfo")
Call<CapsuleInfoEntity> getCapsuleInfo();
/**
* 抽扭蛋
*
* @param count 数量, 只能为 1, 10, 100
* @param type 扭蛋类型, 只能为 "normal" "colorful"
*/
@POST("AppUser/capsuleInfoOpen")
@FormUrlEncoded
Call<OpenCapsuleResponseEntity> openCapsule(@Field("count") int count, @Field("type") String type);
/**
* 抽普通扭蛋
* 侧拉抽屉 -> 直播中心 -> 扭蛋机 -> 普通扭蛋 ->
* 普通扭蛋的 type "normal"
*
* @param count 数量, 只能为 1, 10, 100
*/
default Call<OpenCapsuleResponseEntity> openNormalCapsule(int count) {
return openCapsule(count, "normal");
}
/**
* 抽梦幻扭蛋
*
* @param count 数量, 只能为 1, 10, 100
*/
default Call<OpenCapsuleResponseEntity> openColorfulCapsule(int count) {
return openCapsule(count, "colorful");
}
/**
* 房间设置
* 侧拉抽屉 -> 直播中心 -> 房间设置 -> (上面的个人信息, 包括 房间号, 粉丝数, UP 经验)
* 根据用户 ID 来获取房间信息, 通常用于获取自己的直播间信息(可以用来获取他人的房间信息)
* API 不会增加直播间观看历史
*
* @param userId 用户 ID
*/
@GET("assistant/getRoomInfo")
Call<AssistantRoomInfoEntity> getAssistantRoomInfo(@Query("uId") long userId);
/**
* 侧拉抽屉 -> 直播中心 -> 房间设置 -> 我的封面
* 获取自己的直播间的封面
*
* @param roomId 房间号
* @return 获取其他人的封面会 -403
*/
@GET("mhand/assistant/getCover")
Call<CoverEntity> getCover(@Query("roomId") long roomId);
//TODO 粉丝勋章(尚未达到开通粉丝勋章的最低要求, 无法对该 API 截包)
}

View File

@ -1,5 +0,0 @@
package com.hiczp.bilibili.api.live.bulletScreen;
public class BulletScreenConstDefinition {
public static final int DEFAULT_MESSAGE_LENGTH_LIMIT = 20;
}

View File

@ -1,17 +0,0 @@
package com.hiczp.bilibili.api.live.bulletScreen;
import javax.annotation.Nonnull;
public class BulletScreenHelper {
public static String[] splitMessageByFixedLength(@Nonnull String message, int lengthLimit) {
int count = message.length() / lengthLimit;
if (message.length() % lengthLimit != 0) {
count++;
}
String[] messages = new String[count];
for (int i = 0; i < count; i++) {
messages[i] = message.substring(i * lengthLimit, i != count - 1 ? (i + 1) * lengthLimit : message.length());
}
return messages;
}
}

View File

@ -1,10 +0,0 @@
package com.hiczp.bilibili.api.live.bulletScreen;
import com.hiczp.bilibili.api.live.entity.BulletScreenEntity;
import com.hiczp.bilibili.api.live.entity.SendBulletScreenResponseEntity;
public interface BulletScreenSendingCallback {
void onResponse(BulletScreenEntity bulletScreenEntity, SendBulletScreenResponseEntity sendBulletScreenResponseEntity);
void onFailure(BulletScreenEntity bulletScreenEntity, Throwable throwable);
}

View File

@ -1,28 +0,0 @@
package com.hiczp.bilibili.api.live.bulletScreen;
import com.hiczp.bilibili.api.live.entity.BulletScreenEntity;
import com.hiczp.bilibili.api.provider.BilibiliServiceProvider;
public class BulletScreenSendingTask {
private BilibiliServiceProvider bilibiliServiceProvider;
private BulletScreenEntity bulletScreenEntity;
private BulletScreenSendingCallback bulletScreenSendingCallback;
public BulletScreenSendingTask(BilibiliServiceProvider bilibiliServiceProvider, BulletScreenEntity bulletScreenEntity, BulletScreenSendingCallback bulletScreenSendingCallback) {
this.bilibiliServiceProvider = bilibiliServiceProvider;
this.bulletScreenEntity = bulletScreenEntity;
this.bulletScreenSendingCallback = bulletScreenSendingCallback;
}
public BilibiliServiceProvider getBilibiliServiceProvider() {
return bilibiliServiceProvider;
}
public BulletScreenEntity getBulletScreenEntity() {
return bulletScreenEntity;
}
public BulletScreenSendingCallback getBulletScreenSendingCallback() {
return bulletScreenSendingCallback;
}
}

View File

@ -1,151 +0,0 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.annotations.SerializedName;
import java.util.List;
import java.util.Map;
public class ActivityGiftsEntity extends ResponseEntity {
/**
* code : 0
* message : OK
* data : [{"id":102,"bag_id":48843715,"name":"秘银水壶","num":9,"img":"http://static.hdslb.com/live-static/live-room/images/gift-section/mobilegift-static-icon/gift-102.png?20171010161652","gift_url":"http://static.hdslb.com/live-static/live-room/images/gift-section/mobilegift/3/102.gif?20171010161652","combo_num":5,"super_num":225,"count_set":"1,5,9","count_map":{"1":"","5":"连击","9":"全部"}}]
*/
@SerializedName("code")
private int code;
@SerializedName("data")
private List<Data> data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public List<Data> getData() {
return data;
}
public void setData(List<Data> data) {
this.data = data;
}
public static class Data {
/**
* id : 102
* bag_id : 48843715
* name : 秘银水壶
* num : 9
* img : http://static.hdslb.com/live-static/live-room/images/gift-section/mobilegift-static-icon/gift-102.png?20171010161652
* gift_url : http://static.hdslb.com/live-static/live-room/images/gift-section/mobilegift/3/102.gif?20171010161652
* combo_num : 5
* super_num : 225
* count_set : 1,5,9
* count_map : {"1":"","5":"连击","9":"全部"}
*/
@SerializedName("id")
private int id;
@SerializedName("bag_id")
private int bagId;
@SerializedName("name")
private String name;
@SerializedName("num")
private int number;
@SerializedName("img")
private String img;
@SerializedName("gift_url")
private String giftUrl;
@SerializedName("combo_num")
private int comboNum;
@SerializedName("super_num")
private int superNum;
@SerializedName("count_set")
private String countSet;
@SerializedName("count_map")
private Map<String, String> countMap;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getBagId() {
return bagId;
}
public void setBagId(int bagId) {
this.bagId = bagId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getNumber() {
return number;
}
public void setNumber(int number) {
this.number = number;
}
public String getImg() {
return img;
}
public void setImg(String img) {
this.img = img;
}
public String getGiftUrl() {
return giftUrl;
}
public void setGiftUrl(String giftUrl) {
this.giftUrl = giftUrl;
}
public int getComboNum() {
return comboNum;
}
public void setComboNum(int comboNum) {
this.comboNum = comboNum;
}
public int getSuperNum() {
return superNum;
}
public void setSuperNum(int superNum) {
this.superNum = superNum;
}
public String getCountSet() {
return countSet;
}
public void setCountSet(String countSet) {
this.countSet = countSet;
}
public Map<String, String> getCountMap() {
return countMap;
}
public void setCountMap(Map<String, String> countMap) {
this.countMap = countMap;
}
}
}

File diff suppressed because one or more lines are too long

View File

@ -1,130 +0,0 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class AppSmallTVEntity extends ResponseEntity {
/**
* code : 0
* msg : OK
* message : OK
* data : {"lastid":0,"join":[{"id":39674,"dtime":32}],"unjoin":[{"id":39674,"dtime":32}]}
*/
@SerializedName("code")
private int code;
@SerializedName("data")
private Data data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public static class Data {
/**
* lastid : 0
* join : [{"id":39674,"dtime":32}]
* unjoin : [{"id":39674,"dtime":32}]
*/
@SerializedName("lastid")
private long lastId;
@SerializedName("join")
private List<Join> join;
@SerializedName("unjoin")
private List<Unjoin> unJoin;
public long getLastId() {
return lastId;
}
public void setLastId(long lastId) {
this.lastId = lastId;
}
public List<Join> getJoin() {
return join;
}
public void setJoin(List<Join> join) {
this.join = join;
}
public List<Unjoin> getUnJoin() {
return unJoin;
}
public void setUnJoin(List<Unjoin> unJoin) {
this.unJoin = unJoin;
}
public static class Join {
/**
* id : 39674
* dtime : 32
*/
@SerializedName("id")
private long id;
@SerializedName("dtime")
private int dtime;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public int getDtime() {
return dtime;
}
public void setDtime(int dtime) {
this.dtime = dtime;
}
}
public static class Unjoin {
/**
* id : 39674
* dtime : 32
*/
@SerializedName("id")
private long id;
@SerializedName("dtime")
private int dtime;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public int getDtime() {
return dtime;
}
public void setDtime(int dtime) {
this.dtime = dtime;
}
}
}
}

View File

@ -1,96 +0,0 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class AreaListEntity extends ResponseEntity {
/**
* code : 0
* msg : success
* message : success
* data : [{"id":"56","parent_id":"2","old_area_id":"1","name":"我的世界","act_id":"0"},{"id":"57","parent_id":"2","old_area_id":"1","name":"以撒","act_id":"0"},{"id":"64","parent_id":"2","old_area_id":"1","name":"饥荒","act_id":"0"},{"id":"65","parent_id":"2","old_area_id":"1","name":"彩虹六号","act_id":"0"},{"id":"78","parent_id":"2","old_area_id":"3","name":"DNF","act_id":"0"},{"id":"80","parent_id":"2","old_area_id":"1","name":"绝地求生:大逃杀","act_id":"0"},{"id":"81","parent_id":"2","old_area_id":"3","name":"三国杀","act_id":"0"},{"id":"82","parent_id":"2","old_area_id":"3","name":"剑网3","act_id":"0"},{"id":"83","parent_id":"2","old_area_id":"3","name":"魔兽世界","act_id":"0"},{"id":"84","parent_id":"2","old_area_id":"3","name":"300英雄","act_id":"0"},{"id":"86","parent_id":"2","old_area_id":"4","name":"英雄联盟","act_id":"0"},{"id":"87","parent_id":"2","old_area_id":"3","name":"守望先锋","act_id":"0"},{"id":"88","parent_id":"2","old_area_id":"4","name":"穿越火线","act_id":"0"},{"id":"89","parent_id":"2","old_area_id":"4","name":"CSGO","act_id":"0"},{"id":"90","parent_id":"2","old_area_id":"4","name":"CS","act_id":"0"},{"id":"91","parent_id":"2","old_area_id":"3","name":"炉石传说","act_id":"0"},{"id":"92","parent_id":"2","old_area_id":"4","name":"DOTA2","act_id":"0"},{"id":"93","parent_id":"2","old_area_id":"4","name":"星际争霸2","act_id":"0"},{"id":"102","parent_id":"2","old_area_id":"3","name":"最终幻想14","act_id":"0"},{"id":"112","parent_id":"2","old_area_id":"3","name":"龙之谷","act_id":"0"},{"id":"114","parent_id":"2","old_area_id":"4","name":"风暴英雄","act_id":"0"},{"id":"115","parent_id":"2","old_area_id":"3","name":"坦克世界","act_id":"0"},{"id":"138","parent_id":"2","old_area_id":"1","name":"超级马里奥奥德赛","act_id":"0"},{"id":"147","parent_id":"2","old_area_id":"1","name":"怪物猎人:世界","act_id":"0"},{"id":"107","parent_id":"2","old_area_id":"1","name":"其他游戏","act_id":"0"}]
*/
@SerializedName("code")
private int code;
@SerializedName("data")
private List<Data> data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public List<Data> getData() {
return data;
}
public void setData(List<Data> data) {
this.data = data;
}
public static class Data {
/**
* id : 56
* parent_id : 2
* old_area_id : 1
* name : 我的世界
* act_id : 0
*/
@SerializedName("id")
private String id;
@SerializedName("parent_id")
private String parentId;
@SerializedName("old_area_id")
private String oldAreaId;
@SerializedName("name")
private String name;
@SerializedName("act_id")
private String actId;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getParentId() {
return parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
public String getOldAreaId() {
return oldAreaId;
}
public void setOldAreaId(String oldAreaId) {
this.oldAreaId = oldAreaId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getActId() {
return actId;
}
public void setActId(String actId) {
this.actId = actId;
}
}
}

View File

@ -1,336 +0,0 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.annotations.SerializedName;
public class AssistantRoomInfoEntity extends ResponseEntity {
/**
* code : 0
* message : ok
* msg : ok
* data : {"roomId":29434,"face":"https://i1.hdslb.com/bfs/face/0434dccc0ec4de223e8ca374dea06a6e1e8eb471.jpg","uname":"hyx5020","rcost":35946,"online":519,"status":0,"fansNum":548,"title":"SpaceX重型猎鹰FH发射重播","istry":0,"try_time":"0000-00-00 00:00:00","is_medal":1,"medal_name":"502零","medal_status":1,"medal_rename_status":1,"master_score":8786,"master_level":11,"master_level_color":5805790,"master_next_level":12,"master_level_current":12450,"max_level":40,"end_day":-1,"identification":1,"identification_check_status":1,"area":33,"open_medal_level":10,"is_set_medal":1,"fulltext":"LV等级5级或UP等级10级才能开通粉丝勋章哦~加油!"}
*/
@SerializedName("code")
private int code;
@SerializedName("data")
private Data data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public static class Data {
/**
* roomId : 29434
* face : https://i1.hdslb.com/bfs/face/0434dccc0ec4de223e8ca374dea06a6e1e8eb471.jpg
* uname : hyx5020
* rcost : 35946
* online : 519
* status : 0
* fansNum : 548
* title : SpaceX重型猎鹰FH发射重播
* istry : 0
* try_time : 0000-00-00 00:00:00
* is_medal : 1
* medal_name : 502零
* medal_status : 1
* medal_rename_status : 1
* master_score : 8786
* master_level : 11
* master_level_color : 5805790
* master_next_level : 12
* master_level_current : 12450
* max_level : 40
* end_day : -1
* identification : 1
* identification_check_status : 1
* area : 33
* open_medal_level : 10
* is_set_medal : 1
* fulltext : LV等级5级或UP等级10级才能开通粉丝勋章哦~加油
*/
@SerializedName("roomId")
private int roomId;
@SerializedName("face")
private String face;
@SerializedName("uname")
private String username;
@SerializedName("rcost")
private int roomCost;
@SerializedName("online")
private int online;
@SerializedName("status")
private int status;
@SerializedName("fansNum")
private int fansNum;
@SerializedName("title")
private String title;
@SerializedName("istry")
private int isTry;
@SerializedName("try_time")
private String tryTime;
@SerializedName("is_medal")
private int isMedal;
@SerializedName("medal_name")
private String medalName;
@SerializedName("medal_status")
private int medalStatus;
@SerializedName("medal_rename_status")
private int medalRenameStatus;
@SerializedName("master_score")
private int masterScore;
@SerializedName("master_level")
private int masterLevel;
@SerializedName("master_level_color")
private int masterLevelColor;
@SerializedName("master_next_level")
private int masterNextLevel;
@SerializedName("master_level_current")
private int masterLevelCurrent;
@SerializedName("max_level")
private int maxLevel;
@SerializedName("end_day")
private int endDay;
@SerializedName("identification")
private int identification;
@SerializedName("identification_check_status")
private int identificationCheckStatus;
@SerializedName("area")
private int area;
@SerializedName("open_medal_level")
private int openMedalLevel;
@SerializedName("is_set_medal")
private int isSetMedal;
@SerializedName("fulltext")
private String fulltext;
public int getRoomId() {
return roomId;
}
public void setRoomId(int roomId) {
this.roomId = roomId;
}
public String getFace() {
return face;
}
public void setFace(String face) {
this.face = face;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public int getRoomCost() {
return roomCost;
}
public void setRoomCost(int roomCost) {
this.roomCost = roomCost;
}
public int getOnline() {
return online;
}
public void setOnline(int online) {
this.online = online;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public int getFansNum() {
return fansNum;
}
public void setFansNum(int fansNum) {
this.fansNum = fansNum;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public int getIsTry() {
return isTry;
}
public void setIsTry(int isTry) {
this.isTry = isTry;
}
public String getTryTime() {
return tryTime;
}
public void setTryTime(String tryTime) {
this.tryTime = tryTime;
}
public int getIsMedal() {
return isMedal;
}
public void setIsMedal(int isMedal) {
this.isMedal = isMedal;
}
public String getMedalName() {
return medalName;
}
public void setMedalName(String medalName) {
this.medalName = medalName;
}
public int getMedalStatus() {
return medalStatus;
}
public void setMedalStatus(int medalStatus) {
this.medalStatus = medalStatus;
}
public int getMedalRenameStatus() {
return medalRenameStatus;
}
public void setMedalRenameStatus(int medalRenameStatus) {
this.medalRenameStatus = medalRenameStatus;
}
public int getMasterScore() {
return masterScore;
}
public void setMasterScore(int masterScore) {
this.masterScore = masterScore;
}
public int getMasterLevel() {
return masterLevel;
}
public void setMasterLevel(int masterLevel) {
this.masterLevel = masterLevel;
}
public int getMasterLevelColor() {
return masterLevelColor;
}
public void setMasterLevelColor(int masterLevelColor) {
this.masterLevelColor = masterLevelColor;
}
public int getMasterNextLevel() {
return masterNextLevel;
}
public void setMasterNextLevel(int masterNextLevel) {
this.masterNextLevel = masterNextLevel;
}
public int getMasterLevelCurrent() {
return masterLevelCurrent;
}
public void setMasterLevelCurrent(int masterLevelCurrent) {
this.masterLevelCurrent = masterLevelCurrent;
}
public int getMaxLevel() {
return maxLevel;
}
public void setMaxLevel(int maxLevel) {
this.maxLevel = maxLevel;
}
public int getEndDay() {
return endDay;
}
public void setEndDay(int endDay) {
this.endDay = endDay;
}
public int getIdentification() {
return identification;
}
public void setIdentification(int identification) {
this.identification = identification;
}
public int getIdentificationCheckStatus() {
return identificationCheckStatus;
}
public void setIdentificationCheckStatus(int identificationCheckStatus) {
this.identificationCheckStatus = identificationCheckStatus;
}
public int getArea() {
return area;
}
public void setArea(int area) {
this.area = area;
}
public int getOpenMedalLevel() {
return openMedalLevel;
}
public void setOpenMedalLevel(int openMedalLevel) {
this.openMedalLevel = openMedalLevel;
}
public int getIsSetMedal() {
return isSetMedal;
}
public void setIsSetMedal(int isSetMedal) {
this.isSetMedal = isSetMedal;
}
public String getFulltext() {
return fulltext;
}
public void setFulltext(String fulltext) {
this.fulltext = fulltext;
}
}
}

View File

@ -1,277 +0,0 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class AwardsEntity extends ResponseEntity {
/**
* code : 0
* message : OK
* data : {"list":[{"id":100000,"uid":1000000,"gift_name":"小电视","gift_type":"2","gift_num":1,"user_name":"打码","user_phone":"打码","user_address":"打码","user_extra_field":"{\"user_area\":\"打码\",\"user_post_code\":\"打码\",\"user_city\":\"打码\",\"user_province\":\"打码\"}","source":"小电视抽奖","source_id":10000,"create_time":"2018-02-01 00:00:00","update_time":null,"expire_time":"2018-02-16 00:00:00","comment":null,"status":0,"expire":true,"finished":true},{"id":10000,"uid":1000000,"gift_name":"小米Max2手机","gift_type":"2","gift_num":1,"user_name":"打码","user_phone":"打码","user_address":"打码","user_extra_field":"{\"user_province\":\"\\u6253\\u7801\",\"user_city\":\"\\u6253\\u7801\",\"user_area\":\"\\u6253\\u7801\",\"user_post_code\":\"打码\"}","source":"小米Max2超耐久直播第二季","source_id":1,"create_time":"2017-06-01 00:00:00","update_time":"2017-06-01 00:00:00","expire_time":"2017-06-30 00:00:00","comment":null,"status":0,"expire":true,"finished":true}],"use_count":0,"count":2}
*/
@SerializedName("code")
private int code;
@SerializedName("data")
private Data data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public static class Data {
/**
* list : [{"id":100000,"uid":1000000,"gift_name":"小电视","gift_type":"2","gift_num":1,"user_name":"打码","user_phone":"打码","user_address":"打码","user_extra_field":"{\"user_area\":\"打码\",\"user_post_code\":\"打码\",\"user_city\":\"打码\",\"user_province\":\"打码\"}","source":"小电视抽奖","source_id":10000,"create_time":"2018-02-01 00:00:00","update_time":null,"expire_time":"2018-02-16 00:00:00","comment":null,"status":0,"expire":true,"finished":true},{"id":10000,"uid":1000000,"gift_name":"小米Max2手机","gift_type":"2","gift_num":1,"user_name":"打码","user_phone":"打码","user_address":"打码","user_extra_field":"{\"user_province\":\"\\u6253\\u7801\",\"user_city\":\"\\u6253\\u7801\",\"user_area\":\"\\u6253\\u7801\",\"user_post_code\":\"打码\"}","source":"小米Max2超耐久直播第二季","source_id":1,"create_time":"2017-06-01 00:00:00","update_time":"2017-06-01 00:00:00","expire_time":"2017-06-30 00:00:00","comment":null,"status":0,"expire":true,"finished":true}]
* use_count : 0
* count : 2
*/
@SerializedName("use_count")
private int useCount;
@SerializedName("count")
private int count;
@SerializedName("list")
private List<Award> awardList;
public int getUseCount() {
return useCount;
}
public void setUseCount(int useCount) {
this.useCount = useCount;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public List<Award> getAwardList() {
return awardList;
}
public void setAwardList(List<Award> awardList) {
this.awardList = awardList;
}
public static class Award {
/**
* id : 100000
* uid : 1000000
* gift_name : 小电视
* gift_type : 2
* gift_num : 1
* user_name : 打码
* user_phone : 打码
* user_address : 打码
* user_extra_field : {"user_area":"打码","user_post_code":"打码","user_city":"打码","user_province":"打码"}
* source : 小电视抽奖
* source_id : 10000
* create_time : 2018-02-01 00:00:00
* update_time : null
* expire_time : 2018-02-16 00:00:00
* comment : null
* status : 0
* expire : true
* finished : true
*/
@SerializedName("id")
private int id;
@SerializedName("uid")
private long userId;
@SerializedName("gift_name")
private String giftName;
@SerializedName("gift_type")
private String giftType;
@SerializedName("gift_num")
private int giftNum;
@SerializedName("user_name")
private String userName;
@SerializedName("user_phone")
private String userPhone;
@SerializedName("user_address")
private String userAddress;
@SerializedName("user_extra_field")
private String userExtraField;
@SerializedName("source")
private String source;
@SerializedName("source_id")
private int sourceId;
@SerializedName("create_time")
private String createTime;
@SerializedName("update_time")
private Object updateTime;
@SerializedName("expire_time")
private String expireTime;
@SerializedName("comment")
private Object comment;
@SerializedName("status")
private int status;
@SerializedName("expire")
private boolean expire;
@SerializedName("finished")
private boolean finished;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public long getUserId() {
return userId;
}
public void setUserId(long userId) {
this.userId = userId;
}
public String getGiftName() {
return giftName;
}
public void setGiftName(String giftName) {
this.giftName = giftName;
}
public String getGiftType() {
return giftType;
}
public void setGiftType(String giftType) {
this.giftType = giftType;
}
public int getGiftNum() {
return giftNum;
}
public void setGiftNum(int giftNum) {
this.giftNum = giftNum;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getUserPhone() {
return userPhone;
}
public void setUserPhone(String userPhone) {
this.userPhone = userPhone;
}
public String getUserAddress() {
return userAddress;
}
public void setUserAddress(String userAddress) {
this.userAddress = userAddress;
}
public String getUserExtraField() {
return userExtraField;
}
public void setUserExtraField(String userExtraField) {
this.userExtraField = userExtraField;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public int getSourceId() {
return sourceId;
}
public void setSourceId(int sourceId) {
this.sourceId = sourceId;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public Object getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Object updateTime) {
this.updateTime = updateTime;
}
public String getExpireTime() {
return expireTime;
}
public void setExpireTime(String expireTime) {
this.expireTime = expireTime;
}
public Object getComment() {
return comment;
}
public void setComment(Object comment) {
this.comment = comment;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public boolean isExpire() {
return expire;
}
public void setExpire(boolean expire) {
this.expire = expire;
}
public boolean isFinished() {
return finished;
}
public void setFinished(boolean finished) {
this.finished = finished;
}
}
}
}

View File

@ -1,71 +0,0 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.annotations.SerializedName;
public class BulletScreenConfigEntity extends ResponseEntity {
/**
* code : 0
* message : OK
* data : {"refresh_row_factor":0.125,"refresh_rate":100,"max_delay":5000}
*/
@SerializedName("code")
private int code;
@SerializedName("data")
private Data data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public static class Data {
/**
* refresh_row_factor : 0.125
* refresh_rate : 100
* max_delay : 5000
*/
@SerializedName("refresh_row_factor")
private double refreshRowFactor;
@SerializedName("refresh_rate")
private int refreshRate;
@SerializedName("max_delay")
private int maxDelay;
public double getRefreshRowFactor() {
return refreshRowFactor;
}
public void setRefreshRowFactor(double refreshRowFactor) {
this.refreshRowFactor = refreshRowFactor;
}
public int getRefreshRate() {
return refreshRate;
}
public void setRefreshRate(int refreshRate) {
this.refreshRate = refreshRate;
}
public int getMaxDelay() {
return maxDelay;
}
public void setMaxDelay(int maxDelay) {
this.maxDelay = maxDelay;
}
}
}

View File

@ -1,150 +0,0 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.annotations.SerializedName;
public class BulletScreenEntity {
@SerializedName("cid")
private long roomId;
@SerializedName("mid")
private long userId;
/**
* 弹幕长度限制为 LiveRoomInfoEntity.getData().getMsgLength(), 对于每个用户而言, 每个房间都一样
* 通过完成 B站 有关任务, 获得成就, 可以加大这个限制(舰长, 老爷等可以直接加大限制), 最长好像是 40 个字
*/
@SerializedName("msg")
private String message;
/**
* web 端发送弹幕, 该字段是固定的, 为用户进入直播页面的时间的时间戳. 但是在 Android , 这是一个随机数
* 该随机数不包括符号位有 9
*/
@SerializedName("rnd")
private long random = (long) (Math.random() * (999999999 - (-999999999)) + (-999999999));
/**
* 1 普通
* 4 底端
* 5 顶端
* 6 逆向
* 7 特殊
* 9 高级
* 一些模式需要 VIP
*/
private int mode = 1;
/**
* 弹幕池
* 尚且只见过为 0 的情况
*/
private int pool = 0;
private String type = "json";
private int color = 16777215;
@SerializedName("fontsize")
private int fontSize = 25;
private String playTime = "0.0";
/**
* 实际上并不需要包含 mid 就可以正常发送弹幕, 但是真实的 Android 客户端确实发送了 mid
*/
public BulletScreenEntity(long roomId, long userId, String message) {
this.roomId = roomId;
this.userId = userId;
this.message = message;
}
public long getRoomId() {
return roomId;
}
public BulletScreenEntity setRoomId(long roomId) {
this.roomId = roomId;
return this;
}
public long getUserId() {
return userId;
}
public BulletScreenEntity setUserId(long userId) {
this.userId = userId;
return this;
}
public String getMessage() {
return message;
}
public BulletScreenEntity setMessage(String message) {
this.message = message;
return this;
}
public long getRandom() {
return random;
}
public BulletScreenEntity setRandom(long random) {
this.random = random;
return this;
}
public int getMode() {
return mode;
}
public BulletScreenEntity setMode(int mode) {
this.mode = mode;
return this;
}
public int getPool() {
return pool;
}
public BulletScreenEntity setPool(int pool) {
this.pool = pool;
return this;
}
public String getType() {
return type;
}
public BulletScreenEntity setType(String type) {
this.type = type;
return this;
}
public int getColor() {
return color;
}
public BulletScreenEntity setColor(int color) {
this.color = color;
return this;
}
public int getFontSize() {
return fontSize;
}
public BulletScreenEntity setFontSize(int fontSize) {
this.fontSize = fontSize;
return this;
}
public String getPlayTime() {
return playTime;
}
public BulletScreenEntity setPlayTime(String playTime) {
this.playTime = playTime;
return this;
}
}

View File

@ -1,34 +0,0 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class CancelMedalResponseEntity extends ResponseEntity {
/**
* code : 0
* message : OK
* data : []
*/
@SerializedName("code")
private int code;
@SerializedName("data")
private List<?> data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public List<?> getData() {
return data;
}
public void setData(List<?> data) {
this.data = data;
}
}

View File

@ -1,35 +0,0 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class CancelTitleResponseEntity extends ResponseEntity {
/**
* code : 0
* msg : success
* message : success
* data : []
*/
@SerializedName("code")
private int code;
@SerializedName("data")
private List<?> data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public List<?> getData() {
return data;
}
public void setData(List<?> data) {
this.data = data;
}
}

View File

@ -1,279 +0,0 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class CapsuleInfoEntity extends ResponseEntity {
/**
* code : 0
* message : OK
* data : {"normal":{"status":1,"coin":65,"change":5,"progress":{"now":1800,"max":10000},"rule":"使用价值累计达到10000瓜子的礼物包含直接使用瓜子购买、道具包裹但不包括产生梦幻扭蛋币的活动道具可以获得1枚扭蛋币。使用扭蛋币可以参与抽奖。","gift":[{"id":22,"name":"经验曜石","img":"https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/capsule-toy/normal/22.png?20171116172700"},{"id":21,"name":"经验原石","img":"https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/capsule-toy/normal/21.png?20171116172700"},{"id":30,"name":"爱心便当","img":"https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/capsule-toy/normal/30.png?20171116172700"},{"id":0,"name":"小号小电视","img":"https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/capsule-toy/normal/b.png?20171116172700"},{"id":4,"name":"蓝白胖次","img":"https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/capsule-toy/normal/4.png?20171116172700"},{"id":3,"name":"B坷垃","img":"https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/capsule-toy/normal/3.png?20171116172700"},{"id":2,"name":"亿圆","img":"https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/capsule-toy/normal/2.png?20171116172700"},{"id":1,"name":"辣条","img":"https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/capsule-toy/normal/1.png?20171116172700"}],"list":[{"num":"1","gift":"经验原石","date":"2018-03-02","name":"NShy小马"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"我去取经"},{"num":"1","gift":"经验曜石","date":"2018-03-02","name":"我去取经"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"我去取经"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"我去取经"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"我去取经"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"我去取经"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"我去取经"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"我去取经"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"五河墨子"},{"num":"1","gift":"经验曜石","date":"2018-03-02","name":"五河墨子"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"吃包子的560"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"NShy小马"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"薄荷and紫苏"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"莯兮吖"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"莯兮吖"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"NShy小马"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"黎梦的莫语小迷妹"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"薄荷and紫苏"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"薄荷and紫苏"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"ltg86692169"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"亦真亦幻似梦似醒"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"ATICN"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"黎离溱洧"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"龘卛逼"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"FENGHETAO"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"殇璃奏"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"= -"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"楠瓜精"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"楠瓜精"}]},"colorful":{"status":0}}
*/
@SerializedName("code")
private int code;
@SerializedName("data")
private Data data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public static class Data {
/**
* normal : {"status":1,"coin":65,"change":5,"progress":{"now":1800,"max":10000},"rule":"使用价值累计达到10000瓜子的礼物包含直接使用瓜子购买、道具包裹但不包括产生梦幻扭蛋币的活动道具可以获得1枚扭蛋币。使用扭蛋币可以参与抽奖。","gift":[{"id":22,"name":"经验曜石","img":"https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/capsule-toy/normal/22.png?20171116172700"},{"id":21,"name":"经验原石","img":"https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/capsule-toy/normal/21.png?20171116172700"},{"id":30,"name":"爱心便当","img":"https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/capsule-toy/normal/30.png?20171116172700"},{"id":0,"name":"小号小电视","img":"https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/capsule-toy/normal/b.png?20171116172700"},{"id":4,"name":"蓝白胖次","img":"https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/capsule-toy/normal/4.png?20171116172700"},{"id":3,"name":"B坷垃","img":"https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/capsule-toy/normal/3.png?20171116172700"},{"id":2,"name":"亿圆","img":"https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/capsule-toy/normal/2.png?20171116172700"},{"id":1,"name":"辣条","img":"https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/capsule-toy/normal/1.png?20171116172700"}],"list":[{"num":"1","gift":"经验原石","date":"2018-03-02","name":"NShy小马"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"我去取经"},{"num":"1","gift":"经验曜石","date":"2018-03-02","name":"我去取经"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"我去取经"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"我去取经"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"我去取经"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"我去取经"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"我去取经"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"我去取经"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"五河墨子"},{"num":"1","gift":"经验曜石","date":"2018-03-02","name":"五河墨子"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"吃包子的560"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"NShy小马"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"薄荷and紫苏"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"莯兮吖"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"莯兮吖"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"NShy小马"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"黎梦的莫语小迷妹"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"薄荷and紫苏"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"薄荷and紫苏"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"ltg86692169"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"亦真亦幻似梦似醒"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"ATICN"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"黎离溱洧"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"龘卛逼"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"FENGHETAO"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"殇璃奏"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"= -"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"楠瓜精"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"楠瓜精"}]}
* colorful : {"status":0}
*/
@SerializedName("normal")
private Normal normal;
@SerializedName("colorful")
private Colorful colorful;
public Normal getNormal() {
return normal;
}
public void setNormal(Normal normal) {
this.normal = normal;
}
public Colorful getColorful() {
return colorful;
}
public void setColorful(Colorful colorful) {
this.colorful = colorful;
}
public static class Normal {
/**
* status : 1
* coin : 65
* change : 5
* progress : {"now":1800,"max":10000}
* rule : 使用价值累计达到10000瓜子的礼物包含直接使用瓜子购买道具包裹但不包括产生梦幻扭蛋币的活动道具可以获得1枚扭蛋币使用扭蛋币可以参与抽奖
* gift : [{"id":22,"name":"经验曜石","img":"https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/capsule-toy/normal/22.png?20171116172700"},{"id":21,"name":"经验原石","img":"https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/capsule-toy/normal/21.png?20171116172700"},{"id":30,"name":"爱心便当","img":"https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/capsule-toy/normal/30.png?20171116172700"},{"id":0,"name":"小号小电视","img":"https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/capsule-toy/normal/b.png?20171116172700"},{"id":4,"name":"蓝白胖次","img":"https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/capsule-toy/normal/4.png?20171116172700"},{"id":3,"name":"B坷垃","img":"https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/capsule-toy/normal/3.png?20171116172700"},{"id":2,"name":"亿圆","img":"https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/capsule-toy/normal/2.png?20171116172700"},{"id":1,"name":"辣条","img":"https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/capsule-toy/normal/1.png?20171116172700"}]
* list : [{"num":"1","gift":"经验原石","date":"2018-03-02","name":"NShy小马"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"我去取经"},{"num":"1","gift":"经验曜石","date":"2018-03-02","name":"我去取经"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"我去取经"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"我去取经"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"我去取经"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"我去取经"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"我去取经"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"我去取经"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"五河墨子"},{"num":"1","gift":"经验曜石","date":"2018-03-02","name":"五河墨子"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"吃包子的560"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"NShy小马"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"薄荷and紫苏"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"莯兮吖"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"莯兮吖"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"NShy小马"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"黎梦的莫语小迷妹"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"薄荷and紫苏"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"薄荷and紫苏"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"ltg86692169"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"亦真亦幻似梦似醒"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"ATICN"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"黎离溱洧"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"龘卛逼"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"FENGHETAO"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"殇璃奏"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"= -"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"楠瓜精"},{"num":"1","gift":"经验原石","date":"2018-03-02","name":"楠瓜精"}]
*/
@SerializedName("status")
private int status;
@SerializedName("coin")
private long coin;
@SerializedName("change")
private int change;
@SerializedName("progress")
private Progress progress;
@SerializedName("rule")
private String rule;
@SerializedName("gift")
private List<Gift> gift;
@SerializedName("list")
private List<Winner> winners;
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public long getCoin() {
return coin;
}
public void setCoin(long coin) {
this.coin = coin;
}
public int getChange() {
return change;
}
public void setChange(int change) {
this.change = change;
}
public Progress getProgress() {
return progress;
}
public void setProgress(Progress progress) {
this.progress = progress;
}
public String getRule() {
return rule;
}
public void setRule(String rule) {
this.rule = rule;
}
public List<Gift> getGift() {
return gift;
}
public void setGift(List<Gift> gift) {
this.gift = gift;
}
public List<Winner> getWinners() {
return winners;
}
public void setWinners(List<Winner> winners) {
this.winners = winners;
}
public static class Progress {
/**
* now : 1800
* max : 10000
*/
@SerializedName("now")
private int now;
@SerializedName("max")
private int max;
public int getNow() {
return now;
}
public void setNow(int now) {
this.now = now;
}
public int getMax() {
return max;
}
public void setMax(int max) {
this.max = max;
}
}
public static class Gift {
/**
* id : 22
* name : 经验曜石
* img : https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/capsule-toy/normal/22.png?20171116172700
*/
@SerializedName("id")
private int id;
@SerializedName("name")
private String name;
@SerializedName("img")
private String img;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getImg() {
return img;
}
public void setImg(String img) {
this.img = img;
}
}
public static class Winner {
/**
* num : 1
* gift : 经验原石
* date : 2018-03-02
* name : NShy小马
*/
@SerializedName("num")
private String num;
@SerializedName("gift")
private String gift;
@SerializedName("date")
private String date;
@SerializedName("name")
private String name;
public String getNum() {
return num;
}
public void setNum(String num) {
this.num = num;
}
public String getGift() {
return gift;
}
public void setGift(String gift) {
this.gift = gift;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
}
public static class Colorful {
/**
* status : 0
*/
@SerializedName("status")
private int status;
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
}
}
}

View File

@ -1,179 +0,0 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class CoverEntity extends ResponseEntity {
/**
* code : 0
* message : OK
* msg : OK
* data : {"cover":"https://i0.hdslb.com/bfs/live/b4d4dbf35f7a30fb6b0a2ea4077514235262797e.jpg","status":1,"reason":"","isup":0,"cover_list":[{"id":381657,"iscover":1,"cover":"https://i0.hdslb.com/bfs/live/b4d4dbf35f7a30fb6b0a2ea4077514235262797e.jpg","status":1,"reason":"","isup":1,"lock":0},{"id":0,"reason":"","cover":"","isup":0,"lock":1,"status":2,"iscover":0},{"id":0,"reason":"","cover":"","isup":0,"lock":1,"status":2,"iscover":0},{"id":0,"reason":"","cover":"","isup":0,"lock":1,"status":2,"iscover":0}]}
*/
@SerializedName("code")
private int code;
@SerializedName("data")
private Data data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public static class Data {
/**
* cover : https://i0.hdslb.com/bfs/live/b4d4dbf35f7a30fb6b0a2ea4077514235262797e.jpg
* status : 1
* reason :
* isup : 0
* cover_list : [{"id":381657,"iscover":1,"cover":"https://i0.hdslb.com/bfs/live/b4d4dbf35f7a30fb6b0a2ea4077514235262797e.jpg","status":1,"reason":"","isup":1,"lock":0},{"id":0,"reason":"","cover":"","isup":0,"lock":1,"status":2,"iscover":0},{"id":0,"reason":"","cover":"","isup":0,"lock":1,"status":2,"iscover":0},{"id":0,"reason":"","cover":"","isup":0,"lock":1,"status":2,"iscover":0}]
*/
@SerializedName("cover")
private String cover;
@SerializedName("status")
private int status;
@SerializedName("reason")
private String reason;
@SerializedName("isup")
private int isUp;
@SerializedName("cover_list")
private List<CoverData> coverList;
public String getCover() {
return cover;
}
public void setCover(String cover) {
this.cover = cover;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
public int getIsUp() {
return isUp;
}
public void setIsUp(int isUp) {
this.isUp = isUp;
}
public List<CoverData> getCoverList() {
return coverList;
}
public void setCoverList(List<CoverData> coverList) {
this.coverList = coverList;
}
public static class CoverData {
/**
* id : 381657
* iscover : 1
* cover : https://i0.hdslb.com/bfs/live/b4d4dbf35f7a30fb6b0a2ea4077514235262797e.jpg
* status : 1
* reason :
* isup : 1
* lock : 0
*/
@SerializedName("id")
private int id;
@SerializedName("iscover")
private int isCover;
@SerializedName("cover")
private String cover;
@SerializedName("status")
private int status;
@SerializedName("reason")
private String reason;
@SerializedName("isup")
private int isUp;
@SerializedName("lock")
private int lock;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getIsCover() {
return isCover;
}
public void setIsCover(int isCover) {
this.isCover = isCover;
}
public String getCover() {
return cover;
}
public void setCover(String cover) {
this.cover = cover;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
public int getIsUp() {
return isUp;
}
public void setIsUp(int isUp) {
this.isUp = isUp;
}
public int getLock() {
return lock;
}
public void setLock(int lock) {
this.lock = lock;
}
}
}
}

File diff suppressed because one or more lines are too long

View File

@ -1,82 +0,0 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.annotations.SerializedName;
public class FreeSilverAwardEntity extends ResponseEntity {
/**
* code : 0
* message : ok
* data : {"surplus":-1039.6166666667,"silver":2426,"awardSilver":30,"isEnd":0}
*/
@SerializedName("code")
private int code;
@SerializedName("data")
private Data data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public static class Data {
/**
* surplus : -1039.6166666667
* silver : 2426
* awardSilver : 30
* isEnd : 0
*/
@SerializedName("surplus")
private double surplus;
@SerializedName("silver")
private int silver;
@SerializedName("awardSilver")
private int awardSilver;
@SerializedName("isEnd")
private int isEnd;
public double getSurplus() {
return surplus;
}
public void setSurplus(double surplus) {
this.surplus = surplus;
}
public int getSilver() {
return silver;
}
public void setSilver(int silver) {
this.silver = silver;
}
public int getAwardSilver() {
return awardSilver;
}
public void setAwardSilver(int awardSilver) {
this.awardSilver = awardSilver;
}
public int getIsEnd() {
return isEnd;
}
public void setIsEnd(int isEnd) {
this.isEnd = isEnd;
}
}
}

View File

@ -1,104 +0,0 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.annotations.SerializedName;
public class FreeSilverCurrentTaskEntity extends ResponseEntity {
/**
* code : 0
* message :
* data : {"minute":3,"silver":30,"time_start":1509821442,"time_end":1509821622,"times":1,"max_times":3}
*/
@SerializedName("code")
private int code;
@SerializedName("data")
private Data data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public static class Data {
/**
* minute : 3
* silver : 30
* time_start : 1509821442
* time_end : 1509821622
* times : 1
* max_times : 3
*/
@SerializedName("minute")
private int minute;
@SerializedName("silver")
private int silver;
@SerializedName("time_start")
private int timeStart;
@SerializedName("time_end")
private int timeEnd;
@SerializedName("times")
private int times;
@SerializedName("max_times")
private int maxTimes;
public int getMinute() {
return minute;
}
public void setMinute(int minute) {
this.minute = minute;
}
public int getSilver() {
return silver;
}
public void setSilver(int silver) {
this.silver = silver;
}
public int getTimeStart() {
return timeStart;
}
public void setTimeStart(int timeStart) {
this.timeStart = timeStart;
}
public int getTimeEnd() {
return timeEnd;
}
public void setTimeEnd(int timeEnd) {
this.timeEnd = timeEnd;
}
public int getTimes() {
return times;
}
public void setTimes(int times) {
this.times = times;
}
public int getMaxTimes() {
return maxTimes;
}
public void setMaxTimes(int maxTimes) {
this.maxTimes = maxTimes;
}
}
}

View File

@ -1,144 +0,0 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.annotations.SerializedName;
public class GetAppSmallTVRewardResponseEntity extends ResponseEntity {
/**
* code : 0
* msg : ok
* message : ok
* data : {"fname":"","sname":"麦麦0w0","win":0,"reward":{"id":7,"num":2,"name":"辣条","url":"http://s1.hdslb.com/bfs/static/blive/live-assets/mobile/gift/mobilegift-static-icon/gift-1.png?20171118161652"},"status":0}
*/
@SerializedName("code")
private int code;
@SerializedName("data")
private Data data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public static class Data {
/**
* fname :
* sname : 麦麦0w0
* win : 0
* reward : {"id":7,"num":2,"name":"辣条","url":"http://s1.hdslb.com/bfs/static/blive/live-assets/mobile/gift/mobilegift-static-icon/gift-1.png?20171118161652"}
* status : 0
*/
@SerializedName("fname")
private String fname;
@SerializedName("sname")
private String sname;
@SerializedName("win")
private int win;
@SerializedName("reward")
private Reward reward;
@SerializedName("status")
private int status;
public String getFname() {
return fname;
}
public void setFname(String fname) {
this.fname = fname;
}
public String getSname() {
return sname;
}
public void setSname(String sname) {
this.sname = sname;
}
public int getWin() {
return win;
}
public void setWin(int win) {
this.win = win;
}
public Reward getReward() {
return reward;
}
public void setReward(Reward reward) {
this.reward = reward;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public static class Reward {
/**
* id : 7
* num : 2
* name : 辣条
* url : http://s1.hdslb.com/bfs/static/blive/live-assets/mobile/gift/mobilegift-static-icon/gift-1.png?20171118161652
*/
@SerializedName("id")
private int id;
@SerializedName("num")
private int num;
@SerializedName("name")
private String name;
@SerializedName("url")
private String url;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getNum() {
return num;
}
public void setNum(int num) {
this.num = num;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
}
}
}

View File

@ -1,121 +0,0 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.annotations.SerializedName;
import java.time.Instant;
public class GiftEntity {
@SerializedName("giftId")
private long giftId;
@SerializedName("bag_id")
private long bagId;
@SerializedName("num")
private long number;
@SerializedName("roomid")
private long roomId;
@SerializedName("ruid")
private long roomUserId;
@SerializedName("timestamp")
private long timeStamp = Instant.now().getEpochSecond();
//该随机数有 10 , 暂时未见到负数的情况
@SerializedName("rnd")
private long random = (long) (Math.random() * 9999999999L);
/**
* 礼物的构造器, giftId bagId 必须匹配, roomId roomUserId 必须匹配
*
* @param giftId 礼物 ID
* @param bagId 礼物在背包中的 ID
* @param number 数量
* @param roomId 房间号
* @param roomUserId 房间主播的用户 ID
*/
public GiftEntity(long giftId, long bagId, long number, long roomId, long roomUserId) {
this.giftId = giftId;
this.bagId = bagId;
this.number = number;
this.roomId = roomId;
this.roomUserId = roomUserId;
}
public GiftEntity(long giftId, long bagId, long number, LiveRoomInfoEntity.LiveRoom liveRoom) {
this(giftId, bagId, number, liveRoom.getRoomId(), liveRoom.getUserId());
}
public GiftEntity(PlayerBagEntity.BagGift bagGift, long number, long roomId, long roomUserId) {
this(bagGift.getGiftId(), bagGift.getId(), number, roomId, roomUserId);
}
public GiftEntity(PlayerBagEntity.BagGift bagGift, long number, LiveRoomInfoEntity.LiveRoom liveRoom) {
this(bagGift.getGiftId(), bagGift.getId(), number, liveRoom.getRoomId(), liveRoom.getUserId());
}
public long getGiftId() {
return giftId;
}
public GiftEntity setGiftId(long giftId) {
this.giftId = giftId;
return this;
}
public long getBagId() {
return bagId;
}
public GiftEntity setBagId(long bagId) {
this.bagId = bagId;
return this;
}
public long getNumber() {
return number;
}
public GiftEntity setNumber(long number) {
this.number = number;
return this;
}
public long getRoomId() {
return roomId;
}
public GiftEntity setRoomId(long roomId) {
this.roomId = roomId;
return this;
}
public long getRoomUserId() {
return roomUserId;
}
public GiftEntity setRoomUserId(long roomUserId) {
this.roomUserId = roomUserId;
return this;
}
public long getTimeStamp() {
return timeStamp;
}
public GiftEntity setTimeStamp(long timeStamp) {
this.timeStamp = timeStamp;
return this;
}
public long getRandom() {
return random;
}
public GiftEntity setRandom(long random) {
this.random = random;
return this;
}
}

View File

@ -1,189 +0,0 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class GiftTopEntity extends ResponseEntity {
/**
* code : 0
* message : OK
* data : {"unlogin":0,"uname":"czp3009","rank":1,"coin":25000,"list":[{"uid":20293030,"rank":1,"isSelf":1,"score":25000,"uname":"czp3009","coin":25000,"face":"http://i0.hdslb.com/bfs/face/4f65e79399ad5a1bf3f877851b2f819d5870b494.jpg","guard_level":0},{"uid":19946822,"rank":2,"isSelf":0,"score":8000,"uname":"罗非鱼追上来了","coin":8000,"face":"http://i2.hdslb.com/bfs/face/e71031a931125617fad2c148213381bb6e0e9f26.jpg","guard_level":0},{"uid":8353249,"rank":3,"isSelf":0,"score":3500,"uname":"TcCoke","coin":3500,"face":"http://i2.hdslb.com/bfs/face/7c3c131f89380db0046024d1a903d3a6e4dc6128.jpg","guard_level":0},{"uid":12872641,"rank":4,"isSelf":0,"score":2000,"uname":"biggy2","coin":2000,"face":"http://i2.hdslb.com/bfs/face/418ac05726b3e6d4c35ff6bcda7a2751266126b5.jpg","guard_level":0},{"uid":33577376,"rank":5,"isSelf":0,"score":1100,"uname":"SASA协会-MF设计局","coin":1100,"face":"http://i2.hdslb.com/bfs/face/33ac7325236b34bb36a34dc58502c322c6ceaced.jpg","guard_level":0},{"uid":35225572,"rank":6,"isSelf":0,"score":100,"uname":"kk东子","coin":100,"face":"http://i0.hdslb.com/bfs/face/278f12f9993c84ef673785a48968aef78dbde92e.jpg","guard_level":0}]}
*/
@SerializedName("code")
private int code;
@SerializedName("data")
private Data data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public static class Data {
/**
* unlogin : 0
* uname : czp3009
* rank : 1
* coin : 25000
* list : [{"uid":20293030,"rank":1,"isSelf":1,"score":25000,"uname":"czp3009","coin":25000,"face":"http://i0.hdslb.com/bfs/face/4f65e79399ad5a1bf3f877851b2f819d5870b494.jpg","guard_level":0},{"uid":19946822,"rank":2,"isSelf":0,"score":8000,"uname":"罗非鱼追上来了","coin":8000,"face":"http://i2.hdslb.com/bfs/face/e71031a931125617fad2c148213381bb6e0e9f26.jpg","guard_level":0},{"uid":8353249,"rank":3,"isSelf":0,"score":3500,"uname":"TcCoke","coin":3500,"face":"http://i2.hdslb.com/bfs/face/7c3c131f89380db0046024d1a903d3a6e4dc6128.jpg","guard_level":0},{"uid":12872641,"rank":4,"isSelf":0,"score":2000,"uname":"biggy2","coin":2000,"face":"http://i2.hdslb.com/bfs/face/418ac05726b3e6d4c35ff6bcda7a2751266126b5.jpg","guard_level":0},{"uid":33577376,"rank":5,"isSelf":0,"score":1100,"uname":"SASA协会-MF设计局","coin":1100,"face":"http://i2.hdslb.com/bfs/face/33ac7325236b34bb36a34dc58502c322c6ceaced.jpg","guard_level":0},{"uid":35225572,"rank":6,"isSelf":0,"score":100,"uname":"kk东子","coin":100,"face":"http://i0.hdslb.com/bfs/face/278f12f9993c84ef673785a48968aef78dbde92e.jpg","guard_level":0}]
*/
@SerializedName("unlogin")
private int unLogin;
@SerializedName("uname")
private String username;
@SerializedName("rank")
private int rank;
@SerializedName("coin")
private int coin;
@SerializedName("list")
private List<GiftSender> giftSenders;
public int getUnLogin() {
return unLogin;
}
public void setUnLogin(int unLogin) {
this.unLogin = unLogin;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public int getRank() {
return rank;
}
public void setRank(int rank) {
this.rank = rank;
}
public int getCoin() {
return coin;
}
public void setCoin(int coin) {
this.coin = coin;
}
public List<GiftSender> getGiftSenders() {
return giftSenders;
}
public void setGiftSenders(List<GiftSender> giftSenders) {
this.giftSenders = giftSenders;
}
public static class GiftSender {
/**
* uid : 20293030
* rank : 1
* isSelf : 1
* score : 25000
* uname : czp3009
* coin : 25000
* face : http://i0.hdslb.com/bfs/face/4f65e79399ad5a1bf3f877851b2f819d5870b494.jpg
* guard_level : 0
*/
@SerializedName("uid")
private long userId;
@SerializedName("rank")
private int rank;
@SerializedName("isSelf")
private int isSelf;
@SerializedName("score")
private int score;
@SerializedName("uname")
private String username;
@SerializedName("coin")
private int coin;
@SerializedName("face")
private String face;
@SerializedName("guard_level")
private int guardLevel;
public long getUserId() {
return userId;
}
public void setUserId(long userId) {
this.userId = userId;
}
public int getRank() {
return rank;
}
public void setRank(int rank) {
this.rank = rank;
}
public int getIsSelf() {
return isSelf;
}
public void setIsSelf(int isSelf) {
this.isSelf = isSelf;
}
public int getScore() {
return score;
}
public void setScore(int score) {
this.score = score;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public int getCoin() {
return coin;
}
public void setCoin(int coin) {
this.coin = coin;
}
public String getFace() {
return face;
}
public void setFace(String face) {
this.face = face;
}
public int getGuardLevel() {
return guardLevel;
}
public void setGuardLevel(int guardLevel) {
this.guardLevel = guardLevel;
}
}
}
}

File diff suppressed because one or more lines are too long

View File

@ -1,50 +0,0 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.annotations.SerializedName;
public class IsFollowedResponseEntity extends ResponseEntity {
/**
* code : 0
* msg : success
* message : success
* data : {"follow":1}
*/
@SerializedName("code")
private int code;
@SerializedName("data")
private Data data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public static class Data {
/**
* follow : 1
*/
@SerializedName("follow")
private int follow;
public int getFollow() {
return follow;
}
public void setFollow(int follow) {
this.follow = follow;
}
}
}

File diff suppressed because one or more lines are too long

View File

@ -1,72 +0,0 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.annotations.SerializedName;
public class JoinAppSmallTVResponseEntity extends ResponseEntity {
/**
* code : 0
* msg : OK
* message : OK
* data : {"id":40147,"dtime":179,"status":1}
*/
@SerializedName("code")
private int code;
@SerializedName("data")
private Data data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public static class Data {
/**
* id : 40147
* dtime : 179
* status : 1
*/
@SerializedName("id")
private long id;
@SerializedName("dtime")
private int dtime;
@SerializedName("status")
private int status;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public int getDtime() {
return dtime;
}
public void setDtime(int dtime) {
this.dtime = dtime;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
}
}

View File

@ -1,229 +0,0 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.JsonElement;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class LiveHistoryBulletScreensEntity extends ResponseEntity {
/**
* code : 0
* message : OK
* data : {"room":[{"text":"这是自动发送的弹幕","uid":20293030,"nickname":"czp3009","timeline":"2017-10-20 02:40:10","isadmin":0,"vip":0,"svip":0,"medal":[],"title":[""],"user_level":[12,0,6406234,">50000"],"rank":10000,"teamid":0,"rnd":-979658878,"user_title":"","guard_level":0},{"text":"这是自动发送的弹幕","uid":20293030,"nickname":"czp3009","timeline":"2017-10-20 02:40:59","isadmin":0,"vip":0,"svip":0,"medal":[],"title":[""],"user_level":[12,0,6406234,">50000"],"rank":10000,"teamid":0,"rnd":-979658878,"user_title":"","guard_level":0},{"text":"这是自动发送的弹幕","uid":20293030,"nickname":"czp3009","timeline":"2017-10-20 02:42:03","isadmin":0,"vip":0,"svip":0,"medal":[],"title":[""],"user_level":[12,0,6406234,">50000"],"rank":10000,"teamid":0,"rnd":-979658878,"user_title":"","guard_level":0},{"text":"这是自动发送的弹幕","uid":20293030,"nickname":"czp3009","timeline":"2017-10-20 02:42:08","isadmin":0,"vip":0,"svip":0,"medal":[],"title":[""],"user_level":[12,0,6406234,">50000"],"rank":10000,"teamid":0,"rnd":-979658878,"user_title":"","guard_level":0},{"text":"这是自动发送的弹幕","uid":20293030,"nickname":"czp3009","timeline":"2017-10-20 02:42:26","isadmin":0,"vip":0,"svip":0,"medal":[],"title":[""],"user_level":[12,0,6406234,">50000"],"rank":10000,"teamid":0,"rnd":-979658878,"user_title":"","guard_level":0},{"text":"这是自动发送的弹幕","uid":20293030,"nickname":"czp3009","timeline":"2017-10-20 02:42:31","isadmin":0,"vip":0,"svip":0,"medal":[],"title":[""],"user_level":[12,0,6406234,">50000"],"rank":10000,"teamid":0,"rnd":-979658878,"user_title":"","guard_level":0},{"text":"这是自动发送的弹幕","uid":20293030,"nickname":"czp3009","timeline":"2017-10-20 02:42:46","isadmin":0,"vip":0,"svip":0,"medal":[],"title":[""],"user_level":[12,0,6406234,">50000"],"rank":10000,"teamid":0,"rnd":-979658878,"user_title":"","guard_level":0},{"text":"感谢 czp3009 的 辣条","uid":20293030,"nickname":"czp3009","timeline":"2017-10-20 02:43:31","isadmin":0,"vip":0,"svip":0,"medal":[],"title":[""],"user_level":[12,0,6406234,">50000"],"rank":10000,"teamid":0,"rnd":-979658878,"user_title":"","guard_level":0},{"text":"感谢 czp3009 的 辣条","uid":20293030,"nickname":"czp3009","timeline":"2017-10-20 17:41:29","isadmin":0,"vip":0,"svip":0,"medal":[],"title":[""],"user_level":[12,0,6406234,">50000"],"rank":10000,"teamid":0,"rnd":-979658878,"user_title":"","guard_level":0},{"text":"感谢 czp3009 的 辣条","uid":20293030,"nickname":"czp3009","timeline":"2017-10-21 01:10:51","isadmin":0,"vip":0,"svip":0,"medal":[],"title":[""],"user_level":[12,0,6406234,">50000"],"rank":10000,"teamid":0,"rnd":-979658878,"user_title":"","guard_level":0}],"admin":[]}
*/
@SerializedName("code")
private int code;
@SerializedName("data")
private Data data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public static class Data {
@SerializedName("room")
private List<LiveHistoryBulletScreen> liveHistoryBulletScreens;
@SerializedName("admin")
private List<?> admin;
public List<LiveHistoryBulletScreen> getLiveHistoryBulletScreens() {
return liveHistoryBulletScreens;
}
public void setLiveHistoryBulletScreens(List<LiveHistoryBulletScreen> liveHistoryBulletScreens) {
this.liveHistoryBulletScreens = liveHistoryBulletScreens;
}
public List<?> getAdmin() {
return admin;
}
public void setAdmin(List<?> admin) {
this.admin = admin;
}
public static class LiveHistoryBulletScreen {
/**
* text : 这是自动发送的弹幕
* uid : 20293030
* nickname : czp3009
* timeline : 2017-10-20 02:40:10
* isadmin : 0
* vip : 0
* svip : 0
* medal : []
* title : [""]
* user_level : [12,0,6406234,">50000"]
* rank : 10000
* teamid : 0
* rnd : -979658878
* user_title :
* guard_level : 0
*/
@SerializedName("text")
private String text;
@SerializedName("uid")
private long userId;
@SerializedName("nickname")
private String nickname;
@SerializedName("timeline")
private String timeLine;
@SerializedName("isadmin")
private int isAdmin;
@SerializedName("vip")
private int vip;
@SerializedName("svip")
private int svip;
@SerializedName("rank")
private int rank;
@SerializedName("teamid")
private int teamId;
@SerializedName("rnd")
private long rnd;
@SerializedName("user_title")
private String userTitle;
@SerializedName("guard_level")
private int guardLevel;
@SerializedName("medal")
private List<JsonElement> medal;
@SerializedName("title")
private List<String> title;
@SerializedName("user_level")
private List<String> userLevel;
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public long getUserId() {
return userId;
}
public void setUserId(long userId) {
this.userId = userId;
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public String getTimeLine() {
return timeLine;
}
public void setTimeLine(String timeLine) {
this.timeLine = timeLine;
}
public int getIsAdmin() {
return isAdmin;
}
public void setIsAdmin(int isAdmin) {
this.isAdmin = isAdmin;
}
public int getVip() {
return vip;
}
public void setVip(int vip) {
this.vip = vip;
}
public int getSvip() {
return svip;
}
public void setSvip(int svip) {
this.svip = svip;
}
public int getRank() {
return rank;
}
public void setRank(int rank) {
this.rank = rank;
}
public int getTeamId() {
return teamId;
}
public void setTeamId(int teamId) {
this.teamId = teamId;
}
public long getRnd() {
return rnd;
}
public void setRnd(long rnd) {
this.rnd = rnd;
}
public String getUserTitle() {
return userTitle;
}
public void setUserTitle(String userTitle) {
this.userTitle = userTitle;
}
public int getGuardLevel() {
return guardLevel;
}
public void setGuardLevel(int guardLevel) {
this.guardLevel = guardLevel;
}
public List<JsonElement> getMedal() {
return medal;
}
public void setMedal(List<JsonElement> medal) {
this.medal = medal;
}
public List<String> getTitle() {
return title;
}
public void setTitle(List<String> title) {
this.title = title;
}
public List<String> getUserLevel() {
return userLevel;
}
public void setUserLevel(List<String> userLevel) {
this.userLevel = userLevel;
}
}
}
}

File diff suppressed because one or more lines are too long

View File

@ -1,205 +0,0 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.annotations.SerializedName;
public class MobileActivityEntity extends ResponseEntity {
/**
* code : 0
* msg :
* message :
* data : {"activity":{"keyword":"lover_2018","icon_web":"","jump_web":"","icon_mobile":"https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/activity/lover_2018/mobile.png","jump_mobile":"https://live.bilibili.com/blackboard/hour-rank.html#/?1110317","status":1},"task":{"keyword":"task_2017","icon_web":"//i0.hdslb.com/bfs/live/b86792f129a641d8fd4f1ee4a337fcb9d4eac25c.png","jump_web":"//link.bilibili.com/p/center/index#/user-center/achievement/task","jump_mobile":"https://live.bilibili.com/p/eden/task-h5#/","icon_mobile":"https://i0.hdslb.com/bfs/live/61f1b388c1f4ed2838800a4d928dae5ab03d7c44.png","status":0}}
*/
@SerializedName("code")
private int code;
@SerializedName("data")
private Data data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public static class Data {
/**
* activity : {"keyword":"lover_2018","icon_web":"","jump_web":"","icon_mobile":"https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/activity/lover_2018/mobile.png","jump_mobile":"https://live.bilibili.com/blackboard/hour-rank.html#/?1110317","status":1}
* task : {"keyword":"task_2017","icon_web":"//i0.hdslb.com/bfs/live/b86792f129a641d8fd4f1ee4a337fcb9d4eac25c.png","jump_web":"//link.bilibili.com/p/center/index#/user-center/achievement/task","jump_mobile":"https://live.bilibili.com/p/eden/task-h5#/","icon_mobile":"https://i0.hdslb.com/bfs/live/61f1b388c1f4ed2838800a4d928dae5ab03d7c44.png","status":0}
*/
@SerializedName("activity")
private Activity activity;
@SerializedName("task")
private Task task;
public Activity getActivity() {
return activity;
}
public void setActivity(Activity activity) {
this.activity = activity;
}
public Task getTask() {
return task;
}
public void setTask(Task task) {
this.task = task;
}
public static class Activity {
/**
* keyword : lover_2018
* icon_web :
* jump_web :
* icon_mobile : https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/activity/lover_2018/mobile.png
* jump_mobile : https://live.bilibili.com/blackboard/hour-rank.html#/?1110317
* status : 1
*/
@SerializedName("keyword")
private String keyword;
@SerializedName("icon_web")
private String iconWeb;
@SerializedName("jump_web")
private String jumpWeb;
@SerializedName("icon_mobile")
private String iconMobile;
@SerializedName("jump_mobile")
private String jumpMobile;
@SerializedName("status")
private int status;
public String getKeyword() {
return keyword;
}
public void setKeyword(String keyword) {
this.keyword = keyword;
}
public String getIconWeb() {
return iconWeb;
}
public void setIconWeb(String iconWeb) {
this.iconWeb = iconWeb;
}
public String getJumpWeb() {
return jumpWeb;
}
public void setJumpWeb(String jumpWeb) {
this.jumpWeb = jumpWeb;
}
public String getIconMobile() {
return iconMobile;
}
public void setIconMobile(String iconMobile) {
this.iconMobile = iconMobile;
}
public String getJumpMobile() {
return jumpMobile;
}
public void setJumpMobile(String jumpMobile) {
this.jumpMobile = jumpMobile;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
}
public static class Task {
/**
* keyword : task_2017
* icon_web : //i0.hdslb.com/bfs/live/b86792f129a641d8fd4f1ee4a337fcb9d4eac25c.png
* jump_web : //link.bilibili.com/p/center/index#/user-center/achievement/task
* jump_mobile : https://live.bilibili.com/p/eden/task-h5#/
* icon_mobile : https://i0.hdslb.com/bfs/live/61f1b388c1f4ed2838800a4d928dae5ab03d7c44.png
* status : 0
*/
@SerializedName("keyword")
private String keyword;
@SerializedName("icon_web")
private String iconWeb;
@SerializedName("jump_web")
private String jumpWeb;
@SerializedName("jump_mobile")
private String jumpMobile;
@SerializedName("icon_mobile")
private String iconMobile;
@SerializedName("status")
private int status;
public String getKeyword() {
return keyword;
}
public void setKeyword(String keyword) {
this.keyword = keyword;
}
public String getIconWeb() {
return iconWeb;
}
public void setIconWeb(String iconWeb) {
this.iconWeb = iconWeb;
}
public String getJumpWeb() {
return jumpWeb;
}
public void setJumpWeb(String jumpWeb) {
this.jumpWeb = jumpWeb;
}
public String getJumpMobile() {
return jumpMobile;
}
public void setJumpMobile(String jumpMobile) {
this.jumpMobile = jumpMobile;
}
public String getIconMobile() {
return iconMobile;
}
public void setIconMobile(String iconMobile) {
this.iconMobile = iconMobile;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
}
}
}

View File

@ -1,150 +0,0 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class MyMedalListEntity extends ResponseEntity {
/**
* code : 0
* message : OK
* data : [{"medal_id":7,"medal_name":"欧皇","level":3,"uname":"哔哩哔哩直播","intimacy":218,"next_intimacy":500,"status":1,"color":6406234,"guard_type":0,"buff_msg":""},{"medal_id":296,"medal_name":"滚滚","level":2,"uname":"iPanda熊猫频道","intimacy":200,"next_intimacy":300,"status":0,"color":6406234,"guard_type":0,"buff_msg":""},{"medal_id":1411,"medal_name":"工程师","level":1,"uname":"ici2cc","intimacy":0,"next_intimacy":201,"status":0,"color":6406234,"guard_type":0,"buff_msg":""},{"medal_id":13197,"medal_name":"QPC","level":2,"uname":"QPCKerman","intimacy":299,"next_intimacy":300,"status":0,"color":6406234,"guard_type":0,"buff_msg":""}]
*/
@SerializedName("code")
private int code;
@SerializedName("data")
private List<Medal> data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public List<Medal> getData() {
return data;
}
public void setData(List<Medal> data) {
this.data = data;
}
public static class Medal {
/**
* medal_id : 7
* medal_name : 欧皇
* level : 3
* uname : 哔哩哔哩直播
* intimacy : 218
* next_intimacy : 500
* status : 1
* color : 6406234
* guard_type : 0
* buff_msg :
*/
@SerializedName("medal_id")
private int medalId;
@SerializedName("medal_name")
private String medalName;
@SerializedName("level")
private int level;
@SerializedName("uname")
private String username;
@SerializedName("intimacy")
private int intimacy;
@SerializedName("next_intimacy")
private int nextIntimacy;
@SerializedName("status")
private int status;
@SerializedName("color")
private int color;
@SerializedName("guard_type")
private int guardType;
@SerializedName("buff_msg")
private String buffMsg;
public int getMedalId() {
return medalId;
}
public void setMedalId(int medalId) {
this.medalId = medalId;
}
public String getMedalName() {
return medalName;
}
public void setMedalName(String medalName) {
this.medalName = medalName;
}
public int getLevel() {
return level;
}
public void setLevel(int level) {
this.level = level;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public int getIntimacy() {
return intimacy;
}
public void setIntimacy(int intimacy) {
this.intimacy = intimacy;
}
public int getNextIntimacy() {
return nextIntimacy;
}
public void setNextIntimacy(int nextIntimacy) {
this.nextIntimacy = nextIntimacy;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public int getColor() {
return color;
}
public void setColor(int color) {
this.color = color;
}
public int getGuardType() {
return guardType;
}
public void setGuardType(int guardType) {
this.guardType = guardType;
}
public String getBuffMsg() {
return buffMsg;
}
public void setBuffMsg(String buffMsg) {
this.buffMsg = buffMsg;
}
}
}

View File

@ -1,286 +0,0 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.JsonElement;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class MyTitleListEntity extends ResponseEntity {
/**
* code : 0
* message : 获取成功
* data : {"list":[{"uid":2866663,"had":true,"title":"title-111-1","status":0,"activity":"2017Blink","score":0,"level":[],"category":[{"name":"热门","class":"red"}],"title_pic":{"id":"title-111-1","title":"2017Blink","img":"https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/titles/title/3/title-111-1.png?20171116172700","width":0,"height":0,"is_lihui":0,"lihui_img":"","lihui_width":0,"lihui_height":0}}]}
*/
@SerializedName("code")
private int code;
@SerializedName("data")
private Data data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public static class Data {
@SerializedName("list")
private List<Title> list;
public List<Title> getList() {
return list;
}
public void setList(List<Title> list) {
this.list = list;
}
public static class Title {
/**
* uid : 2866663
* had : true
* title : title-111-1
* status : 0
* activity : 2017Blink
* score : 0
* level : []
* category : [{"name":"热门","class":"red"}]
* title_pic : {"id":"title-111-1","title":"2017Blink","img":"https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/titles/title/3/title-111-1.png?20171116172700","width":0,"height":0,"is_lihui":0,"lihui_img":"","lihui_width":0,"lihui_height":0}
*/
@SerializedName("uid")
private long userId;
@SerializedName("had")
private boolean had;
@SerializedName("title")
private String title;
@SerializedName("status")
private int status;
@SerializedName("activity")
private String activity;
@SerializedName("score")
private int score;
@SerializedName("title_pic")
private TitlePic titlePic;
@SerializedName("level")
private List<JsonElement> level;
@SerializedName("category")
private List<Category> category;
public long getUserId() {
return userId;
}
public void setUserId(long userId) {
this.userId = userId;
}
public boolean isHad() {
return had;
}
public void setHad(boolean had) {
this.had = had;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getActivity() {
return activity;
}
public void setActivity(String activity) {
this.activity = activity;
}
public int getScore() {
return score;
}
public void setScore(int score) {
this.score = score;
}
public TitlePic getTitlePic() {
return titlePic;
}
public void setTitlePic(TitlePic titlePic) {
this.titlePic = titlePic;
}
public List<JsonElement> getLevel() {
return level;
}
public void setLevel(List<JsonElement> level) {
this.level = level;
}
public List<Category> getCategory() {
return category;
}
public void setCategory(List<Category> category) {
this.category = category;
}
public static class TitlePic {
/**
* id : title-111-1
* title : 2017Blink
* img : https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/titles/title/3/title-111-1.png?20171116172700
* width : 0
* height : 0
* is_lihui : 0
* lihui_img :
* lihui_width : 0
* lihui_height : 0
*/
@SerializedName("id")
private String id;
@SerializedName("title")
private String title;
@SerializedName("img")
private String img;
@SerializedName("width")
private int width;
@SerializedName("height")
private int height;
@SerializedName("is_lihui")
private int isLiHui;
@SerializedName("lihui_img")
private String liHuiImg;
@SerializedName("lihui_width")
private int liHuiWidth;
@SerializedName("lihui_height")
private int liHuiHeight;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getImg() {
return img;
}
public void setImg(String img) {
this.img = img;
}
public int getWidth() {
return width;
}
public void setWidth(int width) {
this.width = width;
}
public int getHeight() {
return height;
}
public void setHeight(int height) {
this.height = height;
}
public int getIsLiHui() {
return isLiHui;
}
public void setIsLiHui(int isLiHui) {
this.isLiHui = isLiHui;
}
public String getLiHuiImg() {
return liHuiImg;
}
public void setLiHuiImg(String liHuiImg) {
this.liHuiImg = liHuiImg;
}
public int getLiHuiWidth() {
return liHuiWidth;
}
public void setLiHuiWidth(int liHuiWidth) {
this.liHuiWidth = liHuiWidth;
}
public int getLiHuiHeight() {
return liHuiHeight;
}
public void setLiHuiHeight(int liHuiHeight) {
this.liHuiHeight = liHuiHeight;
}
}
public static class Category {
/**
* name : 热门
* class : red
*/
@SerializedName("name")
private String name;
@SerializedName("class")
private String classX;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getClassX() {
return classX;
}
public void setClassX(String classX) {
this.classX = classX;
}
}
}
}
}

View File

@ -1,162 +0,0 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class OpenCapsuleResponseEntity extends ResponseEntity {
/**
* code : 0
* message : OK
* data : {"status":1,"text":[{"name":"辣条","num":"1","img":"https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/capsule-toy/open/normal/1.png?20171116172700"}],"isEntity":0,"coin":43,"progress":{"now":7000,"max":10000}}
*/
@SerializedName("code")
private int code;
@SerializedName("data")
private Data data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public static class Data {
/**
* status : 1
* text : [{"name":"辣条","num":"1","img":"https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/capsule-toy/open/normal/1.png?20171116172700"}]
* isEntity : 0
* coin : 43
* progress : {"now":7000,"max":10000}
*/
@SerializedName("status")
private int status;
@SerializedName("isEntity")
private int isEntity;
@SerializedName("coin")
private int coin;
@SerializedName("progress")
private Progress progress;
@SerializedName("text")
private List<Gift> gifts;
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public int getIsEntity() {
return isEntity;
}
public void setIsEntity(int isEntity) {
this.isEntity = isEntity;
}
public int getCoin() {
return coin;
}
public void setCoin(int coin) {
this.coin = coin;
}
public Progress getProgress() {
return progress;
}
public void setProgress(Progress progress) {
this.progress = progress;
}
public List<Gift> getGifts() {
return gifts;
}
public void setGifts(List<Gift> gifts) {
this.gifts = gifts;
}
public static class Progress {
/**
* now : 7000
* max : 10000
*/
@SerializedName("now")
private int now;
@SerializedName("max")
private int max;
public int getNow() {
return now;
}
public void setNow(int now) {
this.now = now;
}
public int getMax() {
return max;
}
public void setMax(int max) {
this.max = max;
}
}
public static class Gift {
/**
* name : 辣条
* num : 1
* img : https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/capsule-toy/open/normal/1.png?20171116172700
*/
@SerializedName("name")
private String name;
@SerializedName("num")
private String number;
@SerializedName("img")
private String img;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getNumber() {
return number;
}
public void setNumber(String number) {
this.number = number;
}
public String getImg() {
return img;
}
public void setImg(String img) {
this.img = img;
}
}
}
}

View File

@ -1,83 +0,0 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class PlayUrlEntity {
/**
* durl : [{"order":1,"length":0,"url":"http://live-play.acgvideo.com/live/241/live_2866663_332_c521e483.flv?wsSecret=562496ace51d8a998295656e7ef50a56&wsTime=59d68da4"}]
* accept_quality : [4]
* current_quality : 4
*/
@SerializedName("current_quality")
private int currentQuality;
@SerializedName("durl")
private List<DUrl> dUrl;
@SerializedName("accept_quality")
private List<Integer> acceptQuality;
public int getCurrentQuality() {
return currentQuality;
}
public void setCurrentQuality(int currentQuality) {
this.currentQuality = currentQuality;
}
public List<DUrl> getdUrl() {
return dUrl;
}
public void setdUrl(List<DUrl> dUrl) {
this.dUrl = dUrl;
}
public List<Integer> getAcceptQuality() {
return acceptQuality;
}
public void setAcceptQuality(List<Integer> acceptQuality) {
this.acceptQuality = acceptQuality;
}
public static class DUrl {
/**
* order : 1
* length : 0
* url : http://live-play.acgvideo.com/live/241/live_2866663_332_c521e483.flv?wsSecret=562496ace51d8a998295656e7ef50a56&wsTime=59d68da4
*/
@SerializedName("order")
private int order;
@SerializedName("length")
private int length;
@SerializedName("url")
private String url;
public int getOrder() {
return order;
}
public void setOrder(int order) {
this.order = order;
}
public int getLength() {
return length;
}
public void setLength(int length) {
this.length = length;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
}
}

View File

@ -1,184 +0,0 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.annotations.SerializedName;
import java.util.List;
import java.util.Map;
public class PlayerBagEntity extends ResponseEntity {
/**
* code : 0
* message : ok
* data : [{"id":49345439,"uid":20293030,"gift_id":1,"gift_num":2,"expireat":12797,"gift_type":0,"gift_name":"辣条","gift_price":"100 金瓜子/100 银瓜子","img":"http://static.hdslb.com/live-static/live-room/images/gift-section/mobilegift-static-icon/gift-1.png?20171010161652","count_set":"1,2","combo_num":99,"super_num":4500,"count_map":{"1":"","2":"全部"}},{"id":49318691,"uid":20293030,"gift_id":1,"gift_num":30,"expireat":531833,"gift_type":0,"gift_name":"辣条","gift_price":"100 金瓜子/100 银瓜子","img":"http://static.hdslb.com/live-static/live-room/images/gift-section/mobilegift-static-icon/gift-1.png?20171010161652","count_set":"1,10,30","combo_num":99,"super_num":4500,"count_map":{"1":"","30":"全部"}},{"id":48843715,"uid":20293030,"gift_id":102,"gift_num":9,"expireat":2482397,"gift_type":3,"gift_name":"秘银水壶","gift_price":"2000 金瓜子","img":"http://static.hdslb.com/live-static/live-room/images/gift-section/mobilegift-static-icon/gift-102.png?20171010161652","count_set":"1,5,9","combo_num":5,"super_num":225,"count_map":{"1":"","5":"连击","9":"全部"}}]
*/
@SerializedName("code")
private int code;
@SerializedName("data")
private List<BagGift> data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public List<BagGift> getData() {
return data;
}
public void setData(List<BagGift> data) {
this.data = data;
}
public static class BagGift {
/**
* id : 49345439
* uid : 20293030
* gift_id : 1
* gift_num : 2
* expireat : 12797
* gift_type : 0
* gift_name : 辣条
* gift_price : 100 金瓜子/100 银瓜子
* img : http://static.hdslb.com/live-static/live-room/images/gift-section/mobilegift-static-icon/gift-1.png?20171010161652
* count_set : 1,2
* combo_num : 99
* super_num : 4500
* count_map : {"1":"","2":"全部"}
*/
@SerializedName("id")
private long id;
@SerializedName("uid")
private long userId;
@SerializedName("gift_id")
private long giftId;
@SerializedName("gift_num")
private long giftNum;
@SerializedName("expireat")
private long expireAt;
@SerializedName("gift_type")
private long giftType;
@SerializedName("gift_name")
private String giftName;
@SerializedName("gift_price")
private String giftPrice;
@SerializedName("img")
private String img;
@SerializedName("count_set")
private String countSet;
@SerializedName("combo_num")
private long comboNumber;
@SerializedName("super_num")
private long superNumber;
@SerializedName("count_map")
private Map<String, String> countMap;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public long getUserId() {
return userId;
}
public void setUserId(long userId) {
this.userId = userId;
}
public long getGiftId() {
return giftId;
}
public void setGiftId(long giftId) {
this.giftId = giftId;
}
public long getGiftNum() {
return giftNum;
}
public void setGiftNum(long giftNum) {
this.giftNum = giftNum;
}
public long getExpireAt() {
return expireAt;
}
public void setExpireAt(long expireAt) {
this.expireAt = expireAt;
}
public long getGiftType() {
return giftType;
}
public void setGiftType(long giftType) {
this.giftType = giftType;
}
public String getGiftName() {
return giftName;
}
public void setGiftName(String giftName) {
this.giftName = giftName;
}
public String getGiftPrice() {
return giftPrice;
}
public void setGiftPrice(String giftPrice) {
this.giftPrice = giftPrice;
}
public String getImg() {
return img;
}
public void setImg(String img) {
this.img = img;
}
public String getCountSet() {
return countSet;
}
public void setCountSet(String countSet) {
this.countSet = countSet;
}
public long getComboNumber() {
return comboNumber;
}
public void setComboNumber(long comboNumber) {
this.comboNumber = comboNumber;
}
public long getSuperNumber() {
return superNumber;
}
public void setSuperNumber(long superNumber) {
this.superNumber = superNumber;
}
public Map<String, String> getCountMap() {
return countMap;
}
public void setCountMap(Map<String, String> countMap) {
this.countMap = countMap;
}
}
}

View File

@ -1,36 +0,0 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.JsonElement;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class ReceiveUserTaskAward extends ResponseEntity {
/**
* code : 0
* msg :
* message :
* data : []
*/
@SerializedName("code")
private int code;
@SerializedName("data")
private List<JsonElement> data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public List<JsonElement> getData() {
return data;
}
public void setData(List<JsonElement> data) {
this.data = data;
}
}

File diff suppressed because one or more lines are too long

View File

@ -1,29 +0,0 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.annotations.SerializedName;
public abstract class ResponseEntity {
//有一些返回的模型中的 code 是字符串, 所以这个父类不能包含 code
@SerializedName("msg")
private String msg;
@SerializedName("message")
private String message;
public String getMsg() {
return msg;
}
public ResponseEntity setMsg(String msg) {
this.msg = msg;
return this;
}
public String getMessage() {
return message;
}
public ResponseEntity setMessage(String message) {
this.message = message;
return this;
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,35 +0,0 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.JsonElement;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class SendBulletScreenResponseEntity extends ResponseEntity {
/**
* code : 0
* msg :
* data : []
*/
@SerializedName("code")
private int code;
@SerializedName("data")
private List<JsonElement> data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public List<JsonElement> getData() {
return data;
}
public void setData(List<JsonElement> data) {
this.data = data;
}
}

View File

@ -1,49 +0,0 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.annotations.SerializedName;
public class SendDailyResponseEntity extends ResponseEntity {
/**
* code : 0
* message : ok
* data : {"result":2}
*/
@SerializedName("code")
private int code;
@SerializedName("data")
private Data data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public static class Data {
/**
* result : 2
*/
@SerializedName("result")
private int result;
public int getResult() {
return result;
}
public void setResult(int result) {
this.result = result;
}
}
}

View File

@ -1,671 +0,0 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class SendGiftResponseEntity extends ResponseEntity {
/**
* code : 0
* msg : success
* message : success
* data : {"silver":"2696","gold":"0","data":{"giftName":"辣条","num":1,"uname":"czp3009","rcost":31134,"uid":20293030,"top_list":[{"uid":20293030,"uname":"czp3009","coin":25100,"face":"http://i0.hdslb.com/bfs/face/4f65e79399ad5a1bf3f877851b2f819d5870b494.jpg","guard_level":0,"rank":1,"score":25100},{"uid":19946822,"uname":"罗非鱼追上来了","coin":8000,"face":"http://i2.hdslb.com/bfs/face/e71031a931125617fad2c148213381bb6e0e9f26.jpg","guard_level":0,"rank":2,"score":8000},{"uid":8353249,"uname":"TcCoke","coin":3500,"face":"http://i2.hdslb.com/bfs/face/7c3c131f89380db0046024d1a903d3a6e4dc6128.jpg","guard_level":0,"rank":3,"score":3500}],"timestamp":1509972225,"giftId":1,"giftType":0,"action":"喂食","super":0,"price":100,"rnd":"1430788195","newMedal":0,"newTitle":0,"medal":[],"title":"","beatId":0,"biz_source":"live","metadata":"","remain":1,"gold":0,"silver":0,"eventScore":0,"eventNum":0,"smalltv_msg":[],"specialGift":null,"notice_msg":[],"capsule":{"normal":{"coin":10,"change":0,"progress":{"now":2900,"max":10000}},"colorful":{"coin":0,"change":0,"progress":{"now":0,"max":5000}}},"addFollow":0},"remain":1}
*/
@SerializedName("code")
private int code;
@SerializedName("data")
private Data data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public static class Data {
/**
* silver : 2696
* gold : 0
* data : {"giftName":"辣条","num":1,"uname":"czp3009","rcost":31134,"uid":20293030,"top_list":[{"uid":20293030,"uname":"czp3009","coin":25100,"face":"http://i0.hdslb.com/bfs/face/4f65e79399ad5a1bf3f877851b2f819d5870b494.jpg","guard_level":0,"rank":1,"score":25100},{"uid":19946822,"uname":"罗非鱼追上来了","coin":8000,"face":"http://i2.hdslb.com/bfs/face/e71031a931125617fad2c148213381bb6e0e9f26.jpg","guard_level":0,"rank":2,"score":8000},{"uid":8353249,"uname":"TcCoke","coin":3500,"face":"http://i2.hdslb.com/bfs/face/7c3c131f89380db0046024d1a903d3a6e4dc6128.jpg","guard_level":0,"rank":3,"score":3500}],"timestamp":1509972225,"giftId":1,"giftType":0,"action":"喂食","super":0,"price":100,"rnd":"1430788195","newMedal":0,"newTitle":0,"medal":[],"title":"","beatId":0,"biz_source":"live","metadata":"","remain":1,"gold":0,"silver":0,"eventScore":0,"eventNum":0,"smalltv_msg":[],"specialGift":null,"notice_msg":[],"capsule":{"normal":{"coin":10,"change":0,"progress":{"now":2900,"max":10000}},"colorful":{"coin":0,"change":0,"progress":{"now":0,"max":5000}}},"addFollow":0}
* remain : 1
*/
@SerializedName("silver")
private String silver;
@SerializedName("gold")
private String gold;
@SerializedName("data")
private DataX dataX;
@SerializedName("remain")
private int remain;
public String getSilver() {
return silver;
}
public void setSilver(String silver) {
this.silver = silver;
}
public String getGold() {
return gold;
}
public void setGold(String gold) {
this.gold = gold;
}
public DataX getDataX() {
return dataX;
}
public void setDataX(DataX dataX) {
this.dataX = dataX;
}
public int getRemain() {
return remain;
}
public void setRemain(int remain) {
this.remain = remain;
}
public static class DataX {
/**
* giftName : 辣条
* num : 1
* uname : czp3009
* rcost : 31134
* uid : 20293030
* top_list : [{"uid":20293030,"uname":"czp3009","coin":25100,"face":"http://i0.hdslb.com/bfs/face/4f65e79399ad5a1bf3f877851b2f819d5870b494.jpg","guard_level":0,"rank":1,"score":25100},{"uid":19946822,"uname":"罗非鱼追上来了","coin":8000,"face":"http://i2.hdslb.com/bfs/face/e71031a931125617fad2c148213381bb6e0e9f26.jpg","guard_level":0,"rank":2,"score":8000},{"uid":8353249,"uname":"TcCoke","coin":3500,"face":"http://i2.hdslb.com/bfs/face/7c3c131f89380db0046024d1a903d3a6e4dc6128.jpg","guard_level":0,"rank":3,"score":3500}]
* timestamp : 1509972225
* giftId : 1
* giftType : 0
* action : 喂食
* super : 0
* price : 100
* rnd : 1430788195
* newMedal : 0
* newTitle : 0
* medal : []
* title :
* beatId : 0
* biz_source : live
* metadata :
* remain : 1
* gold : 0
* silver : 0
* eventScore : 0
* eventNum : 0
* smalltv_msg : []
* specialGift : null
* notice_msg : []
* capsule : {"normal":{"coin":10,"change":0,"progress":{"now":2900,"max":10000}},"colorful":{"coin":0,"change":0,"progress":{"now":0,"max":5000}}}
* addFollow : 0
*/
@SerializedName("giftName")
private String giftName;
@SerializedName("num")
private int num;
@SerializedName("uname")
private String username;
@SerializedName("rcost")
private int roomCost;
@SerializedName("uid")
private int uid;
@SerializedName("timestamp")
private long timestamp;
@SerializedName("giftId")
private int giftId;
@SerializedName("giftType")
private int giftType;
@SerializedName("action")
private String action;
@SerializedName("super")
private int superX;
@SerializedName("price")
private int price;
@SerializedName("rnd")
private String rnd;
@SerializedName("newMedal")
private int newMedal;
@SerializedName("newTitle")
private int newTitle;
@SerializedName("title")
private String title;
@SerializedName("beatId")
private int beatId;
@SerializedName("biz_source")
private String bizSource;
@SerializedName("metadata")
private String metadata;
@SerializedName("remain")
private int remain;
@SerializedName("gold")
private int gold;
@SerializedName("silver")
private int silver;
@SerializedName("eventScore")
private int eventScore;
@SerializedName("eventNum")
private int eventNum;
@SerializedName("specialGift")
private JsonElement specialGift;
@SerializedName("capsule")
private Capsule capsule;
@SerializedName("addFollow")
private int addFollow;
@SerializedName("top_list")
private List<TopListData> topList;
/**
* medal 可能是空的 JsonArray, 也可能是一个 JsonObject
*/
@SerializedName("medal")
private JsonElement medal;
@SerializedName("smalltv_msg")
private JsonElement smallTvMsg;
@SerializedName("notice_msg")
private JsonElement noticeMsg;
public String getGiftName() {
return giftName;
}
public void setGiftName(String giftName) {
this.giftName = giftName;
}
public int getNum() {
return num;
}
public void setNum(int num) {
this.num = num;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public int getRoomCost() {
return roomCost;
}
public void setRoomCost(int roomCost) {
this.roomCost = roomCost;
}
public int getUid() {
return uid;
}
public void setUid(int uid) {
this.uid = uid;
}
public long getTimestamp() {
return timestamp;
}
public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}
public int getGiftId() {
return giftId;
}
public void setGiftId(int giftId) {
this.giftId = giftId;
}
public int getGiftType() {
return giftType;
}
public void setGiftType(int giftType) {
this.giftType = giftType;
}
public String getAction() {
return action;
}
public void setAction(String action) {
this.action = action;
}
public int getSuperX() {
return superX;
}
public void setSuperX(int superX) {
this.superX = superX;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public String getRnd() {
return rnd;
}
public void setRnd(String rnd) {
this.rnd = rnd;
}
public int getNewMedal() {
return newMedal;
}
public void setNewMedal(int newMedal) {
this.newMedal = newMedal;
}
public int getNewTitle() {
return newTitle;
}
public void setNewTitle(int newTitle) {
this.newTitle = newTitle;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public int getBeatId() {
return beatId;
}
public void setBeatId(int beatId) {
this.beatId = beatId;
}
public String getBizSource() {
return bizSource;
}
public void setBizSource(String bizSource) {
this.bizSource = bizSource;
}
public String getMetadata() {
return metadata;
}
public void setMetadata(String metadata) {
this.metadata = metadata;
}
public int getRemain() {
return remain;
}
public void setRemain(int remain) {
this.remain = remain;
}
public int getGold() {
return gold;
}
public void setGold(int gold) {
this.gold = gold;
}
public int getSilver() {
return silver;
}
public void setSilver(int silver) {
this.silver = silver;
}
public int getEventScore() {
return eventScore;
}
public void setEventScore(int eventScore) {
this.eventScore = eventScore;
}
public int getEventNum() {
return eventNum;
}
public void setEventNum(int eventNum) {
this.eventNum = eventNum;
}
public JsonElement getSpecialGift() {
return specialGift;
}
public void setSpecialGift(JsonObject specialGift) {
this.specialGift = specialGift;
}
public Capsule getCapsule() {
return capsule;
}
public void setCapsule(Capsule capsule) {
this.capsule = capsule;
}
public int getAddFollow() {
return addFollow;
}
public void setAddFollow(int addFollow) {
this.addFollow = addFollow;
}
public List<TopListData> getTopList() {
return topList;
}
public void setTopList(List<TopListData> topList) {
this.topList = topList;
}
public JsonElement getMedal() {
return medal;
}
public void setMedal(JsonElement medal) {
this.medal = medal;
}
public JsonElement getSmallTvMsg() {
return smallTvMsg;
}
public void setSmallTvMsg(JsonElement smallTvMsg) {
this.smallTvMsg = smallTvMsg;
}
public JsonElement getNoticeMsg() {
return noticeMsg;
}
public void setNoticeMsg(JsonElement noticeMsg) {
this.noticeMsg = noticeMsg;
}
public static class Capsule {
/**
* normal : {"coin":10,"change":0,"progress":{"now":2900,"max":10000}}
* colorful : {"coin":0,"change":0,"progress":{"now":0,"max":5000}}
*/
@SerializedName("normal")
private Normal normal;
@SerializedName("colorful")
private Colorful colorful;
public Normal getNormal() {
return normal;
}
public void setNormal(Normal normal) {
this.normal = normal;
}
public Colorful getColorful() {
return colorful;
}
public void setColorful(Colorful colorful) {
this.colorful = colorful;
}
public static class Normal {
/**
* coin : 10
* change : 0
* progress : {"now":2900,"max":10000}
*/
@SerializedName("coin")
private int coin;
@SerializedName("change")
private int change;
@SerializedName("progress")
private ProgressEntity progress;
public int getCoin() {
return coin;
}
public void setCoin(int coin) {
this.coin = coin;
}
public int getChange() {
return change;
}
public void setChange(int change) {
this.change = change;
}
public ProgressEntity getProgress() {
return progress;
}
public void setProgress(ProgressEntity progress) {
this.progress = progress;
}
public static class ProgressEntity {
/**
* now : 2900
* max : 10000
*/
@SerializedName("now")
private int now;
@SerializedName("max")
private int max;
public int getNow() {
return now;
}
public void setNow(int now) {
this.now = now;
}
public int getMax() {
return max;
}
public void setMax(int max) {
this.max = max;
}
}
}
public static class Colorful {
/**
* coin : 0
* change : 0
* progress : {"now":0,"max":5000}
*/
@SerializedName("coin")
private int coin;
@SerializedName("change")
private int change;
@SerializedName("progress")
private ProgressX progress;
public int getCoin() {
return coin;
}
public void setCoin(int coin) {
this.coin = coin;
}
public int getChange() {
return change;
}
public void setChange(int change) {
this.change = change;
}
public ProgressX getProgress() {
return progress;
}
public void setProgress(ProgressX progress) {
this.progress = progress;
}
public static class ProgressX {
/**
* now : 0
* max : 5000
*/
@SerializedName("now")
private int now;
@SerializedName("max")
private int max;
public int getNow() {
return now;
}
public void setNow(int now) {
this.now = now;
}
public int getMax() {
return max;
}
public void setMax(int max) {
this.max = max;
}
}
}
}
public static class TopListData {
/**
* uid : 20293030
* uname : czp3009
* coin : 25100
* face : http://i0.hdslb.com/bfs/face/4f65e79399ad5a1bf3f877851b2f819d5870b494.jpg
* guard_level : 0
* rank : 1
* score : 25100
*/
@SerializedName("uid")
private int uid;
@SerializedName("uname")
private String username;
@SerializedName("coin")
private int coin;
@SerializedName("face")
private String face;
@SerializedName("guard_level")
private int guardLevel;
@SerializedName("rank")
private int rank;
@SerializedName("score")
private int score;
public int getUid() {
return uid;
}
public void setUid(int uid) {
this.uid = uid;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public int getCoin() {
return coin;
}
public void setCoin(int coin) {
this.coin = coin;
}
public String getFace() {
return face;
}
public void setFace(String face) {
this.face = face;
}
public int getGuardLevel() {
return guardLevel;
}
public void setGuardLevel(int guardLevel) {
this.guardLevel = guardLevel;
}
public int getRank() {
return rank;
}
public void setRank(int rank) {
this.rank = rank;
}
public int getScore() {
return score;
}
public void setScore(int score) {
this.score = score;
}
}
}
}
}

View File

@ -1,48 +0,0 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.JsonElement;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class SendOnlineHeartResponseEntity extends ResponseEntity {
/**
* code : 0
* message : ok
* data : {"giftlist":[]}
*/
@SerializedName("code")
private int code;
@SerializedName("data")
private Data data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public static class Data {
@SerializedName("giftlist")
private List<JsonElement> giftList;
public List<JsonElement> getGiftList() {
return giftList;
}
public void setGiftList(List<JsonElement> giftList) {
this.giftList = giftList;
}
}
}

View File

@ -1,195 +0,0 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class SignInfoEntity extends ResponseEntity {
/**
* code : 0
* message : OK
* data : {"sign_msg":"今天签到已获得<br />&nbsp;辣条<font color='#fea024'>2个<\/font>&nbsp;经验<font color='#fea024'>3000<\/font>&nbsp;","maxday_num":30,"sign_day":4,"days_award":[{"id":1,"award":"silver","count":666,"text":"666银瓜子","day":5,"img":{"src":"http://static.hdslb.com/live-static/live-app/dayaward/1/5_1.png?20171102172700","width":56,"height":68}},{"id":2,"award":"vip","count":3,"text":"3天月费老爷","day":10,"img":{"src":"http://static.hdslb.com/live-static/live-app/dayaward/1/10_1.png?20171102172700","width":56,"height":68}},{"id":3,"award":"gift","count":4,"text":"1份喵娘","day":20,"img":{"src":"http://static.hdslb.com/live-static/live-app/dayaward/1/20_1.png?20171102172700","width":56,"height":68}},{"id":4,"award":"title","count":1,"text":"月老头衔","day":30,"img":{"src":"http://static.hdslb.com/live-static/live-app/dayaward/1/30_1.png?20171102172700","width":56,"height":68}}]}
*/
@SerializedName("code")
private int code;
@SerializedName("data")
private Data data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public static class Data {
/**
* sign_msg : 今天签到已获得<br />&nbsp;辣条<font color='#fea024'>2个</font>&nbsp;经验<font color='#fea024'>3000</font>&nbsp;
* maxday_num : 30
* sign_day : 4
* days_award : [{"id":1,"award":"silver","count":666,"text":"666银瓜子","day":5,"img":{"src":"http://static.hdslb.com/live-static/live-app/dayaward/1/5_1.png?20171102172700","width":56,"height":68}},{"id":2,"award":"vip","count":3,"text":"3天月费老爷","day":10,"img":{"src":"http://static.hdslb.com/live-static/live-app/dayaward/1/10_1.png?20171102172700","width":56,"height":68}},{"id":3,"award":"gift","count":4,"text":"1份喵娘","day":20,"img":{"src":"http://static.hdslb.com/live-static/live-app/dayaward/1/20_1.png?20171102172700","width":56,"height":68}},{"id":4,"award":"title","count":1,"text":"月老头衔","day":30,"img":{"src":"http://static.hdslb.com/live-static/live-app/dayaward/1/30_1.png?20171102172700","width":56,"height":68}}]
*/
@SerializedName("sign_msg")
private String signMsg;
@SerializedName("maxday_num")
private int maxDayNumber;
@SerializedName("sign_day")
private int signDay;
@SerializedName("days_award")
private List<DaysAward> daysAwards;
public String getSignMsg() {
return signMsg;
}
public void setSignMsg(String signMsg) {
this.signMsg = signMsg;
}
public int getMaxDayNumber() {
return maxDayNumber;
}
public void setMaxDayNumber(int maxDayNumber) {
this.maxDayNumber = maxDayNumber;
}
public int getSignDay() {
return signDay;
}
public void setSignDay(int signDay) {
this.signDay = signDay;
}
public List<DaysAward> getDaysAwards() {
return daysAwards;
}
public void setDaysAwards(List<DaysAward> daysAwards) {
this.daysAwards = daysAwards;
}
public static class DaysAward {
/**
* id : 1
* award : silver
* count : 666
* text : 666银瓜子
* day : 5
* img : {"src":"http://static.hdslb.com/live-static/live-app/dayaward/1/5_1.png?20171102172700","width":56,"height":68}
*/
@SerializedName("id")
private int id;
@SerializedName("award")
private String award;
@SerializedName("count")
private int count;
@SerializedName("text")
private String text;
@SerializedName("day")
private int day;
@SerializedName("img")
private Img img;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getAward() {
return award;
}
public void setAward(String award) {
this.award = award;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public int getDay() {
return day;
}
public void setDay(int day) {
this.day = day;
}
public Img getImg() {
return img;
}
public void setImg(Img img) {
this.img = img;
}
public static class Img {
/**
* src : http://static.hdslb.com/live-static/live-app/dayaward/1/5_1.png?20171102172700
* width : 56
* height : 68
*/
@SerializedName("src")
private String src;
@SerializedName("width")
private int width;
@SerializedName("height")
private int height;
public String getSrc() {
return src;
}
public void setSrc(String src) {
this.src = src;
}
public int getWidth() {
return width;
}
public void setWidth(int width) {
this.width = width;
}
public int getHeight() {
return height;
}
public void setHeight(int height) {
this.height = height;
}
}
}
}
}

View File

@ -1,83 +0,0 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.annotations.SerializedName;
public class Silver2CoinResponseEntity extends ResponseEntity {
/**
* code : 0
* msg : 兑换成功
* message : 兑换成功
* data : {"silver":"22494","gold":"0","tid":"e32cb3fc6bca9a7dff343469b1ff981f2123","coin":1}
*/
@SerializedName("code")
private int code;
@SerializedName("data")
private Data data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public static class Data {
/**
* silver : 22494
* gold : 0
* tid : e32cb3fc6bca9a7dff343469b1ff981f2123
* coin : 1
*/
@SerializedName("silver")
private String silver;
@SerializedName("gold")
private String gold;
@SerializedName("tid")
private String tid;
@SerializedName("coin")
private int coin;
public String getSilver() {
return silver;
}
public void setSilver(String silver) {
this.silver = silver;
}
public String getGold() {
return gold;
}
public void setGold(String gold) {
this.gold = gold;
}
public String getTid() {
return tid;
}
public void setTid(String tid) {
this.tid = tid;
}
public int getCoin() {
return coin;
}
public void setCoin(int coin) {
this.coin = coin;
}
}
}

View File

@ -1,52 +0,0 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.annotations.SerializedName;
public class SpecialGiftEntity extends ResponseEntity {
/**
* code : 0
* message : OK
* msg : OK
* data : {"gift39":null}
*/
@SerializedName("code")
private int code;
@SerializedName("data")
private Data data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public static class Data {
/**
* gift39 : null
*/
@SerializedName("gift39")
private JsonElement gift39;
public JsonElement getGift39() {
return gift39;
}
public void setGift39(JsonObject gift39) {
this.gift39 = gift39;
}
}
}

File diff suppressed because one or more lines are too long

View File

@ -1,271 +0,0 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.annotations.SerializedName;
public class UserInfoEntity extends ResponseEntity {
/**
* code : 0
* msg : OK
* message : OK
* data : {"silver":129890,"gold":16102,"medal":{"medal_name":"欧皇","level":3,"color":6406234,"medal_color":6406234},"vip":1,"svip":1,"svip_time":"2019-02-09 11:03:54","vip_time":"2019-02-09 11:03:54","wearTitle":{"title":"title-111-1","activity":"bilibili Link"},"isSign":0,"user_level":22,"user_level_color":5805790,"room_id":29434,"use_count":0,"vip_view_status":1}
*/
@SerializedName("code")
private int code;
@SerializedName("data")
private Data data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public static class Data {
/**
* silver : 129890
* gold : 16102
* medal : {"medal_name":"欧皇","level":3,"color":6406234,"medal_color":6406234}
* vip : 1
* svip : 1
* svip_time : 2019-02-09 11:03:54
* vip_time : 2019-02-09 11:03:54
* wearTitle : {"title":"title-111-1","activity":"bilibili Link"}
* isSign : 0
* user_level : 22
* user_level_color : 5805790
* room_id : 29434
* use_count : 0
* vip_view_status : 1
*/
@SerializedName("silver")
private int silver;
@SerializedName("gold")
private int gold;
@SerializedName("medal")
private Medal medal;
@SerializedName("vip")
private int vip;
@SerializedName("svip")
private int svip;
@SerializedName("svip_time")
private String svipTime;
@SerializedName("vip_time")
private String vipTime;
@SerializedName("wearTitle")
private WearTitle wearTitle;
@SerializedName("isSign")
private boolean isSign;
@SerializedName("user_level")
private int userLevel;
@SerializedName("user_level_color")
private int userLevelColor;
@SerializedName("room_id")
private int roomId;
@SerializedName("use_count")
private int useCount;
@SerializedName("vip_view_status")
private int vipViewStatus;
public int getSilver() {
return silver;
}
public void setSilver(int silver) {
this.silver = silver;
}
public int getGold() {
return gold;
}
public void setGold(int gold) {
this.gold = gold;
}
public Medal getMedal() {
return medal;
}
public void setMedal(Medal medal) {
this.medal = medal;
}
public int getVip() {
return vip;
}
public void setVip(int vip) {
this.vip = vip;
}
public int getSvip() {
return svip;
}
public void setSvip(int svip) {
this.svip = svip;
}
public String getSvipTime() {
return svipTime;
}
public void setSvipTime(String svipTime) {
this.svipTime = svipTime;
}
public String getVipTime() {
return vipTime;
}
public void setVipTime(String vipTime) {
this.vipTime = vipTime;
}
public WearTitle getWearTitle() {
return wearTitle;
}
public void setWearTitle(WearTitle wearTitle) {
this.wearTitle = wearTitle;
}
public boolean isIsSign() {
return isSign;
}
public void setIsSign(boolean isSign) {
this.isSign = isSign;
}
public int getUserLevel() {
return userLevel;
}
public void setUserLevel(int userLevel) {
this.userLevel = userLevel;
}
public int getUserLevelColor() {
return userLevelColor;
}
public void setUserLevelColor(int userLevelColor) {
this.userLevelColor = userLevelColor;
}
public int getRoomId() {
return roomId;
}
public void setRoomId(int roomId) {
this.roomId = roomId;
}
public int getUseCount() {
return useCount;
}
public void setUseCount(int useCount) {
this.useCount = useCount;
}
public int getVipViewStatus() {
return vipViewStatus;
}
public void setVipViewStatus(int vipViewStatus) {
this.vipViewStatus = vipViewStatus;
}
public static class Medal {
/**
* medal_name : 欧皇
* level : 3
* color : 6406234
* medal_color : 6406234
*/
@SerializedName("medal_name")
private String medalName;
@SerializedName("level")
private int level;
@SerializedName("color")
private int color;
@SerializedName("medal_color")
private int medalColor;
public String getMedalName() {
return medalName;
}
public void setMedalName(String medalName) {
this.medalName = medalName;
}
public int getLevel() {
return level;
}
public void setLevel(int level) {
this.level = level;
}
public int getColor() {
return color;
}
public void setColor(int color) {
this.color = color;
}
public int getMedalColor() {
return medalColor;
}
public void setMedalColor(int medalColor) {
this.medalColor = medalColor;
}
}
public static class WearTitle {
/**
* title : title-111-1
* activity : bilibili Link
*/
@SerializedName("title")
private String title;
@SerializedName("activity")
private String activity;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getActivity() {
return activity;
}
public void setActivity(String activity) {
this.activity = activity;
}
}
}
}

View File

@ -1,458 +0,0 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class UserTasksEntity extends ResponseEntity {
/**
* code : 0
* msg : success
* message : success
* data : {"share_info":{"task_id":"share_task","share_count":0,"progress":{"now":0,"max":1},"status":0,"awards":[{"name":"扭蛋币","type":"toycoin","num":5},{"name":"亲密度","type":"intimacy","num":10}]},"watch_info":{"task_id":"single_watch_task","status":0,"progress":{"now":0,"max":1},"awards":[{"name":"银瓜子","type":"silver","num":500}]},"double_watch_info":{"task_id":"double_watch_task","status":2,"web_watch":1,"mobile_watch":1,"progress":{"now":2,"max":2},"awards":[{"name":"银瓜子","type":"silver","num":700},{"name":"友爱金","type":"union_money","num":1000},{"name":"亲密度","type":"intimacy","num":20}]}}
*/
@SerializedName("code")
private int code;
@SerializedName("data")
private Data data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public static class Data {
/**
* share_info : {"task_id":"share_task","share_count":0,"progress":{"now":0,"max":1},"status":0,"awards":[{"name":"扭蛋币","type":"toycoin","num":5},{"name":"亲密度","type":"intimacy","num":10}]}
* watch_info : {"task_id":"single_watch_task","status":0,"progress":{"now":0,"max":1},"awards":[{"name":"银瓜子","type":"silver","num":500}]}
* double_watch_info : {"task_id":"double_watch_task","status":2,"web_watch":1,"mobile_watch":1,"progress":{"now":2,"max":2},"awards":[{"name":"银瓜子","type":"silver","num":700},{"name":"友爱金","type":"union_money","num":1000},{"name":"亲密度","type":"intimacy","num":20}]}
*/
@SerializedName("share_info")
private ShareInfo shareInfo;
@SerializedName("watch_info")
private WatchInfo watchInfo;
@SerializedName("double_watch_info")
private DoubleWatchInfo doubleWatchInfo;
public ShareInfo getShareInfo() {
return shareInfo;
}
public void setShareInfo(ShareInfo shareInfo) {
this.shareInfo = shareInfo;
}
public WatchInfo getWatchInfo() {
return watchInfo;
}
public void setWatchInfo(WatchInfo watchInfo) {
this.watchInfo = watchInfo;
}
public DoubleWatchInfo getDoubleWatchInfo() {
return doubleWatchInfo;
}
public void setDoubleWatchInfo(DoubleWatchInfo doubleWatchInfo) {
this.doubleWatchInfo = doubleWatchInfo;
}
public static class ShareInfo {
/**
* task_id : share_task
* share_count : 0
* progress : {"now":0,"max":1}
* status : 0
* awards : [{"name":"扭蛋币","type":"toycoin","num":5},{"name":"亲密度","type":"intimacy","num":10}]
*/
@SerializedName("task_id")
private String taskId;
@SerializedName("share_count")
private int shareCount;
@SerializedName("progress")
private Progress progress;
@SerializedName("status")
private int status;
@SerializedName("awards")
private List<Award> awards;
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public int getShareCount() {
return shareCount;
}
public void setShareCount(int shareCount) {
this.shareCount = shareCount;
}
public Progress getProgress() {
return progress;
}
public void setProgress(Progress progress) {
this.progress = progress;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public List<Award> getAwards() {
return awards;
}
public void setAwards(List<Award> awards) {
this.awards = awards;
}
public static class Progress {
/**
* now : 0
* max : 1
*/
@SerializedName("now")
private int now;
@SerializedName("max")
private int max;
public int getNow() {
return now;
}
public void setNow(int now) {
this.now = now;
}
public int getMax() {
return max;
}
public void setMax(int max) {
this.max = max;
}
}
public static class Award {
/**
* name : 扭蛋币
* type : toycoin
* num : 5
*/
@SerializedName("name")
private String name;
@SerializedName("type")
private String type;
@SerializedName("num")
private int number;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public int getNumber() {
return number;
}
public void setNumber(int number) {
this.number = number;
}
}
}
public static class WatchInfo {
/**
* task_id : single_watch_task
* status : 0
* progress : {"now":0,"max":1}
* awards : [{"name":"银瓜子","type":"silver","num":500}]
*/
@SerializedName("task_id")
private String taskId;
@SerializedName("status")
private int status;
@SerializedName("progress")
private ProgressX progress;
@SerializedName("awards")
private List<AwardX> awards;
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public ProgressX getProgress() {
return progress;
}
public void setProgress(ProgressX progress) {
this.progress = progress;
}
public List<AwardX> getAwards() {
return awards;
}
public void setAwards(List<AwardX> awards) {
this.awards = awards;
}
public static class ProgressX {
/**
* now : 0
* max : 1
*/
@SerializedName("now")
private int now;
@SerializedName("max")
private int max;
public int getNow() {
return now;
}
public void setNow(int now) {
this.now = now;
}
public int getMax() {
return max;
}
public void setMax(int max) {
this.max = max;
}
}
public static class AwardX {
/**
* name : 银瓜子
* type : silver
* num : 500
*/
@SerializedName("name")
private String name;
@SerializedName("type")
private String type;
@SerializedName("num")
private int number;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public int getNumber() {
return number;
}
public void setNumber(int number) {
this.number = number;
}
}
}
public static class DoubleWatchInfo {
/**
* task_id : double_watch_task
* status : 2
* web_watch : 1
* mobile_watch : 1
* progress : {"now":2,"max":2}
* awards : [{"name":"银瓜子","type":"silver","num":700},{"name":"友爱金","type":"union_money","num":1000},{"name":"亲密度","type":"intimacy","num":20}]
*/
@SerializedName("task_id")
private String taskId;
@SerializedName("status")
private int status;
@SerializedName("web_watch")
private int webWatch;
@SerializedName("mobile_watch")
private int mobileWatch;
@SerializedName("progress")
private ProgressXX progress;
@SerializedName("awards")
private List<AwardXX> awards;
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public int getWebWatch() {
return webWatch;
}
public void setWebWatch(int webWatch) {
this.webWatch = webWatch;
}
public int getMobileWatch() {
return mobileWatch;
}
public void setMobileWatch(int mobileWatch) {
this.mobileWatch = mobileWatch;
}
public ProgressXX getProgress() {
return progress;
}
public void setProgress(ProgressXX progress) {
this.progress = progress;
}
public List<AwardXX> getAwards() {
return awards;
}
public void setAwards(List<AwardXX> awards) {
this.awards = awards;
}
public static class ProgressXX {
/**
* now : 2
* max : 2
*/
@SerializedName("now")
private int now;
@SerializedName("max")
private int max;
public int getNow() {
return now;
}
public void setNow(int now) {
this.now = now;
}
public int getMax() {
return max;
}
public void setMax(int max) {
this.max = max;
}
}
public static class AwardXX {
/**
* name : 银瓜子
* type : silver
* num : 700
*/
@SerializedName("name")
private String name;
@SerializedName("type")
private String type;
@SerializedName("num")
private int number;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public int getNumber() {
return number;
}
public void setNumber(int number) {
this.number = number;
}
}
}
}
}

View File

@ -1,35 +0,0 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.JsonElement;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class WearMedalResponseEntity extends ResponseEntity {
/**
* code : 0
* message : OK
* data : []
*/
@SerializedName("code")
private int code;
@SerializedName("data")
private List<JsonElement> data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public List<JsonElement> getData() {
return data;
}
public void setData(List<JsonElement> data) {
this.data = data;
}
}

View File

@ -1,433 +0,0 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class WearTitleEntity extends ResponseEntity {
/**
* code : 0
* msg : success
* message : success
* data : {"id":"5940800","uid":"2866663","tid":"111","num":"1","score":"0","create_time":"2017-08-03 21:53:22","expire_time":"0000-00-00 00:00:00","status":"1","level":[0],"category":[{"name":"热门","class":"red"}],"pic":[{"id":"title-111-1","title":"2017Blink","img":"https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/titles/title/3/title-111-1.png?20180302110600","width":0,"height":0,"is_lihui":0,"lihui_img":"","lihui_width":0,"lihui_height":0}],"title_pic":{"id":"title-111-1","title":"2017Blink","img":"https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/titles/title/3/title-111-1.png?20180302110600","width":0,"height":0,"is_lihui":0,"lihui_img":"","lihui_width":0,"lihui_height":0},"name":"bilibili Link","upgrade_score":1000000}
*/
@SerializedName("code")
private int code;
@SerializedName("data")
private Data data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public static class Data {
/**
* id : 5940800
* uid : 2866663
* tid : 111
* num : 1
* score : 0
* create_time : 2017-08-03 21:53:22
* expire_time : 0000-00-00 00:00:00
* status : 1
* level : [0]
* category : [{"name":"热门","class":"red"}]
* pic : [{"id":"title-111-1","title":"2017Blink","img":"https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/titles/title/3/title-111-1.png?20180302110600","width":0,"height":0,"is_lihui":0,"lihui_img":"","lihui_width":0,"lihui_height":0}]
* title_pic : {"id":"title-111-1","title":"2017Blink","img":"https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/titles/title/3/title-111-1.png?20180302110600","width":0,"height":0,"is_lihui":0,"lihui_img":"","lihui_width":0,"lihui_height":0}
* name : bilibili Link
* upgrade_score : 1000000
*/
@SerializedName("id")
private String id;
@SerializedName("uid")
private String uid;
@SerializedName("tid")
private String tid;
@SerializedName("num")
private String number;
@SerializedName("score")
private String score;
@SerializedName("create_time")
private String createTime;
@SerializedName("expire_time")
private String expireTime;
@SerializedName("status")
private String status;
@SerializedName("title_pic")
private TitlePic titlePic;
@SerializedName("name")
private String name;
@SerializedName("upgrade_score")
private int upgradeScore;
@SerializedName("level")
private List<Integer> level;
@SerializedName("category")
private List<Category> category;
@SerializedName("pic")
private List<Pic> pic;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
public String getTid() {
return tid;
}
public void setTid(String tid) {
this.tid = tid;
}
public String getNumber() {
return number;
}
public void setNumber(String number) {
this.number = number;
}
public String getScore() {
return score;
}
public void setScore(String score) {
this.score = score;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public String getExpireTime() {
return expireTime;
}
public void setExpireTime(String expireTime) {
this.expireTime = expireTime;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public TitlePic getTitlePic() {
return titlePic;
}
public void setTitlePic(TitlePic titlePic) {
this.titlePic = titlePic;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getUpgradeScore() {
return upgradeScore;
}
public void setUpgradeScore(int upgradeScore) {
this.upgradeScore = upgradeScore;
}
public List<Integer> getLevel() {
return level;
}
public void setLevel(List<Integer> level) {
this.level = level;
}
public List<Category> getCategory() {
return category;
}
public void setCategory(List<Category> category) {
this.category = category;
}
public List<Pic> getPic() {
return pic;
}
public void setPic(List<Pic> pic) {
this.pic = pic;
}
public static class TitlePic {
/**
* id : title-111-1
* title : 2017Blink
* img : https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/titles/title/3/title-111-1.png?20180302110600
* width : 0
* height : 0
* is_lihui : 0
* lihui_img :
* lihui_width : 0
* lihui_height : 0
*/
@SerializedName("id")
private String id;
@SerializedName("title")
private String title;
@SerializedName("img")
private String img;
@SerializedName("width")
private int width;
@SerializedName("height")
private int height;
@SerializedName("is_lihui")
private int isLiHui;
@SerializedName("lihui_img")
private String liHuiImg;
@SerializedName("lihui_width")
private int liHuiWidth;
@SerializedName("lihui_height")
private int liHuiHeight;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getImg() {
return img;
}
public void setImg(String img) {
this.img = img;
}
public int getWidth() {
return width;
}
public void setWidth(int width) {
this.width = width;
}
public int getHeight() {
return height;
}
public void setHeight(int height) {
this.height = height;
}
public int getIsLiHui() {
return isLiHui;
}
public void setIsLiHui(int isLiHui) {
this.isLiHui = isLiHui;
}
public String getLiHuiImg() {
return liHuiImg;
}
public void setLiHuiImg(String liHuiImg) {
this.liHuiImg = liHuiImg;
}
public int getLiHuiWidth() {
return liHuiWidth;
}
public void setLiHuiWidth(int liHuiWidth) {
this.liHuiWidth = liHuiWidth;
}
public int getLiHuiHeight() {
return liHuiHeight;
}
public void setLiHuiHeight(int liHuiHeight) {
this.liHuiHeight = liHuiHeight;
}
}
public static class Category {
/**
* name : 热门
* class : red
*/
@SerializedName("name")
private String name;
@SerializedName("class")
private String classX;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getClassX() {
return classX;
}
public void setClassX(String classX) {
this.classX = classX;
}
}
public static class Pic {
/**
* id : title-111-1
* title : 2017Blink
* img : https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/titles/title/3/title-111-1.png?20180302110600
* width : 0
* height : 0
* is_lihui : 0
* lihui_img :
* lihui_width : 0
* lihui_height : 0
*/
@SerializedName("id")
private String id;
@SerializedName("title")
private String title;
@SerializedName("img")
private String img;
@SerializedName("width")
private int width;
@SerializedName("height")
private int height;
@SerializedName("is_lihui")
private int isLiHui;
@SerializedName("lihui_img")
private String liHuiImg;
@SerializedName("lihui_width")
private int liHuiWidth;
@SerializedName("lihui_height")
private int liHuiHeight;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getImg() {
return img;
}
public void setImg(String img) {
this.img = img;
}
public int getWidth() {
return width;
}
public void setWidth(int width) {
this.width = width;
}
public int getHeight() {
return height;
}
public void setHeight(int height) {
this.height = height;
}
public int getIsLiHui() {
return isLiHui;
}
public void setIsLiHui(int isLiHui) {
this.isLiHui = isLiHui;
}
public String getLiHuiImg() {
return liHuiImg;
}
public void setLiHuiImg(String liHuiImg) {
this.liHuiImg = liHuiImg;
}
public int getLiHuiWidth() {
return liHuiWidth;
}
public void setLiHuiWidth(int liHuiWidth) {
this.liHuiWidth = liHuiWidth;
}
public int getLiHuiHeight() {
return liHuiHeight;
}
public void setLiHuiHeight(int liHuiHeight) {
this.liHuiHeight = liHuiHeight;
}
}
}
}

View File

@ -1,36 +0,0 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.JsonElement;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class WearTitleResponseEntity extends ResponseEntity {
/**
* code : 0
* msg : success
* message : success
* data : []
*/
@SerializedName("code")
private int code;
@SerializedName("data")
private List<JsonElement> data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public List<JsonElement> getData() {
return data;
}
public void setData(List<JsonElement> data) {
this.data = data;
}
}

View File

@ -1,247 +0,0 @@
package com.hiczp.bilibili.api.live.socket;
import com.google.common.eventbus.EventBus;
import com.hiczp.bilibili.api.live.bulletScreen.BulletScreenConstDefinition;
import com.hiczp.bilibili.api.live.entity.BulletScreenEntity;
import com.hiczp.bilibili.api.live.entity.LiveRoomInfoEntity;
import com.hiczp.bilibili.api.live.entity.SendBulletScreenResponseEntity;
import com.hiczp.bilibili.api.live.socket.codec.PackageDecoder;
import com.hiczp.bilibili.api.live.socket.codec.PackageEncoder;
import com.hiczp.bilibili.api.live.socket.handler.LiveClientHandler;
import com.hiczp.bilibili.api.provider.BilibiliServiceProvider;
import io.netty.bootstrap.Bootstrap;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.handler.codec.LengthFieldBasedFrameDecoder;
import io.netty.handler.timeout.IdleStateHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import retrofit2.Call;
import javax.annotation.Nonnull;
import java.io.IOException;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
public class LiveClient {
private static final Logger LOGGER = LoggerFactory.getLogger(LiveClient.class);
private static final String DEFAULT_SERVER_ADDRESS = "livecmt-2.bilibili.com";
private static final int DEFAULT_SERVER_PORT = 2243;
private final BilibiliServiceProvider bilibiliServiceProvider;
private final EventLoopGroup eventLoopGroup;
private final long userId;
private Long showRoomId;
private Long realRoomId;
private final EventBus eventBus;
private boolean useRealRoomIdForConstructing;
private LiveRoomInfoEntity.LiveRoom liveRoom;
private Channel channel;
public LiveClient(@Nonnull BilibiliServiceProvider bilibiliServiceProvider, @Nonnull EventLoopGroup eventLoopGroup, long roomId, boolean isRealRoomId, long userId) {
this.bilibiliServiceProvider = bilibiliServiceProvider;
this.eventLoopGroup = eventLoopGroup;
this.useRealRoomIdForConstructing = isRealRoomId;
if (isRealRoomId) {
realRoomId = roomId;
} else {
showRoomId = roomId;
}
this.userId = userId;
this.eventBus = new EventBus(String.format("BilibiliLiveClientEventBus-%s", getShowRoomIdOrRoomId()));
}
public LiveClient(@Nonnull BilibiliServiceProvider bilibiliServiceProvider, @Nonnull EventLoopGroup eventLoopGroup, long showRoomId, long userId) {
this(bilibiliServiceProvider, eventLoopGroup, showRoomId, false, userId);
}
public LiveClient(@Nonnull BilibiliServiceProvider bilibiliServiceProvider, @Nonnull EventLoopGroup eventLoopGroup, long roomId, boolean isRealRoomId) {
this(bilibiliServiceProvider, eventLoopGroup, roomId, isRealRoomId, 0);
}
public LiveClient(@Nonnull BilibiliServiceProvider bilibiliServiceProvider, @Nonnull EventLoopGroup eventLoopGroup, long showRoomId) {
this(bilibiliServiceProvider, eventLoopGroup, showRoomId, false, 0);
}
public Call<LiveRoomInfoEntity> fetchRoomInfoAsync() {
return bilibiliServiceProvider.getLiveService()
.getRoomInfo(getShowRoomIdOrRoomId());
}
public LiveRoomInfoEntity.LiveRoom fetchRoomInfo() throws IOException {
LiveRoomInfoEntity.LiveRoom liveRoom =
fetchRoomInfoAsync()
.execute()
.body()
.getData();
//此时 code -404
if (liveRoom != null) {
return liveRoom;
} else {
throw new IllegalArgumentException("Target room " + getShowRoomIdOrRoomId() + " not exists");
}
}
public Callable<LiveClient> connectAsync() {
return () -> {
if (channel != null && channel.isActive()) {
LOGGER.warn("Already connected to server, connect method can not be invoked twice");
return this;
}
if (realRoomId == null) {
if (liveRoom == null) {
LOGGER.debug("Fetching info of live room {}", showRoomId);
liveRoom = fetchRoomInfo();
LOGGER.debug("Get actual room id {}", liveRoom.getRoomId());
}
realRoomId = liveRoom.getRoomId();
}
LOGGER.debug("Init SocketChannel Bootstrap");
Bootstrap bootstrap = new Bootstrap()
.group(eventLoopGroup)
.channel(NioSocketChannel.class)
.handler(new ChannelInitializer<SocketChannel>() {
@Override
protected void initChannel(SocketChannel socketChannel) throws Exception {
socketChannel.pipeline()
.addLast(new LengthFieldBasedFrameDecoder(
Integer.MAX_VALUE,
0,
Package.LENGTH_FIELD_LENGTH,
-Package.LENGTH_FIELD_LENGTH,
0
))
.addLast(new IdleStateHandler(40, 0, 0))
.addLast(new PackageEncoder())
.addLast(new PackageDecoder())
.addLast(new LiveClientHandler(self(), realRoomId, userId));
}
});
String address = liveRoom != null ? liveRoom.getCmt() : DEFAULT_SERVER_ADDRESS;
int port = liveRoom != null ? liveRoom.getCmtPortGoim() : DEFAULT_SERVER_PORT;
LOGGER.debug("Connecting to Bullet Screen server {}:{}", address, port);
try {
channel = bootstrap.connect(address, port)
.sync()
.channel();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (Exception e) { //有可能在此时出现网络错误
throw new IOException(e);
}
return this;
};
}
public LiveClient connect(ExecutorService executorService) throws InterruptedException, ExecutionException {
Future<LiveClient> future = executorService.submit(connectAsync());
return future.get();
}
public synchronized LiveClient connect() throws Exception {
return connectAsync().call();
}
public synchronized ChannelFuture closeChannelAsync() {
if (channel != null) {
LOGGER.debug("Closing connection");
ChannelFuture channelFuture = channel.close();
channel = null;
return channelFuture;
} else {
return null;
}
}
public void closeChannel() {
ChannelFuture channelFuture = closeChannelAsync();
if (channelFuture != null) {
channelFuture.awaitUninterruptibly();
}
}
public EventBus getEventBus() {
return eventBus;
}
public LiveClient registerListener(@Nonnull Object object) {
eventBus.register(object);
return this;
}
public LiveClient registerListeners(@Nonnull Iterable<Object> objects) {
objects.forEach(eventBus::register);
return this;
}
public LiveClient unregisterListener(@Nonnull Object object) {
eventBus.unregister(object);
return this;
}
public LiveClient unregisterListeners(@Nonnull Iterable<Object> objects) {
objects.forEach(eventBus::unregister);
return this;
}
//TODO 弹幕发送队列
public Call<SendBulletScreenResponseEntity> sendBulletScreenAsync(@Nonnull String message) {
return bilibiliServiceProvider.getLiveService()
.sendBulletScreen(createBulletScreenEntity(message));
}
public SendBulletScreenResponseEntity sendBulletScreen(@Nonnull String message) throws IOException {
return sendBulletScreenAsync(message)
.execute()
.body();
}
private BulletScreenEntity createBulletScreenEntity(String message) {
return new BulletScreenEntity(
getRoomIdOrShowRoomId(),
userId,
message
);
}
public long getUserId() {
return userId;
}
public long getRoomIdOrShowRoomId() {
return realRoomId != null ? realRoomId : showRoomId;
}
public long getShowRoomIdOrRoomId() {
return showRoomId != null ? showRoomId : realRoomId;
}
public int getBulletScreenLengthLimitOrDefaultLengthLimit() {
return liveRoom != null ? liveRoom.getMsgLength() : BulletScreenConstDefinition.DEFAULT_MESSAGE_LENGTH_LIMIT;
}
public Channel getChannel() {
return channel;
}
public boolean isUseRealRoomIdForConstructing() {
return useRealRoomIdForConstructing;
}
private LiveClient self() {
return this;
}
}

View File

@ -1,117 +0,0 @@
package com.hiczp.bilibili.api.live.socket;
/**
* 数据包结构说明
* 00 00 00 28/00 10/00 00 00 00 00 07/00 00 00 00
* 1-4 字节: 数据包长度
* 5-6 字节: 协议头长度, 固定值 0x10
* 7-8 字节: 设备类型, Android 固定为 0
* 9-12 字节: 数据包类型
* 13-16 字节: 设备类型, 7-8 字节
* 之后的字节为数据包正文, 大多数情况下为 JSON
*/
public class Package {
public static final short LENGTH_FIELD_LENGTH = 4;
private static final short PROTOCOL_HEAD_LENGTH = 16;
private final int packageLength;
private final short protocolHeadLength;
private final DeviceType shortDeviceType;
private final PackageType packageType;
private final DeviceType longDeviceType;
private final byte[] content;
public Package(int packageLength, short protocolHeadLength, DeviceType shortDeviceType, PackageType packageType, DeviceType longDeviceType, byte[] content) {
this.packageLength = packageLength;
this.protocolHeadLength = protocolHeadLength;
this.shortDeviceType = shortDeviceType;
this.packageType = packageType;
this.longDeviceType = longDeviceType;
this.content = content;
}
public Package(PackageType packageType, byte[] content) {
this(PROTOCOL_HEAD_LENGTH + content.length,
PROTOCOL_HEAD_LENGTH,
DeviceType.ANDROID,
packageType,
DeviceType.ANDROID,
content
);
}
public int getPackageLength() {
return packageLength;
}
public short getProtocolHeadLength() {
return protocolHeadLength;
}
public DeviceType getShortDeviceType() {
return shortDeviceType;
}
public PackageType getPackageType() {
return packageType;
}
public DeviceType getLongDeviceType() {
return longDeviceType;
}
public byte[] getContent() {
return content;
}
public enum DeviceType {
ANDROID(0x00);
private final int value;
DeviceType(int value) {
this.value = value;
}
public static DeviceType valueOf(int value) {
for (DeviceType deviceType : DeviceType.values()) {
if (deviceType.value == value) {
return deviceType;
}
}
throw new IllegalArgumentException("No matching constant for [" + value + "]");
}
public int getValue() {
return value;
}
}
public enum PackageType {
HEART_BEAT(0x02),
VIEWER_COUNT(0x03),
DATA(0x05),
ENTER_ROOM(0x07),
ENTER_ROOM_SUCCESS(0x08);
private final int value;
PackageType(int value) {
this.value = value;
}
public static PackageType valueOf(int value) {
for (PackageType packageType : PackageType.values()) {
if (packageType.value == value) {
return packageType;
}
}
throw new IllegalArgumentException("No matching constant for [" + value + "]");
}
public int getValue() {
return value;
}
}
}

View File

@ -1,33 +0,0 @@
package com.hiczp.bilibili.api.live.socket;
import com.google.gson.Gson;
import com.hiczp.bilibili.api.live.socket.entity.EnterRoomEntity;
public class PackageHelper {
private static final Gson GSON = new Gson();
/**
* 创建一个进房数据包
*
* @param roomId 房间号
* @param userId 用户号
* @return 进房数据包
*/
public static Package createEnterRoomPackage(long roomId, long userId) {
return new Package(
Package.PackageType.ENTER_ROOM,
GSON.toJson(new EnterRoomEntity(roomId, userId)).getBytes()
);
}
/**
* 创建一个心跳包
* @return 心跳包
*/
public static Package createHeartBeatPackage() {
return new Package(
Package.PackageType.HEART_BEAT,
new byte[0]
);
}
}

View File

@ -1,33 +0,0 @@
package com.hiczp.bilibili.api.live.socket.codec;
import com.hiczp.bilibili.api.live.socket.Package;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ByteToMessageDecoder;
import java.util.List;
/**
* 数据包解码器
*/
public class PackageDecoder extends ByteToMessageDecoder {
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
int packageLength = in.readInt();
short protocolHeadLength = in.readShort();
Package.DeviceType shortDeviceType = Package.DeviceType.valueOf(in.readShort());
Package.PackageType packageType = Package.PackageType.valueOf(in.readInt());
Package.DeviceType longDeviceType = Package.DeviceType.valueOf(in.readInt());
byte[] content = new byte[packageLength - protocolHeadLength];
in.readBytes(content);
out.add(new Package(
packageLength,
protocolHeadLength,
shortDeviceType,
packageType,
longDeviceType,
content
));
}
}

View File

@ -1,21 +0,0 @@
package com.hiczp.bilibili.api.live.socket.codec;
import com.hiczp.bilibili.api.live.socket.Package;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;
/**
* 数据包编码器
*/
public class PackageEncoder extends MessageToByteEncoder<Package> {
@Override
protected void encode(ChannelHandlerContext ctx, Package msg, ByteBuf out) throws Exception {
out.writeInt(msg.getPackageLength())
.writeShort(msg.getProtocolHeadLength())
.writeShort(msg.getShortDeviceType().getValue())
.writeInt(msg.getPackageType().getValue())
.writeInt(msg.getLongDeviceType().getValue())
.writeBytes(msg.getContent());
}
}

View File

@ -1,82 +0,0 @@
package com.hiczp.bilibili.api.live.socket.entity;
import com.google.gson.annotations.SerializedName;
public class ActivityEventEntity implements DataEntity {
/**
* cmd : ACTIVITY_EVENT
* data : {"keyword":"newspring_2018","type":"cracker","limit":300000,"progress":158912}
*/
@SerializedName("cmd")
private String cmd;
@SerializedName("data")
private Data data;
@Override
public String getCmd() {
return cmd;
}
public void setCmd(String cmd) {
this.cmd = cmd;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public static class Data {
/**
* keyword : newspring_2018
* type : cracker
* limit : 300000
* progress : 158912
*/
@SerializedName("keyword")
private String keyword;
@SerializedName("type")
private String type;
@SerializedName("limit")
private int limit;
@SerializedName("progress")
private int progress;
public String getKeyword() {
return keyword;
}
public void setKeyword(String keyword) {
this.keyword = keyword;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public int getLimit() {
return limit;
}
public void setLimit(int limit) {
this.limit = limit;
}
public int getProgress() {
return progress;
}
public void setProgress(int progress) {
this.progress = progress;
}
}
}

View File

@ -1,32 +0,0 @@
package com.hiczp.bilibili.api.live.socket.entity;
import com.google.gson.annotations.SerializedName;
public class ChangeRoomInfoEntity implements DataEntity {
/**
* cmd : CHANGE_ROOM_INFO
* background : http://static.hdslb.com/live-static/images/bg/4.jpg
*/
@SerializedName("cmd")
private String cmd;
@SerializedName("background")
private String background;
@Override
public String getCmd() {
return cmd;
}
public void setCmd(String cmd) {
this.cmd = cmd;
}
public String getBackground() {
return background;
}
public void setBackground(String background) {
this.background = background;
}
}

View File

@ -1,125 +0,0 @@
package com.hiczp.bilibili.api.live.socket.entity;
import com.google.gson.annotations.SerializedName;
public class ComboEndEntity implements DataEntity {
/**
* cmd : COMBO_END
* data : {"uname":"打死安迷修-雷狮","r_uname":"Jinko_神子","combo_num":1,"price":200,"gift_name":"flag","gift_id":20002,"start_time":1527929335,"end_time":1527929335}
*/
@SerializedName("cmd")
private String cmd;
@SerializedName("data")
private Data data;
public String getCmd() {
return cmd;
}
public void setCmd(String cmd) {
this.cmd = cmd;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public static class Data {
/**
* uname : 打死安迷修-雷狮
* r_uname : Jinko_神子
* combo_num : 1
* price : 200
* gift_name : flag
* gift_id : 20002
* start_time : 1527929335
* end_time : 1527929335
*/
@SerializedName("uname")
private String username;
@SerializedName("r_uname")
private String roomUsername;
@SerializedName("combo_num")
private int comboNumber;
@SerializedName("price")
private int price;
@SerializedName("gift_name")
private String giftName;
@SerializedName("gift_id")
private int giftId;
@SerializedName("start_time")
private long startTime;
@SerializedName("end_time")
private long endTime;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getRoomUsername() {
return roomUsername;
}
public void setRoomUsername(String roomUsername) {
this.roomUsername = roomUsername;
}
public int getComboNumber() {
return comboNumber;
}
public void setComboNumber(int comboNumber) {
this.comboNumber = comboNumber;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public String getGiftName() {
return giftName;
}
public void setGiftName(String giftName) {
this.giftName = giftName;
}
public int getGiftId() {
return giftId;
}
public void setGiftId(int giftId) {
this.giftId = giftId;
}
public long getStartTime() {
return startTime;
}
public void setStartTime(long startTime) {
this.startTime = startTime;
}
public long getEndTime() {
return endTime;
}
public void setEndTime(long endTime) {
this.endTime = endTime;
}
}
}

View File

@ -1,104 +0,0 @@
package com.hiczp.bilibili.api.live.socket.entity;
import com.google.gson.annotations.SerializedName;
public class ComboSendEntity implements DataEntity {
/**
* cmd : COMBO_SEND
* data : {"uid":33012231,"uname":"我就是讨厌你这样","combo_num":3,"gift_name":"凉了","gift_id":20010,"action":"赠送"}
*/
@SerializedName("cmd")
private String cmd;
@SerializedName("data")
private Data data;
@Override
public String getCmd() {
return cmd;
}
public void setCmd(String cmd) {
this.cmd = cmd;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public static class Data {
/**
* uid : 33012231
* uname : 我就是讨厌你这样
* combo_num : 3
* gift_name : 凉了
* gift_id : 20010
* action : 赠送
*/
@SerializedName("uid")
private long uid;
@SerializedName("uname")
private String userName;
@SerializedName("combo_num")
private int comboNumber;
@SerializedName("gift_name")
private String giftName;
@SerializedName("gift_id")
private int giftId;
@SerializedName("action")
private String action;
public long getUid() {
return uid;
}
public void setUid(long uid) {
this.uid = uid;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public int getComboNumber() {
return comboNumber;
}
public void setComboNumber(int comboNumber) {
this.comboNumber = comboNumber;
}
public String getGiftName() {
return giftName;
}
public void setGiftName(String giftName) {
this.giftName = giftName;
}
public int getGiftId() {
return giftId;
}
public void setGiftId(int giftId) {
this.giftId = giftId;
}
public String getAction() {
return action;
}
public void setAction(String action) {
this.action = action;
}
}
}

View File

@ -1,43 +0,0 @@
package com.hiczp.bilibili.api.live.socket.entity;
import com.google.gson.annotations.SerializedName;
public class CutOffEntity implements DataEntity {
/**
* cmd : CUT_OFF
* msg : 禁播游戏
* roomid : 8446134
*/
@SerializedName("cmd")
private String cmd;
@SerializedName("msg")
private String msg;
@SerializedName("roomid")
private long roomId;
@Override
public String getCmd() {
return cmd;
}
public void setCmd(String cmd) {
this.cmd = cmd;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public long getRoomId() {
return roomId;
}
public void setRoomId(long roomId) {
this.roomId = roomId;
}
}

View File

@ -1,200 +0,0 @@
package com.hiczp.bilibili.api.live.socket.entity;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.annotations.SerializedName;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.List;
import java.util.Optional;
public class DanMuMsgEntity implements DataEntity {
private static final Gson GSON = new Gson();
private static final Type STRING_LIST_TYPE = new TypeToken<List<String>>() {
}.getType();
/**
* 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
*/
@SerializedName("cmd")
private String cmd;
@SerializedName("info")
private JsonArray info;
@Override
public String getCmd() {
return cmd;
}
public void setCmd(String cmd) {
this.cmd = cmd;
}
public JsonArray getInfo() {
return info;
}
public void setInfo(JsonArray info) {
this.info = info;
}
/**
* 弹幕池 (0 普通 1 字幕 2 特殊)
*/
public int getPool() {
return info.get(0).getAsJsonArray().get(0).getAsInt();
}
/**
* 弹幕的模式 (1 普通 4 底端 5 顶端 6 逆向 7 特殊 9 高级)
*/
public int getMode() {
return info.get(0).getAsJsonArray().get(1).getAsInt();
}
/**
* 字体大小
*/
public int getFontSize() {
return info.get(0).getAsJsonArray().get(2).getAsInt();
}
/**
* 字体颜色
*/
public int getColor() {
return info.get(0).getAsJsonArray().get(3).getAsInt();
}
/**
* 弹幕发送时间(Unix 时间戳)(其实是服务器接收到弹幕的时间)
*/
public long getSendTime() {
return info.get(0).getAsJsonArray().get(4).getAsInt();
}
/**
* 用户进入房间的时间(Unix 时间戳)(但是 Android 发送的弹幕, 这个值会是随机数)
*/
public String getUserEnterTime() {
return info.get(0).getAsJsonArray().get(5).getAsString();
}
/**
* 弹幕内容
*/
public String getMessage() {
return info.get(1).getAsString();
}
/**
* 发送者的用户 ID
*/
public long getUserId() {
return info.get(2).getAsJsonArray().get(0).getAsLong();
}
/**
* 发送者的用户名
*/
public String getUsername() {
return info.get(2).getAsJsonArray().get(1).getAsString();
}
/**
* 发送者是否是管理员
*/
public boolean isAdmin() {
return info.get(2).getAsJsonArray().get(2).getAsBoolean();
}
/**
* 发送者是否是 VIP
*/
public boolean isVip() {
return info.get(2).getAsJsonArray().get(3).getAsBoolean();
}
/**
* 发送者是否是 SVip
*/
public boolean isSVip() {
return info.get(2).getAsJsonArray().get(4).getAsBoolean();
}
/**
* 表示粉丝勋章有关信息的 JsonArray 可能是空的
* 获取粉丝勋章等级
*/
public Optional<Integer> getFansMedalLevel() {
if (info.get(3).getAsJsonArray().size() > 0) {
return Optional.of(info.get(3).getAsJsonArray().get(0).getAsInt());
} else {
return Optional.empty();
}
}
/**
* 获取粉丝勋章名称
*/
public Optional<String> getFansMedalName() {
if (info.get(3).getAsJsonArray().size() > 0) {
return Optional.of(info.get(3).getAsJsonArray().get(1).getAsString());
} else {
return Optional.empty();
}
}
/**
* 粉丝勋章对应的主播的名字
*/
public Optional<String> getFansMedalOwnerName() {
if (info.get(3).getAsJsonArray().size() > 0) {
return Optional.of(info.get(3).getAsJsonArray().get(2).getAsString());
} else {
return Optional.empty();
}
}
/**
* 粉丝勋章对应的主播的直播间 ID
*/
public Optional<String> getFansMedalOwnerRoomId() {
if (info.get(3).getAsJsonArray().size() > 0) {
return Optional.of(info.get(3).getAsJsonArray().get(3).getAsString());
} else {
return Optional.empty();
}
}
/**
* 用户的观众等级
*/
public int getUserLevel() {
return info.get(4).getAsJsonArray().get(0).getAsInt();
}
/**
* 用户的观众等级排名
*/
public String getUserRank() {
return info.get(4).getAsJsonArray().get(3).getAsString();
}
/**
* 用户头衔
*/
public List<String> getUserTitles() {
return GSON.fromJson(info.get(5), STRING_LIST_TYPE);
}
/**
* 用户名颜色
*/
public String getUsernameColor() {
return info.get(8).getAsJsonObject().get("uname_color").getAsString();
}
}

View File

@ -1,5 +0,0 @@
package com.hiczp.bilibili.api.live.socket.entity;
public interface DataEntity {
String getCmd();
}

View File

@ -1,31 +0,0 @@
package com.hiczp.bilibili.api.live.socket.entity;
import com.google.gson.annotations.SerializedName;
public class EnterRoomEntity {
@SerializedName("roomid")
private long roomId;
@SerializedName("uid")
private long userId;
public EnterRoomEntity(long roomId, long userId) {
this.roomId = roomId;
this.userId = userId;
}
public long getRoomId() {
return roomId;
}
public void setRoomId(long roomId) {
this.roomId = roomId;
}
public long getUserId() {
return userId;
}
public void setUserId(long userId) {
this.userId = userId;
}
}

View File

@ -1,159 +0,0 @@
package com.hiczp.bilibili.api.live.socket.entity;
import com.google.gson.annotations.SerializedName;
public class EntryEffectEntity implements DataEntity {
/**
* cmd : ENTRY_EFFECT
* data : {"id":3,"uid":9359447,"target_id":275592903,"show_avatar":1,"copy_writing":"欢迎 <%藏拙当成玉%> 进入房间","highlight_color":"#FFF100","basemap_url":"http://i0.hdslb.com/bfs/live/d208b9654b93a70b4177e1aa7e2f0343f8a5ff1a.png","effective_time":1,"priority":50,"privilege_type":0,"face":"http://i1.hdslb.com/bfs/face/12cb1ea6eea79667e3fb722bbd8995bb96f4cd6f.jpg"}
*/
@SerializedName("cmd")
private String cmd;
@SerializedName("data")
private Data data;
@Override
public String getCmd() {
return cmd;
}
public void setCmd(String cmd) {
this.cmd = cmd;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public static class Data {
/**
* id : 3
* uid : 9359447
* target_id : 275592903
* show_avatar : 1
* copy_writing : 欢迎 <%藏拙当成玉%> 进入房间
* highlight_color : #FFF100
* basemap_url : http://i0.hdslb.com/bfs/live/d208b9654b93a70b4177e1aa7e2f0343f8a5ff1a.png
* effective_time : 1
* priority : 50
* privilege_type : 0
* face : http://i1.hdslb.com/bfs/face/12cb1ea6eea79667e3fb722bbd8995bb96f4cd6f.jpg
*/
@SerializedName("id")
private long id;
@SerializedName("uid")
private long uid;
@SerializedName("target_id")
private long targetId;
@SerializedName("show_avatar")
private int showAvatar;
@SerializedName("copy_writing")
private String copyWriting;
@SerializedName("highlight_color")
private String highlightColor;
@SerializedName("basemap_url")
private String baseMapUrl;
@SerializedName("effective_time")
private int effectiveTime;
@SerializedName("priority")
private int priority;
@SerializedName("privilege_type")
private int privilegeType;
@SerializedName("face")
private String face;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public long getUid() {
return uid;
}
public void setUid(long uid) {
this.uid = uid;
}
public long getTargetId() {
return targetId;
}
public void setTargetId(long targetId) {
this.targetId = targetId;
}
public int getShowAvatar() {
return showAvatar;
}
public void setShowAvatar(int showAvatar) {
this.showAvatar = showAvatar;
}
public String getCopyWriting() {
return copyWriting;
}
public void setCopyWriting(String copyWriting) {
this.copyWriting = copyWriting;
}
public String getHighlightColor() {
return highlightColor;
}
public void setHighlightColor(String highlightColor) {
this.highlightColor = highlightColor;
}
public String getBaseMapUrl() {
return baseMapUrl;
}
public void setBaseMapUrl(String baseMapUrl) {
this.baseMapUrl = baseMapUrl;
}
public int getEffectiveTime() {
return effectiveTime;
}
public void setEffectiveTime(int effectiveTime) {
this.effectiveTime = effectiveTime;
}
public int getPriority() {
return priority;
}
public void setPriority(int priority) {
this.priority = priority;
}
public int getPrivilegeType() {
return privilegeType;
}
public void setPrivilegeType(int privilegeType) {
this.privilegeType = privilegeType;
}
public String getFace() {
return face;
}
public void setFace(String face) {
this.face = face;
}
}
}

View File

@ -1,71 +0,0 @@
package com.hiczp.bilibili.api.live.socket.entity;
import com.google.gson.annotations.SerializedName;
public class EventCmdEntity implements DataEntity {
/**
* roomid : 234024
* cmd : EVENT_CMD
* data : {"event_type":"flower_rain-16915","event_img":"http://s1.hdslb.com/bfs/static/blive/live-assets/mobile/activity/lover_2018/raffle.png"}
*/
@SerializedName("roomid")
private long roomId;
@SerializedName("cmd")
private String cmd;
@SerializedName("data")
private Data data;
public long getRoomId() {
return roomId;
}
public void setRoomId(long roomId) {
this.roomId = roomId;
}
@Override
public String getCmd() {
return cmd;
}
public void setCmd(String cmd) {
this.cmd = cmd;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public static class Data {
/**
* event_type : flower_rain-16915
* event_img : http://s1.hdslb.com/bfs/static/blive/live-assets/mobile/activity/lover_2018/raffle.png
*/
@SerializedName("event_type")
private String eventType;
@SerializedName("event_img")
private String eventImg;
public String getEventType() {
return eventType;
}
public void setEventType(String eventType) {
this.eventType = eventType;
}
public String getEventImg() {
return eventImg;
}
public void setEventImg(String eventImg) {
this.eventImg = eventImg;
}
}
}

View File

@ -1,93 +0,0 @@
package com.hiczp.bilibili.api.live.socket.entity;
import com.google.gson.annotations.SerializedName;
public class GuardBuyEntity implements DataEntity {
/**
* cmd : GUARD_BUY
* data : {"uid":4561799,"username":"微笑The迪妮莎","guard_level":1,"num":1}
* roomid : 5279
*/
@SerializedName("cmd")
private String cmd;
@SerializedName("data")
private Data data;
@SerializedName("roomid")
private String roomId;
@Override
public String getCmd() {
return cmd;
}
public void setCmd(String cmd) {
this.cmd = cmd;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public String getRoomId() {
return roomId;
}
public void setRoomId(String roomId) {
this.roomId = roomId;
}
public static class Data {
/**
* uid : 4561799
* username : 微笑The迪妮莎
* guard_level : 1
* num : 1
*/
@SerializedName("uid")
private long userId;
@SerializedName("username")
private String username;
@SerializedName("guard_level")
private int guardLevel;
@SerializedName("num")
private int number;
public long getUserId() {
return userId;
}
public void setUserId(long userId) {
this.userId = userId;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public int getGuardLevel() {
return guardLevel;
}
public void setGuardLevel(int guardLevel) {
this.guardLevel = guardLevel;
}
public int getNumber() {
return number;
}
public void setNumber(int number) {
this.number = number;
}
}
}

View File

@ -1,248 +0,0 @@
package com.hiczp.bilibili.api.live.socket.entity;
import com.google.gson.annotations.SerializedName;
public class GuardLotteryStartEntity implements DataEntity {
/**
* cmd : GUARD_LOTTERY_START
* data : {"id":396410,"roomid":56998,"message":"ちゆき蝙蝠公主 在【56998】购买了舰长请前往抽奖","type":"guard","privilege_type":3,"link":"https://live.bilibili.com/56998","lottery":{"id":396410,"sender":{"uid":11206312,"uname":"ちゆき蝙蝠公主","face":"http://i0.hdslb.com/bfs/face/06d0d58131100acf13d75d3c092b1a58d41b0129.jpg"},"keyword":"guard","time":1200,"status":1,"mobile_display_mode":2,"mobile_static_asset":"","mobile_animation_asset":""}}
*/
@SerializedName("cmd")
private String cmd;
@SerializedName("data")
private Data data;
@Override
public String getCmd() {
return cmd;
}
public void setCmd(String cmd) {
this.cmd = cmd;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public static class Data {
/**
* id : 396410
* roomid : 56998
* message : ちゆき蝙蝠公主 56998购买了舰长请前往抽奖
* type : guard
* privilege_type : 3
* link : https://live.bilibili.com/56998
* lottery : {"id":396410,"sender":{"uid":11206312,"uname":"ちゆき蝙蝠公主","face":"http://i0.hdslb.com/bfs/face/06d0d58131100acf13d75d3c092b1a58d41b0129.jpg"},"keyword":"guard","time":1200,"status":1,"mobile_display_mode":2,"mobile_static_asset":"","mobile_animation_asset":""}
*/
@SerializedName("id")
private long id;
@SerializedName("roomid")
private long roomId;
@SerializedName("message")
private String message;
@SerializedName("type")
private String type;
@SerializedName("privilege_type")
private int privilegeType;
@SerializedName("link")
private String link;
@SerializedName("lottery")
private Lottery lottery;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public long getRoomId() {
return roomId;
}
public void setRoomId(long roomId) {
this.roomId = roomId;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public int getPrivilegeType() {
return privilegeType;
}
public void setPrivilegeType(int privilegeType) {
this.privilegeType = privilegeType;
}
public String getLink() {
return link;
}
public void setLink(String link) {
this.link = link;
}
public Lottery getLottery() {
return lottery;
}
public void setLottery(Lottery lottery) {
this.lottery = lottery;
}
public static class Lottery {
/**
* id : 396410
* sender : {"uid":11206312,"uname":"ちゆき蝙蝠公主","face":"http://i0.hdslb.com/bfs/face/06d0d58131100acf13d75d3c092b1a58d41b0129.jpg"}
* keyword : guard
* time : 1200
* status : 1
* mobile_display_mode : 2
* mobile_static_asset :
* mobile_animation_asset :
*/
@SerializedName("id")
private long id;
@SerializedName("sender")
private Sender sender;
@SerializedName("keyword")
private String keyword;
@SerializedName("time")
private int time;
@SerializedName("status")
private int status;
@SerializedName("mobile_display_mode")
private int mobileDisplayMode;
@SerializedName("mobile_static_asset")
private String mobileStaticAsset;
@SerializedName("mobile_animation_asset")
private String mobileAnimationAsset;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public Sender getSender() {
return sender;
}
public void setSender(Sender sender) {
this.sender = sender;
}
public String getKeyword() {
return keyword;
}
public void setKeyword(String keyword) {
this.keyword = keyword;
}
public int getTime() {
return time;
}
public void setTime(int time) {
this.time = time;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public int getMobileDisplayMode() {
return mobileDisplayMode;
}
public void setMobileDisplayMode(int mobileDisplayMode) {
this.mobileDisplayMode = mobileDisplayMode;
}
public String getMobileStaticAsset() {
return mobileStaticAsset;
}
public void setMobileStaticAsset(String mobileStaticAsset) {
this.mobileStaticAsset = mobileStaticAsset;
}
public String getMobileAnimationAsset() {
return mobileAnimationAsset;
}
public void setMobileAnimationAsset(String mobileAnimationAsset) {
this.mobileAnimationAsset = mobileAnimationAsset;
}
public static class Sender {
/**
* uid : 11206312
* uname : ちゆき蝙蝠公主
* face : http://i0.hdslb.com/bfs/face/06d0d58131100acf13d75d3c092b1a58d41b0129.jpg
*/
@SerializedName("uid")
private long userId;
@SerializedName("uname")
private String userName;
@SerializedName("face")
private String face;
public long getUserId() {
return userId;
}
public void setUserId(long userId) {
this.userId = userId;
}
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;
}
}
}
}
}

View File

@ -1,32 +0,0 @@
package com.hiczp.bilibili.api.live.socket.entity;
import com.google.gson.annotations.SerializedName;
public class GuardMsgEntity implements DataEntity {
/**
* cmd : GUARD_MSG
* msg : 乘客 :?想不想joice:? 成功购买1313366房间总督船票1张欢迎登船
*/
@SerializedName("cmd")
private String cmd;
@SerializedName("msg")
private String msg;
@Override
public String getCmd() {
return cmd;
}
public void setCmd(String cmd) {
this.cmd = cmd;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
}

View File

@ -1,33 +0,0 @@
package com.hiczp.bilibili.api.live.socket.entity;
import com.google.gson.annotations.SerializedName;
public class LiveEntity implements RoomStatusEntity {
/**
* cmd : LIVE
* roomid : 1110317
*/
@SerializedName("cmd")
private String cmd;
@SerializedName("roomid")
private String roomId;
@Override
public String getCmd() {
return cmd;
}
public void setCmd(String cmd) {
this.cmd = cmd;
}
@Override
public String getRoomId() {
return roomId;
}
public void setRoomId(String roomId) {
this.roomId = roomId;
}
}

View File

@ -1,297 +0,0 @@
package com.hiczp.bilibili.api.live.socket.entity;
import com.google.gson.annotations.SerializedName;
public class NoticeMsgEntity implements DataEntity {
/**
* cmd : NOTICE_MSG
* full : {"head_icon":"","is_anim":1,"tail_icon":"","background":"#33ffffff","color":"#33ffffff","highlight":"#33ffffff","border":"#33ffffff","time":10}
* half : {"head_icon":"","is_anim":0,"tail_icon":"","background":"#33ffffff","color":"#33ffffff","highlight":"#33ffffff","border":"#33ffffff","time":8}
* roomid : 11415406
* real_roomid : 0
* msg_common : 恭喜<%汤圆老师%>获得大奖<%23333x银瓜子%>, 感谢<%林发发爱林小兔%>的赠送
* msg_self : 恭喜<%汤圆老师%>获得大奖<%23333x银瓜子%>, 感谢<%林发发爱林小兔%>的赠送
* link_url : http://live.bilibili.com/0
* msg_type : 4
*/
@SerializedName("cmd")
private String cmd;
@SerializedName("full")
private Full full;
@SerializedName("half")
private Half half;
@SerializedName("roomid")
private String roomId;
@SerializedName("real_roomid")
private String realRoomId;
@SerializedName("msg_common")
private String messageCommon;
@SerializedName("msg_self")
private String messageSelf;
@SerializedName("link_url")
private String linkUrl;
@SerializedName("msg_type")
private int messageType;
@Override
public String getCmd() {
return cmd;
}
public void setCmd(String cmd) {
this.cmd = cmd;
}
public Full getFull() {
return full;
}
public void setFull(Full full) {
this.full = full;
}
public Half getHalf() {
return half;
}
public void setHalf(Half half) {
this.half = half;
}
public String getRoomId() {
return roomId;
}
public void setRoomId(String roomId) {
this.roomId = roomId;
}
public String getRealRoomId() {
return realRoomId;
}
public void setRealRoomId(String realRoomId) {
this.realRoomId = realRoomId;
}
public String getMessageCommon() {
return messageCommon;
}
public void setMessageCommon(String messageCommon) {
this.messageCommon = messageCommon;
}
public String getMessageSelf() {
return messageSelf;
}
public void setMessageSelf(String messageSelf) {
this.messageSelf = messageSelf;
}
public String getLinkUrl() {
return linkUrl;
}
public void setLinkUrl(String linkUrl) {
this.linkUrl = linkUrl;
}
public int getMessageType() {
return messageType;
}
public void setMessageType(int messageType) {
this.messageType = messageType;
}
public static class Full {
/**
* head_icon :
* is_anim : 1
* tail_icon :
* background : #33ffffff
* color : #33ffffff
* highlight : #33ffffff
* border : #33ffffff
* time : 10
*/
@SerializedName("head_icon")
private String headIcon;
@SerializedName("is_anim")
private int isAnimation;
@SerializedName("tail_icon")
private String tailIcon;
@SerializedName("background")
private String background;
@SerializedName("color")
private String color;
@SerializedName("highlight")
private String highlight;
@SerializedName("border")
private String border;
@SerializedName("time")
private int time;
public String getHeadIcon() {
return headIcon;
}
public void setHeadIcon(String headIcon) {
this.headIcon = headIcon;
}
public int getIsAnimation() {
return isAnimation;
}
public void setIsAnimation(int isAnimation) {
this.isAnimation = isAnimation;
}
public String getTailIcon() {
return tailIcon;
}
public void setTailIcon(String tailIcon) {
this.tailIcon = tailIcon;
}
public String getBackground() {
return background;
}
public void setBackground(String background) {
this.background = background;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public String getHighlight() {
return highlight;
}
public void setHighlight(String highlight) {
this.highlight = highlight;
}
public String getBorder() {
return border;
}
public void setBorder(String border) {
this.border = border;
}
public int getTime() {
return time;
}
public void setTime(int time) {
this.time = time;
}
}
public static class Half {
/**
* head_icon :
* is_anim : 0
* tail_icon :
* background : #33ffffff
* color : #33ffffff
* highlight : #33ffffff
* border : #33ffffff
* time : 8
*/
@SerializedName("head_icon")
private String headIcon;
@SerializedName("is_anim")
private int isAnimation;
@SerializedName("tail_icon")
private String tailIcon;
@SerializedName("background")
private String background;
@SerializedName("color")
private String color;
@SerializedName("highlight")
private String highlight;
@SerializedName("border")
private String border;
@SerializedName("time")
private int time;
public String getHeadIcon() {
return headIcon;
}
public void setHeadIcon(String headIcon) {
this.headIcon = headIcon;
}
public int getIsAnimation() {
return isAnimation;
}
public void setIsAnimation(int isAnimation) {
this.isAnimation = isAnimation;
}
public String getTailIcon() {
return tailIcon;
}
public void setTailIcon(String tailIcon) {
this.tailIcon = tailIcon;
}
public String getBackground() {
return background;
}
public void setBackground(String background) {
this.background = background;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public String getHighlight() {
return highlight;
}
public void setHighlight(String highlight) {
this.highlight = highlight;
}
public String getBorder() {
return border;
}
public void setBorder(String border) {
this.border = border;
}
public int getTime() {
return time;
}
public void setTime(int time) {
this.time = time;
}
}
}

View File

@ -1,170 +0,0 @@
package com.hiczp.bilibili.api.live.socket.entity;
import com.google.gson.annotations.SerializedName;
public class PkAgainEntity implements DataEntity {
/**
* cmd : PK_AGAIN
* pk_id : 60672
* pk_status : 400
* data : {"new_pk_id":60678,"init_id":10817769,"match_id":1489926,"escape_all_time":10,"escape_time":10,"is_portrait":false,"uname":"穆阿是给你的mua","face":"http://i0.hdslb.com/bfs/face/07fa1057b60afe74cdd477f123c6ccf460ee8f2c.jpg","uid":38105366}
* roomid : 1489926
*/
@SerializedName("cmd")
private String cmd;
@SerializedName("pk_id")
private long pkId;
@SerializedName("pk_status")
private int pkStatus;
@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 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 long getRoomId() {
return roomId;
}
public void setRoomId(long roomId) {
this.roomId = roomId;
}
public static class Data {
/**
* new_pk_id : 60678
* init_id : 10817769
* match_id : 1489926
* escape_all_time : 10
* escape_time : 10
* is_portrait : false
* uname : 穆阿是给你的mua
* face : http://i0.hdslb.com/bfs/face/07fa1057b60afe74cdd477f123c6ccf460ee8f2c.jpg
* uid : 38105366
*/
@SerializedName("new_pk_id")
private long newPkId;
@SerializedName("init_id")
private long initId;
@SerializedName("match_id")
private long matchId;
@SerializedName("escape_all_time")
private int escapeAllTime;
@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 uid;
public long getNewPkId() {
return newPkId;
}
public void setNewPkId(long newPkId) {
this.newPkId = newPkId;
}
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 getEscapeAllTime() {
return escapeAllTime;
}
public void setEscapeAllTime(int escapeAllTime) {
this.escapeAllTime = escapeAllTime;
}
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 getUid() {
return uid;
}
public void setUid(long uid) {
this.uid = uid;
}
}
}

View File

@ -1,54 +0,0 @@
package com.hiczp.bilibili.api.live.socket.entity;
import com.google.gson.annotations.SerializedName;
public class PkClickAgainEntity implements DataEntity {
/**
* pk_status : 400
* pk_id : 60672
* cmd : PK_CLICK_AGAIN
* roomid : 1489926
*/
@SerializedName("pk_status")
private int pkStatus;
@SerializedName("pk_id")
private long pkId;
@SerializedName("cmd")
private String cmd;
@SerializedName("roomid")
private long roomId;
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;
}
@Override
public String getCmd() {
return cmd;
}
public void setCmd(String cmd) {
this.cmd = cmd;
}
public long getRoomId() {
return roomId;
}
public void setRoomId(long roomId) {
this.roomId = roomId;
}
}

View File

@ -1,93 +0,0 @@
package com.hiczp.bilibili.api.live.socket.entity;
import com.google.gson.annotations.SerializedName;
public class PkEndEntity implements DataEntity {
/**
* cmd : PK_END
* pk_id : 8797
* pk_status : 400
* data : {"init_id":8049573,"match_id":1409458,"punish_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 : 8049573
* match_id : 1409458
* punish_topic : 惩罚模仿面筋哥
*/
@SerializedName("init_id")
private long initId;
@SerializedName("match_id")
private long matchId;
@SerializedName("punish_topic")
private String punishTopic;
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 getPunishTopic() {
return punishTopic;
}
public void setPunishTopic(String punishTopic) {
this.punishTopic = punishTopic;
}
}
}

Some files were not shown because too many files have changed in this diff Show More