mirror of
https://github.com/czp3009/bilibili-api.git
synced 2025-01-20 20:40:42 +08:00
初步完成 live 有关 RESTFul API
This commit is contained in:
commit
3210a50b37
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
# Created by .ignore support plugin (hsz.mobi)
|
||||
.idea
|
||||
*.iml
|
||||
target
|
||||
src/test/resources/config.json
|
155
pom.xml
Normal file
155
pom.xml
Normal file
@ -0,0 +1,155 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.hiczp</groupId>
|
||||
<artifactId>bilibili-api</artifactId>
|
||||
<name>bilibili-api</name>
|
||||
<version>1.0</version>
|
||||
<description>Bilibili API</description>
|
||||
<url>https://github.com/czp3009/bilibili-api</url>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>GNU GENERAL PUBLIC LICENSE Version 3</name>
|
||||
<url>https://www.gnu.org/licenses/gpl-3.0.txt</url>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<name>czp</name>
|
||||
<email>czp3009@gmail.com</email>
|
||||
<url>https://www.hiczp.com/</url>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<scm>
|
||||
<connection>scm:git@github.com:czp3009/bilibili-api.git</connection>
|
||||
<developerConnection>scm:git@github.com:czp3009/bilibili-api.git</developerConnection>
|
||||
<url>git@github.com:czp3009/bilibili-api.git</url>
|
||||
</scm>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>oss</id>
|
||||
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
|
||||
<dependencies>
|
||||
<!-- https://mvnrepository.com/artifact/com.squareup.retrofit2/retrofit -->
|
||||
<dependency>
|
||||
<groupId>com.squareup.retrofit2</groupId>
|
||||
<artifactId>retrofit</artifactId>
|
||||
<version>2.3.0</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/com.squareup.retrofit2/converter-gson -->
|
||||
<dependency>
|
||||
<groupId>com.squareup.retrofit2</groupId>
|
||||
<artifactId>converter-gson</artifactId>
|
||||
<version>2.3.0</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.8.2</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/logging-interceptor -->
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>logging-interceptor</artifactId>
|
||||
<version>3.9.0</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.25</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/junit/junit -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-log4j12 -->
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>1.7.25</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.6</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<encoding>UTF-8</encoding>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar-no-fork</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadoc</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<show>public</show>
|
||||
<charset>UTF-8</charset>
|
||||
<encoding>UTF-8</encoding>
|
||||
<docencoding>UTF-8</docencoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
197
src/main/java/com/hiczp/bilibili/api/BilibiliRESTAPI.java
Normal file
197
src/main/java/com/hiczp/bilibili/api/BilibiliRESTAPI.java
Normal file
@ -0,0 +1,197 @@
|
||||
package com.hiczp.bilibili.api;
|
||||
|
||||
import com.hiczp.bilibili.api.interceptor.*;
|
||||
import com.hiczp.bilibili.api.live.LiveService;
|
||||
import com.hiczp.bilibili.api.passport.PassportService;
|
||||
import com.hiczp.bilibili.api.passport.entity.*;
|
||||
import okhttp3.OkHttpClient;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import retrofit2.Retrofit;
|
||||
import retrofit2.converter.gson.GsonConverterFactory;
|
||||
import sun.security.rsa.RSAPublicKeyImpl;
|
||||
|
||||
import javax.security.auth.login.LoginException;
|
||||
import java.io.IOException;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.interfaces.RSAPublicKey;
|
||||
import java.time.Instant;
|
||||
import java.util.Base64;
|
||||
|
||||
public class BilibiliRESTAPI {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(BilibiliRESTAPI.class);
|
||||
private static String accessToken;
|
||||
private static String refreshToken;
|
||||
private static int mid;
|
||||
|
||||
private static LiveService liveService;
|
||||
private static PassportService passportService;
|
||||
|
||||
//TODO 尚未实现 未登录, 服务器繁忙 等情况下的统一错误处理拦截器
|
||||
public static LiveService getLiveService() {
|
||||
if (liveService == null) {
|
||||
OkHttpClient okHttpClient = new OkHttpClient.Builder()
|
||||
.addInterceptor(new AddFixedHeadersInterceptor(
|
||||
"Display-ID", Utils.calculateDisplayId(),
|
||||
"Buvid", Utils.getBUVID(),
|
||||
"User-Agent", "Mozilla/5.0 BiliDroid/5.15.0 (bbcallen@gmail.com)",
|
||||
"Device-ID", Utils.getHardwareId()
|
||||
)).addInterceptor(new AddFixedParamsInterceptor(
|
||||
"_device", "android",
|
||||
"_hwid", Utils.getHardwareId(),
|
||||
"build", Utils.getBUILD(),
|
||||
"mobi_app", "android",
|
||||
"platform", "android",
|
||||
"scale", Utils.getScale(),
|
||||
"src", "google",
|
||||
"trace_id", Utils.calculateTraceId(),
|
||||
"ts", Long.toString(Instant.now().getEpochSecond()),
|
||||
"version", Utils.getVERSION()
|
||||
)).addInterceptor(AddAccessKeyInterceptor.getInstance())
|
||||
.addInterceptor(AddAppKeyInterceptor.getInstance())
|
||||
.addInterceptor(SortParamsAndSignInterceptor.getInstance())
|
||||
.addInterceptor(BasicHttpLoggingInterceptor.getInstance())
|
||||
.build();
|
||||
|
||||
liveService = new Retrofit.Builder()
|
||||
.baseUrl("http://api.live.bilibili.com/")
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.client(okHttpClient)
|
||||
.build()
|
||||
.create(LiveService.class);
|
||||
}
|
||||
return liveService;
|
||||
}
|
||||
|
||||
public static PassportService getPassportService() {
|
||||
if (passportService == null) {
|
||||
OkHttpClient okHttpClient = new OkHttpClient().newBuilder()
|
||||
.addInterceptor(AddAppKeyInterceptor.getInstance())
|
||||
.addInterceptor(SortParamsAndSignInterceptor.getInstance())
|
||||
.addInterceptor(BasicHttpLoggingInterceptor.getInstance())
|
||||
.build();
|
||||
|
||||
passportService = new Retrofit.Builder()
|
||||
.baseUrl("https://passport.bilibili.com/")
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.client(okHttpClient)
|
||||
.build()
|
||||
.create(PassportService.class);
|
||||
}
|
||||
return passportService;
|
||||
}
|
||||
|
||||
public static LoginResponseEntity login(String username, String password) throws IOException, LoginException {
|
||||
LOGGER.debug("Login attempt with username '{}'", username);
|
||||
PassportService passportService = getPassportService();
|
||||
KeyEntity keyEntity = passportService.getKey().execute().body();
|
||||
if (keyEntity.getCode() != 0) {
|
||||
throw new RuntimeException(keyEntity.getMessage());
|
||||
}
|
||||
RSAPublicKey rsaPublicKey;
|
||||
try {
|
||||
rsaPublicKey = new RSAPublicKeyImpl(
|
||||
Base64.getDecoder().decode(
|
||||
keyEntity.getData().getKey()
|
||||
.replace("-----BEGIN PUBLIC KEY-----", "")
|
||||
.replace("-----END PUBLIC KEY-----", "")
|
||||
.replace("\n", "")
|
||||
.getBytes()
|
||||
)
|
||||
);
|
||||
} catch (InvalidKeyException e) {
|
||||
throw new IOException("get broken RSA public key");
|
||||
}
|
||||
String cipheredPassword;
|
||||
try {
|
||||
cipheredPassword = Utils.cipherPassword(
|
||||
password,
|
||||
keyEntity.getData().getHash(),
|
||||
rsaPublicKey
|
||||
);
|
||||
} catch (InvalidKeyException e) {
|
||||
throw new IOException("get broken RSA public key");
|
||||
}
|
||||
LoginResponseEntity loginResponseEntity = passportService.login(
|
||||
username, cipheredPassword
|
||||
).execute().body();
|
||||
//TODO 不明确用户名和密码不匹配时返回的错误码
|
||||
if (loginResponseEntity.getCode() != 0) {
|
||||
throw new LoginException("username or password invalid");
|
||||
}
|
||||
BilibiliRESTAPI.accessToken = loginResponseEntity.getData().getAccessToken();
|
||||
BilibiliRESTAPI.refreshToken = loginResponseEntity.getData().getRefreshToken();
|
||||
BilibiliRESTAPI.mid = loginResponseEntity.getData().getMid();
|
||||
LOGGER.info("Login success with username '{}'", username);
|
||||
LOGGER.debug("mid: " + BilibiliRESTAPI.mid);
|
||||
return loginResponseEntity;
|
||||
}
|
||||
|
||||
public static InfoEntity getAccountInfo() throws IOException, LoginException {
|
||||
InfoEntity infoEntity = getPassportService().getInfo(accessToken).execute().body();
|
||||
//TODO 不明确未登录时获取用户信息的错误码
|
||||
if (infoEntity.getCode() != 0) {
|
||||
throw new LoginException("please try after login");
|
||||
}
|
||||
return infoEntity;
|
||||
}
|
||||
|
||||
public static RefreshTokenResponseEntity refreshToken() throws IOException, LoginException {
|
||||
return refreshToken(accessToken, refreshToken);
|
||||
}
|
||||
|
||||
public static RefreshTokenResponseEntity refreshToken(String accessToken, String refreshToken) throws IOException, LoginException {
|
||||
RefreshTokenResponseEntity refreshTokenResponseEntity = getPassportService().refreshToken(accessToken, refreshToken).execute().body();
|
||||
//TODO 不明确 access token 和 refresh token 不匹配时的错误码
|
||||
if (refreshTokenResponseEntity.getCode() != 0) {
|
||||
throw new LoginException("access token and refresh token mismatch");
|
||||
}
|
||||
BilibiliRESTAPI.accessToken = refreshTokenResponseEntity.getData().getAccessToken();
|
||||
BilibiliRESTAPI.refreshToken = refreshTokenResponseEntity.getData().getRefreshToken();
|
||||
BilibiliRESTAPI.mid = refreshTokenResponseEntity.getData().getMid();
|
||||
LOGGER.info("Access token refreshed");
|
||||
LOGGER.debug("Expires in {} seconds later", refreshTokenResponseEntity.getData().getExpiresIn());
|
||||
return refreshTokenResponseEntity;
|
||||
}
|
||||
|
||||
public static LogoutResponseEntity logout() throws IOException, LoginException {
|
||||
return logout(accessToken);
|
||||
}
|
||||
|
||||
public static LogoutResponseEntity logout(String accessToken) throws IOException, LoginException {
|
||||
LogoutResponseEntity logoutResponseEntity = getPassportService().logout(accessToken).execute().body();
|
||||
//TODO 不明确使用无效的 access token 登出时的错误码
|
||||
if (logoutResponseEntity.getCode() != 0) {
|
||||
throw new LoginException("access token invalid");
|
||||
}
|
||||
BilibiliRESTAPI.accessToken = null;
|
||||
BilibiliRESTAPI.refreshToken = null;
|
||||
BilibiliRESTAPI.mid = 0;
|
||||
LOGGER.info("Logout success");
|
||||
return logoutResponseEntity;
|
||||
}
|
||||
|
||||
public static String getAccessToken() {
|
||||
return accessToken;
|
||||
}
|
||||
|
||||
public static void setAccessToken(String accessToken) {
|
||||
BilibiliRESTAPI.accessToken = accessToken;
|
||||
}
|
||||
|
||||
public static String getRefreshToken() {
|
||||
return refreshToken;
|
||||
}
|
||||
|
||||
public static void setRefreshToken(String refreshToken) {
|
||||
BilibiliRESTAPI.refreshToken = refreshToken;
|
||||
}
|
||||
|
||||
public static int getMid() {
|
||||
return mid;
|
||||
}
|
||||
|
||||
public static void setMid(int mid) {
|
||||
BilibiliRESTAPI.mid = mid;
|
||||
}
|
||||
}
|
107
src/main/java/com/hiczp/bilibili/api/Utils.java
Normal file
107
src/main/java/com/hiczp/bilibili/api/Utils.java
Normal file
@ -0,0 +1,107 @@
|
||||
package com.hiczp.bilibili.api;
|
||||
|
||||
import javax.crypto.BadPaddingException;
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.IllegalBlockSizeException;
|
||||
import javax.crypto.NoSuchPaddingException;
|
||||
import java.math.BigInteger;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.interfaces.RSAPublicKey;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Instant;
|
||||
import java.util.Base64;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public final class Utils {
|
||||
private static final String APP_KEY = "1d8b6e7d45233436";
|
||||
private static final String APP_SECRET = "560c52ccd288fed045859ed18bffd973";
|
||||
private static final String HARDWARE_ID = "JxdyESFAJkcjEicQbBBsCTlbal5uX2Y";
|
||||
private static final String SCALE = "xxhdpi";
|
||||
private static final String VERSION = "5.15.0.515000";
|
||||
private static final String BUILD = VERSION.substring(VERSION.lastIndexOf(".") + 1);
|
||||
private static final String BUVID = "JxdyESFAJkcjEicQbBBsCTlbal5uX2Yinfoc";
|
||||
|
||||
private static final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmm000ss");
|
||||
|
||||
//Display-ID 的值在未登录前为 Buvid-客户端启动时间, 在登录后为 mid-客户端启动时间
|
||||
public static String calculateDisplayId() {
|
||||
int mid = BilibiliRESTAPI.getMid();
|
||||
if (mid != 0) { //已登录
|
||||
return calculateDisplayId(mid);
|
||||
} else { //未登录
|
||||
return String.format("%s-%d", BUVID, Instant.now().getEpochSecond());
|
||||
}
|
||||
}
|
||||
|
||||
public static String calculateDisplayId(int mid) {
|
||||
return String.format("%d-%d", mid, Instant.now().getEpochSecond());
|
||||
}
|
||||
|
||||
public static String calculateTraceId() {
|
||||
return simpleDateFormat.format(new Date());
|
||||
}
|
||||
|
||||
//排序 params 并计算 sign
|
||||
//传入值为 name1=value1 形式
|
||||
public static String calculateSign(List<String> nameAndValues) {
|
||||
Collections.sort(nameAndValues);
|
||||
String encodedQuery = nameAndValues.stream().collect(Collectors.joining("&"));
|
||||
try {
|
||||
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
|
||||
messageDigest.update((encodedQuery + APP_SECRET).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);
|
||||
}
|
||||
}
|
||||
|
||||
//加密密码
|
||||
public static String cipherPassword(String password, String hash, RSAPublicKey rsaPublicKey) throws InvalidKeyException {
|
||||
try {
|
||||
Cipher cipher = Cipher.getInstance("RSA");
|
||||
cipher.init(Cipher.ENCRYPT_MODE, rsaPublicKey);
|
||||
return new String(
|
||||
Base64.getEncoder().encode(
|
||||
cipher.doFinal((hash + password).getBytes())
|
||||
)
|
||||
);
|
||||
} catch (NoSuchAlgorithmException | NoSuchPaddingException | IllegalBlockSizeException | BadPaddingException e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static String getAppKey() {
|
||||
return APP_KEY;
|
||||
}
|
||||
|
||||
public static String getAppSecret() {
|
||||
return APP_SECRET;
|
||||
}
|
||||
|
||||
public static String getHardwareId() {
|
||||
return HARDWARE_ID;
|
||||
}
|
||||
|
||||
public static String getScale() {
|
||||
return SCALE;
|
||||
}
|
||||
|
||||
public static String getVERSION() {
|
||||
return VERSION;
|
||||
}
|
||||
|
||||
public static String getBUILD() {
|
||||
return BUILD;
|
||||
}
|
||||
|
||||
public static String getBUVID() {
|
||||
return BUVID;
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package com.hiczp.bilibili.api.interceptor;
|
||||
|
||||
import com.hiczp.bilibili.api.BilibiliRESTAPI;
|
||||
import okhttp3.HttpUrl;
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class AddAccessKeyInterceptor implements Interceptor {
|
||||
private static AddAccessKeyInterceptor addAccessKeyInterceptor;
|
||||
|
||||
public static AddAccessKeyInterceptor getInstance() {
|
||||
if (addAccessKeyInterceptor == null) {
|
||||
addAccessKeyInterceptor = new AddAccessKeyInterceptor();
|
||||
}
|
||||
return addAccessKeyInterceptor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Response intercept(Chain chain) throws IOException {
|
||||
Request request = chain.request();
|
||||
HttpUrl.Builder httpUrlBuilder = request.url().newBuilder();
|
||||
String accessKey = BilibiliRESTAPI.getAccessToken();
|
||||
if (accessKey != null && accessKey.length() != 0) {
|
||||
httpUrlBuilder.addQueryParameter("access_key", accessKey);
|
||||
}
|
||||
return chain.proceed(request.newBuilder().url(httpUrlBuilder.build()).build());
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package com.hiczp.bilibili.api.interceptor;
|
||||
|
||||
import com.hiczp.bilibili.api.Utils;
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class AddAppKeyInterceptor implements Interceptor {
|
||||
private static AddAppKeyInterceptor addAppKeyInterceptor;
|
||||
|
||||
public static AddAppKeyInterceptor getInstance() {
|
||||
if (addAppKeyInterceptor == null) {
|
||||
addAppKeyInterceptor = new AddAppKeyInterceptor();
|
||||
}
|
||||
return addAppKeyInterceptor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Response intercept(Chain chain) throws IOException {
|
||||
Request request = chain.request();
|
||||
return chain.proceed(request.newBuilder().url(
|
||||
request.url().newBuilder()
|
||||
.addQueryParameter("appkey", Utils.getAppKey())
|
||||
.build()
|
||||
).build());
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
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());
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
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("param 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());
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.hiczp.bilibili.api.interceptor;
|
||||
|
||||
import okhttp3.logging.HttpLoggingInterceptor;
|
||||
|
||||
public class BasicHttpLoggingInterceptor {
|
||||
private static HttpLoggingInterceptor httpLoggingInterceptor;
|
||||
|
||||
public static HttpLoggingInterceptor getInstance() {
|
||||
if (httpLoggingInterceptor == null) {
|
||||
httpLoggingInterceptor = new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BASIC);
|
||||
}
|
||||
return httpLoggingInterceptor;
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package com.hiczp.bilibili.api.interceptor;
|
||||
|
||||
import com.hiczp.bilibili.api.Utils;
|
||||
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.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class SortParamsAndSignInterceptor implements Interceptor {
|
||||
private static SortParamsAndSignInterceptor sortParamsAndSignInterceptor;
|
||||
|
||||
public static SortParamsAndSignInterceptor getInstance() {
|
||||
if (sortParamsAndSignInterceptor == null) {
|
||||
sortParamsAndSignInterceptor = new SortParamsAndSignInterceptor();
|
||||
}
|
||||
return sortParamsAndSignInterceptor;
|
||||
}
|
||||
|
||||
@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().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);
|
||||
}
|
||||
}
|
||||
)
|
||||
);
|
||||
nameAndValues.add(String.format("%s=%s", "sign", Utils.calculateSign(nameAndValues)));
|
||||
return chain.proceed(
|
||||
request.newBuilder()
|
||||
.url(httpUrl.newBuilder().encodedQuery(nameAndValues.stream().collect(Collectors.joining("&"))).build())
|
||||
.build()
|
||||
);
|
||||
}
|
||||
}
|
112
src/main/java/com/hiczp/bilibili/api/live/LiveService.java
Normal file
112
src/main/java/com/hiczp/bilibili/api/live/LiveService.java
Normal file
@ -0,0 +1,112 @@
|
||||
package com.hiczp.bilibili.api.live;
|
||||
|
||||
import com.hiczp.bilibili.api.live.entity.*;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.*;
|
||||
|
||||
public interface LiveService {
|
||||
@GET("AppRoom/danmuConfig")
|
||||
Call<BulletScreenConfigEntity> getBulletScreenConfig(@Query("type") String type);
|
||||
|
||||
@GET("AppRoom/msg")
|
||||
Call<LiveHistoryBulletScreensEntity> getHistoryBulletScreens(@Query("room_id") int roomId);
|
||||
|
||||
@GET("AppRoom/index")
|
||||
Call<LiveRoomInfoEntity> getRoomInfo(@Query("room_id") int roomId);
|
||||
|
||||
@POST("feed/v1/feed/isFollowed")
|
||||
Call<IsFollowedResponseEntity> isFollowed(@Query("follow") int follow);
|
||||
|
||||
@GET("AppBag/sendDaily")
|
||||
Call<SendDailyResponseEntity> sendDaily();
|
||||
|
||||
@GET("AppIndex/getAllItem")
|
||||
Call<ItemsEntity> getAllItem();
|
||||
|
||||
@GET("AppSmallTV/index")
|
||||
Call<AppSmallTVEntity> getAppSmallTV();
|
||||
|
||||
@GET("appUser/getTitle")
|
||||
Call<TitlesEntity> getTitle();
|
||||
|
||||
@GET("SpecialGift/room/{roomId}")
|
||||
Call<SpecialGiftEntity> getSpecialGift(@Path("roomId") int roomId);
|
||||
|
||||
@GET("mobile/getUser")
|
||||
Call<UserEntity> getUserInfo();
|
||||
|
||||
@GET("api/playurl")
|
||||
Call<PlayUrlEntity> getPlayUrl(@Query("cid") int cid, @Query("otype") String outputType);
|
||||
|
||||
@POST("mobile/userOnlineHeart")
|
||||
@FormUrlEncoded
|
||||
Call<SendOnlineHeartResponseEntity> sendOnlineHeart(@Field("room_id") int roomId, @Field("scale") String scale);
|
||||
|
||||
@POST("api/sendmsg")
|
||||
@FormUrlEncoded
|
||||
Call<SendBulletScreenResponseEntity> sendBulletScreen(@Field("cid") int cid,
|
||||
@Field("mid") int mid,
|
||||
@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);
|
||||
|
||||
default Call<SendBulletScreenResponseEntity> sendBulletScreen(BulletScreenEntity bulletScreenEntity) {
|
||||
return sendBulletScreen(
|
||||
bulletScreenEntity.getCid(),
|
||||
bulletScreenEntity.getMid(),
|
||||
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();
|
||||
|
||||
@GET("AppRoom/activityGift")
|
||||
Call<ActivityGiftsEntity> getActivityGifts(@Query("room_id") int roomId);
|
||||
|
||||
@POST("AppBag/send")
|
||||
@FormUrlEncoded
|
||||
Call<SendGiftResponseEntity> sendGift(@Field("giftId") int giftId,
|
||||
@Field("num") int number,
|
||||
@Field("ruid") int roomUserId,
|
||||
@Field("roomid") int roomId,
|
||||
@Field("timestamp") long timeStamp,
|
||||
@Field("bag_id") int bagId,
|
||||
@Field("rnd") long random);
|
||||
|
||||
default Call<SendGiftResponseEntity> sendGift(GiftEntity giftEntity) {
|
||||
return sendGift(
|
||||
giftEntity.getGiftId(),
|
||||
giftEntity.getNumber(),
|
||||
giftEntity.getRoomUserId(),
|
||||
giftEntity.getRoomId(),
|
||||
giftEntity.getTimeStamp(),
|
||||
giftEntity.getBagId(),
|
||||
giftEntity.getRandom()
|
||||
);
|
||||
}
|
||||
|
||||
@GET("AppRoom/getGiftTop")
|
||||
Call<GiftTopEntity> getGiftTop(@Query("room_id") int roomId);
|
||||
|
||||
@GET("AppUser/getSignInfo")
|
||||
Call<SignInfoEntity> getSignInfo();
|
||||
}
|
@ -0,0 +1,161 @@
|
||||
package com.hiczp.bilibili.api.live.entity;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ActivityGiftsEntity {
|
||||
/**
|
||||
* 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("message")
|
||||
private String message;
|
||||
@SerializedName("data")
|
||||
private List<DataEntity> data;
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public List<DataEntity> getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(List<DataEntity> data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static class DataEntity {
|
||||
/**
|
||||
* 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 num;
|
||||
@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 getNum() {
|
||||
return num;
|
||||
}
|
||||
|
||||
public void setNum(int num) {
|
||||
this.num = num;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
package com.hiczp.bilibili.api.live.entity;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class AppSmallTVEntity {
|
||||
/**
|
||||
* code : -400
|
||||
* message : no
|
||||
* data : {"status":-1}
|
||||
*/
|
||||
|
||||
@SerializedName("code")
|
||||
private int code;
|
||||
@SerializedName("message")
|
||||
private String message;
|
||||
@SerializedName("data")
|
||||
private DataEntity data;
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public DataEntity getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(DataEntity data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static class DataEntity {
|
||||
/**
|
||||
* status : -1
|
||||
*/
|
||||
|
||||
@SerializedName("status")
|
||||
private int status;
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
package com.hiczp.bilibili.api.live.entity;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class BulletScreenConfigEntity {
|
||||
/**
|
||||
* code : 0
|
||||
* message : OK
|
||||
* data : {"refresh_row_factor":0.125,"refresh_rate":100,"max_delay":5000}
|
||||
*/
|
||||
|
||||
@SerializedName("code")
|
||||
private int code;
|
||||
@SerializedName("message")
|
||||
private String message;
|
||||
@SerializedName("data")
|
||||
private DataEntity data;
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public DataEntity getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(DataEntity data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static class DataEntity {
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,125 @@
|
||||
package com.hiczp.bilibili.api.live.entity;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.hiczp.bilibili.api.BilibiliRESTAPI;
|
||||
|
||||
public class BulletScreenEntity {
|
||||
private int cid;
|
||||
|
||||
private int mid = BilibiliRESTAPI.getMid();
|
||||
|
||||
@SerializedName("msg")
|
||||
private String message;
|
||||
|
||||
//该随机数不包括符号位有 9 位
|
||||
@SerializedName("rnd")
|
||||
private long random = (long) (Math.random() * (999999999 - (-999999999)) + (-999999999));
|
||||
|
||||
private int mode = 1;
|
||||
|
||||
private int pool = 0;
|
||||
|
||||
private String type = "json";
|
||||
|
||||
private int color = 16777215;
|
||||
|
||||
@SerializedName("fontsize")
|
||||
private int fontSize = 25;
|
||||
|
||||
private String playTime = "0.0";
|
||||
|
||||
public BulletScreenEntity(int cid, String message) {
|
||||
this.cid = cid;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public int getCid() {
|
||||
return cid;
|
||||
}
|
||||
|
||||
public BulletScreenEntity setCid(int cid) {
|
||||
this.cid = cid;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getMid() {
|
||||
return mid;
|
||||
}
|
||||
|
||||
public BulletScreenEntity setMid(int mid) {
|
||||
this.mid = mid;
|
||||
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;
|
||||
}
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
package com.hiczp.bilibili.api.live.entity;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class FreeSilverAwardEntity {
|
||||
/**
|
||||
* code : 0
|
||||
* message : ok
|
||||
* data : {"surplus":-1039.6166666667,"silver":2426,"awardSilver":30,"isEnd":0}
|
||||
*/
|
||||
|
||||
@SerializedName("code")
|
||||
private int code;
|
||||
@SerializedName("message")
|
||||
private String message;
|
||||
@SerializedName("data")
|
||||
private DataEntity data;
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public DataEntity getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(DataEntity data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static class DataEntity {
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,114 @@
|
||||
package com.hiczp.bilibili.api.live.entity;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class FreeSilverCurrentTaskEntity {
|
||||
/**
|
||||
* 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("message")
|
||||
private String message;
|
||||
@SerializedName("data")
|
||||
private DataEntity data;
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public DataEntity getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(DataEntity data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static class DataEntity {
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
}
|
112
src/main/java/com/hiczp/bilibili/api/live/entity/GiftEntity.java
Normal file
112
src/main/java/com/hiczp/bilibili/api/live/entity/GiftEntity.java
Normal file
@ -0,0 +1,112 @@
|
||||
package com.hiczp.bilibili.api.live.entity;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
public class GiftEntity {
|
||||
@SerializedName("giftId")
|
||||
private int giftId;
|
||||
|
||||
@SerializedName("bag_id")
|
||||
private int bagId;
|
||||
|
||||
@SerializedName("num")
|
||||
private int number;
|
||||
|
||||
@SerializedName("roomid")
|
||||
private int roomId;
|
||||
|
||||
@SerializedName("ruid")
|
||||
private int roomUserId;
|
||||
|
||||
@SerializedName("timestamp")
|
||||
private long timeStamp = Instant.now().getEpochSecond();
|
||||
|
||||
//该随机数有 10 位, 暂时未见到负数的情况
|
||||
@SerializedName("rnd")
|
||||
private long random = (long) (Math.random() * 9999999999L);
|
||||
|
||||
public GiftEntity(int giftId, int bagId, int number, int roomId, int roomUserId) {
|
||||
this.giftId = giftId;
|
||||
this.bagId = bagId;
|
||||
this.number = number;
|
||||
this.roomId = roomId;
|
||||
this.roomUserId = roomUserId;
|
||||
}
|
||||
|
||||
public GiftEntity(int giftId, int bagId, int number, LiveRoomInfoEntity.LiveRoomEntity liveRoomEntity) {
|
||||
this(giftId, bagId, number, liveRoomEntity.getRoomId(), liveRoomEntity.getMid());
|
||||
}
|
||||
|
||||
public GiftEntity(PlayerBagEntity.BagGiftEntity bagGiftEntity, int number, int roomId, int roomUserId) {
|
||||
this(bagGiftEntity.getGiftId(), bagGiftEntity.getId(), number, roomId, roomUserId);
|
||||
}
|
||||
|
||||
public GiftEntity(PlayerBagEntity.BagGiftEntity bagGiftEntity, int number, LiveRoomInfoEntity.LiveRoomEntity liveRoomEntity) {
|
||||
this(bagGiftEntity.getGiftId(), bagGiftEntity.getId(), number, liveRoomEntity.getRoomId(), liveRoomEntity.getMid());
|
||||
}
|
||||
|
||||
public int getGiftId() {
|
||||
return giftId;
|
||||
}
|
||||
|
||||
public GiftEntity setGiftId(int giftId) {
|
||||
this.giftId = giftId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getBagId() {
|
||||
return bagId;
|
||||
}
|
||||
|
||||
public GiftEntity setBagId(int bagId) {
|
||||
this.bagId = bagId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
public GiftEntity setNumber(int number) {
|
||||
this.number = number;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getRoomId() {
|
||||
return roomId;
|
||||
}
|
||||
|
||||
public GiftEntity setRoomId(int roomId) {
|
||||
this.roomId = roomId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getRoomUserId() {
|
||||
return roomUserId;
|
||||
}
|
||||
|
||||
public GiftEntity setRoomUserId(int 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;
|
||||
}
|
||||
}
|
@ -0,0 +1,199 @@
|
||||
package com.hiczp.bilibili.api.live.entity;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GiftTopEntity {
|
||||
/**
|
||||
* 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("message")
|
||||
private String message;
|
||||
@SerializedName("data")
|
||||
private DataEntity data;
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public DataEntity getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(DataEntity data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static class DataEntity {
|
||||
/**
|
||||
* 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 uname;
|
||||
@SerializedName("rank")
|
||||
private int rank;
|
||||
@SerializedName("coin")
|
||||
private int coin;
|
||||
@SerializedName("list")
|
||||
private List<ListEntity> list;
|
||||
|
||||
public int getUnlogin() {
|
||||
return unlogin;
|
||||
}
|
||||
|
||||
public void setUnlogin(int unlogin) {
|
||||
this.unlogin = unlogin;
|
||||
}
|
||||
|
||||
public String getUname() {
|
||||
return uname;
|
||||
}
|
||||
|
||||
public void setUname(String uname) {
|
||||
this.uname = uname;
|
||||
}
|
||||
|
||||
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<ListEntity> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public void setList(List<ListEntity> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
public static class ListEntity {
|
||||
/**
|
||||
* 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 int uid;
|
||||
@SerializedName("rank")
|
||||
private int rank;
|
||||
@SerializedName("isSelf")
|
||||
private int isSelf;
|
||||
@SerializedName("score")
|
||||
private int score;
|
||||
@SerializedName("uname")
|
||||
private String uname;
|
||||
@SerializedName("coin")
|
||||
private int coin;
|
||||
@SerializedName("face")
|
||||
private String face;
|
||||
@SerializedName("guard_level")
|
||||
private int guardLevel;
|
||||
|
||||
public int getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(int uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
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 getUname() {
|
||||
return uname;
|
||||
}
|
||||
|
||||
public void setUname(String uname) {
|
||||
this.uname = uname;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
package com.hiczp.bilibili.api.live.entity;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class IsFollowedResponseEntity {
|
||||
/**
|
||||
* code : 0
|
||||
* msg : success
|
||||
* message : success
|
||||
* data : {"follow":1}
|
||||
*/
|
||||
|
||||
@SerializedName("code")
|
||||
private int code;
|
||||
@SerializedName("msg")
|
||||
private String msg;
|
||||
@SerializedName("message")
|
||||
private String message;
|
||||
@SerializedName("data")
|
||||
private DataEntity data;
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public DataEntity getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(DataEntity data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static class DataEntity {
|
||||
/**
|
||||
* 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
@ -0,0 +1,238 @@
|
||||
package com.hiczp.bilibili.api.live.entity;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class LiveHistoryBulletScreensEntity {
|
||||
/**
|
||||
* 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("message")
|
||||
private String message;
|
||||
@SerializedName("data")
|
||||
private DataEntity data;
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public DataEntity getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(DataEntity data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static class DataEntity {
|
||||
@SerializedName("room")
|
||||
private List<LiveHistoryBulletScreenEntity> room;
|
||||
@SerializedName("admin")
|
||||
private List<?> admin;
|
||||
|
||||
public List<LiveHistoryBulletScreenEntity> getRoom() {
|
||||
return room;
|
||||
}
|
||||
|
||||
public void setRoom(List<LiveHistoryBulletScreenEntity> room) {
|
||||
this.room = room;
|
||||
}
|
||||
|
||||
public List<?> getAdmin() {
|
||||
return admin;
|
||||
}
|
||||
|
||||
public void setAdmin(List<?> admin) {
|
||||
this.admin = admin;
|
||||
}
|
||||
|
||||
public static class LiveHistoryBulletScreenEntity {
|
||||
/**
|
||||
* 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 int uid;
|
||||
@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<?> 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 int getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(int uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
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<?> getMedal() {
|
||||
return medal;
|
||||
}
|
||||
|
||||
public void setMedal(List<?> 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
@ -0,0 +1,83 @@
|
||||
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<DurlEntity> durl;
|
||||
@SerializedName("accept_quality")
|
||||
private List<Integer> acceptQuality;
|
||||
|
||||
public int getCurrentQuality() {
|
||||
return currentQuality;
|
||||
}
|
||||
|
||||
public void setCurrentQuality(int currentQuality) {
|
||||
this.currentQuality = currentQuality;
|
||||
}
|
||||
|
||||
public List<DurlEntity> getDurl() {
|
||||
return durl;
|
||||
}
|
||||
|
||||
public void setDurl(List<DurlEntity> durl) {
|
||||
this.durl = durl;
|
||||
}
|
||||
|
||||
public List<Integer> getAcceptQuality() {
|
||||
return acceptQuality;
|
||||
}
|
||||
|
||||
public void setAcceptQuality(List<Integer> acceptQuality) {
|
||||
this.acceptQuality = acceptQuality;
|
||||
}
|
||||
|
||||
public static class DurlEntity {
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,194 @@
|
||||
package com.hiczp.bilibili.api.live.entity;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class PlayerBagEntity {
|
||||
/**
|
||||
* 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("message")
|
||||
private String message;
|
||||
@SerializedName("data")
|
||||
private List<BagGiftEntity> data;
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public List<BagGiftEntity> getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(List<BagGiftEntity> data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static class BagGiftEntity {
|
||||
/**
|
||||
* 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 int id;
|
||||
@SerializedName("uid")
|
||||
private int uid;
|
||||
@SerializedName("gift_id")
|
||||
private int giftId;
|
||||
@SerializedName("gift_num")
|
||||
private int giftNum;
|
||||
@SerializedName("expireat")
|
||||
private int expireat;
|
||||
@SerializedName("gift_type")
|
||||
private int 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 int comboNum;
|
||||
@SerializedName("super_num")
|
||||
private int superNum;
|
||||
@SerializedName("count_map")
|
||||
private Map<String, String> countMap;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(int uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public int getGiftId() {
|
||||
return giftId;
|
||||
}
|
||||
|
||||
public void setGiftId(int giftId) {
|
||||
this.giftId = giftId;
|
||||
}
|
||||
|
||||
public int getGiftNum() {
|
||||
return giftNum;
|
||||
}
|
||||
|
||||
public void setGiftNum(int giftNum) {
|
||||
this.giftNum = giftNum;
|
||||
}
|
||||
|
||||
public int getExpireat() {
|
||||
return expireat;
|
||||
}
|
||||
|
||||
public void setExpireat(int expireat) {
|
||||
this.expireat = expireat;
|
||||
}
|
||||
|
||||
public int getGiftType() {
|
||||
return giftType;
|
||||
}
|
||||
|
||||
public void setGiftType(int 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 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 Map<String, String> getCountMap() {
|
||||
return countMap;
|
||||
}
|
||||
|
||||
public void setCountMap(Map<String, String> countMap) {
|
||||
this.countMap = countMap;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package com.hiczp.bilibili.api.live.entity;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SendBulletScreenResponseEntity {
|
||||
/**
|
||||
* code : 0
|
||||
* msg :
|
||||
* data : []
|
||||
*/
|
||||
|
||||
@SerializedName("code")
|
||||
private int code;
|
||||
@SerializedName("msg")
|
||||
private String msg;
|
||||
@SerializedName("data")
|
||||
private List<?> data;
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public List<?> getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(List<?> data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
package com.hiczp.bilibili.api.live.entity;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class SendDailyResponseEntity {
|
||||
/**
|
||||
* code : 0
|
||||
* message : ok
|
||||
* data : {"result":2}
|
||||
*/
|
||||
|
||||
@SerializedName("code")
|
||||
private int code;
|
||||
@SerializedName("message")
|
||||
private String message;
|
||||
@SerializedName("data")
|
||||
private DataEntity data;
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public DataEntity getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(DataEntity data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static class DataEntity {
|
||||
/**
|
||||
* result : 2
|
||||
*/
|
||||
|
||||
@SerializedName("result")
|
||||
private int result;
|
||||
|
||||
public int getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(int result) {
|
||||
this.result = result;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,675 @@
|
||||
package com.hiczp.bilibili.api.live.entity;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SendGiftResponseEntity {
|
||||
/**
|
||||
* code : 0
|
||||
* message : ok
|
||||
* 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("message")
|
||||
private String message;
|
||||
@SerializedName("data")
|
||||
private DataEntityX data;
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public DataEntityX getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(DataEntityX data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static class DataEntityX {
|
||||
/**
|
||||
* 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 DataEntity data;
|
||||
@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 DataEntity getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(DataEntity data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public int getRemain() {
|
||||
return remain;
|
||||
}
|
||||
|
||||
public void setRemain(int remain) {
|
||||
this.remain = remain;
|
||||
}
|
||||
|
||||
public static class DataEntity {
|
||||
/**
|
||||
* 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 uname;
|
||||
@SerializedName("rcost")
|
||||
private int rcost;
|
||||
@SerializedName("uid")
|
||||
private int uid;
|
||||
@SerializedName("timestamp")
|
||||
private int 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 Object specialGift;
|
||||
@SerializedName("capsule")
|
||||
private CapsuleEntity capsule;
|
||||
@SerializedName("addFollow")
|
||||
private int addFollow;
|
||||
@SerializedName("top_list")
|
||||
private List<TopListEntity> topList;
|
||||
@SerializedName("medal")
|
||||
private List<?> medal;
|
||||
@SerializedName("smalltv_msg")
|
||||
private List<?> smalltvMsg;
|
||||
@SerializedName("notice_msg")
|
||||
private List<?> 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 getUname() {
|
||||
return uname;
|
||||
}
|
||||
|
||||
public void setUname(String uname) {
|
||||
this.uname = uname;
|
||||
}
|
||||
|
||||
public int getRcost() {
|
||||
return rcost;
|
||||
}
|
||||
|
||||
public void setRcost(int rcost) {
|
||||
this.rcost = rcost;
|
||||
}
|
||||
|
||||
public int getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(int uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public int getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
public void setTimestamp(int 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 Object getSpecialGift() {
|
||||
return specialGift;
|
||||
}
|
||||
|
||||
public void setSpecialGift(Object specialGift) {
|
||||
this.specialGift = specialGift;
|
||||
}
|
||||
|
||||
public CapsuleEntity getCapsule() {
|
||||
return capsule;
|
||||
}
|
||||
|
||||
public void setCapsule(CapsuleEntity capsule) {
|
||||
this.capsule = capsule;
|
||||
}
|
||||
|
||||
public int getAddFollow() {
|
||||
return addFollow;
|
||||
}
|
||||
|
||||
public void setAddFollow(int addFollow) {
|
||||
this.addFollow = addFollow;
|
||||
}
|
||||
|
||||
public List<TopListEntity> getTopList() {
|
||||
return topList;
|
||||
}
|
||||
|
||||
public void setTopList(List<TopListEntity> topList) {
|
||||
this.topList = topList;
|
||||
}
|
||||
|
||||
public List<?> getMedal() {
|
||||
return medal;
|
||||
}
|
||||
|
||||
public void setMedal(List<?> medal) {
|
||||
this.medal = medal;
|
||||
}
|
||||
|
||||
public List<?> getSmalltvMsg() {
|
||||
return smalltvMsg;
|
||||
}
|
||||
|
||||
public void setSmalltvMsg(List<?> smalltvMsg) {
|
||||
this.smalltvMsg = smalltvMsg;
|
||||
}
|
||||
|
||||
public List<?> getNoticeMsg() {
|
||||
return noticeMsg;
|
||||
}
|
||||
|
||||
public void setNoticeMsg(List<?> noticeMsg) {
|
||||
this.noticeMsg = noticeMsg;
|
||||
}
|
||||
|
||||
public static class CapsuleEntity {
|
||||
/**
|
||||
* normal : {"coin":10,"change":0,"progress":{"now":2900,"max":10000}}
|
||||
* colorful : {"coin":0,"change":0,"progress":{"now":0,"max":5000}}
|
||||
*/
|
||||
|
||||
@SerializedName("normal")
|
||||
private NormalEntity normal;
|
||||
@SerializedName("colorful")
|
||||
private ColorfulEntity colorful;
|
||||
|
||||
public NormalEntity getNormal() {
|
||||
return normal;
|
||||
}
|
||||
|
||||
public void setNormal(NormalEntity normal) {
|
||||
this.normal = normal;
|
||||
}
|
||||
|
||||
public ColorfulEntity getColorful() {
|
||||
return colorful;
|
||||
}
|
||||
|
||||
public void setColorful(ColorfulEntity colorful) {
|
||||
this.colorful = colorful;
|
||||
}
|
||||
|
||||
public static class NormalEntity {
|
||||
/**
|
||||
* 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 ColorfulEntity {
|
||||
/**
|
||||
* coin : 0
|
||||
* change : 0
|
||||
* progress : {"now":0,"max":5000}
|
||||
*/
|
||||
|
||||
@SerializedName("coin")
|
||||
private int coin;
|
||||
@SerializedName("change")
|
||||
private int change;
|
||||
@SerializedName("progress")
|
||||
private ProgressEntityX 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 ProgressEntityX getProgress() {
|
||||
return progress;
|
||||
}
|
||||
|
||||
public void setProgress(ProgressEntityX progress) {
|
||||
this.progress = progress;
|
||||
}
|
||||
|
||||
public static class ProgressEntityX {
|
||||
/**
|
||||
* 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 TopListEntity {
|
||||
/**
|
||||
* 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 uname;
|
||||
@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 getUname() {
|
||||
return uname;
|
||||
}
|
||||
|
||||
public void setUname(String uname) {
|
||||
this.uname = uname;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package com.hiczp.bilibili.api.live.entity;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SendOnlineHeartResponseEntity {
|
||||
/**
|
||||
* code : 0
|
||||
* message : ok
|
||||
* data : {"giftlist":[]}
|
||||
*/
|
||||
|
||||
@SerializedName("code")
|
||||
private int code;
|
||||
@SerializedName("message")
|
||||
private String message;
|
||||
@SerializedName("data")
|
||||
private DataEntity data;
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public DataEntity getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(DataEntity data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static class DataEntity {
|
||||
@SerializedName("giftlist")
|
||||
private List<?> giftlist;
|
||||
|
||||
public List<?> getGiftlist() {
|
||||
return giftlist;
|
||||
}
|
||||
|
||||
public void setGiftlist(List<?> giftlist) {
|
||||
this.giftlist = giftlist;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,205 @@
|
||||
package com.hiczp.bilibili.api.live.entity;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SignInfoEntity {
|
||||
/**
|
||||
* code : 0
|
||||
* message : OK
|
||||
* data : {"sign_msg":"今天签到已获得<br /> 辣条<font color='#fea024'>2个<\/font> 经验<font color='#fea024'>3000<\/font> ","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("message")
|
||||
private String message;
|
||||
@SerializedName("data")
|
||||
private DataEntity data;
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public DataEntity getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(DataEntity data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static class DataEntity {
|
||||
/**
|
||||
* sign_msg : 今天签到已获得<br /> 辣条<font color='#fea024'>2个</font> 经验<font color='#fea024'>3000</font>
|
||||
* 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 maxdayNum;
|
||||
@SerializedName("sign_day")
|
||||
private int signDay;
|
||||
@SerializedName("days_award")
|
||||
private List<DaysAwardEntity> daysAward;
|
||||
|
||||
public String getSignMsg() {
|
||||
return signMsg;
|
||||
}
|
||||
|
||||
public void setSignMsg(String signMsg) {
|
||||
this.signMsg = signMsg;
|
||||
}
|
||||
|
||||
public int getMaxdayNum() {
|
||||
return maxdayNum;
|
||||
}
|
||||
|
||||
public void setMaxdayNum(int maxdayNum) {
|
||||
this.maxdayNum = maxdayNum;
|
||||
}
|
||||
|
||||
public int getSignDay() {
|
||||
return signDay;
|
||||
}
|
||||
|
||||
public void setSignDay(int signDay) {
|
||||
this.signDay = signDay;
|
||||
}
|
||||
|
||||
public List<DaysAwardEntity> getDaysAward() {
|
||||
return daysAward;
|
||||
}
|
||||
|
||||
public void setDaysAward(List<DaysAwardEntity> daysAward) {
|
||||
this.daysAward = daysAward;
|
||||
}
|
||||
|
||||
public static class DaysAwardEntity {
|
||||
/**
|
||||
* 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 ImgEntity 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 ImgEntity getImg() {
|
||||
return img;
|
||||
}
|
||||
|
||||
public void setImg(ImgEntity img) {
|
||||
this.img = img;
|
||||
}
|
||||
|
||||
public static class ImgEntity {
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
package com.hiczp.bilibili.api.live.entity;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class SpecialGiftEntity {
|
||||
/**
|
||||
* code : 0
|
||||
* message : OK
|
||||
* msg : OK
|
||||
* data : {"gift39":null}
|
||||
*/
|
||||
|
||||
@SerializedName("code")
|
||||
private int code;
|
||||
@SerializedName("message")
|
||||
private String message;
|
||||
@SerializedName("msg")
|
||||
private String msg;
|
||||
@SerializedName("data")
|
||||
private DataEntity data;
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public DataEntity getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(DataEntity data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static class DataEntity {
|
||||
/**
|
||||
* gift39 : null
|
||||
*/
|
||||
|
||||
@SerializedName("gift39")
|
||||
private Object gift39;
|
||||
|
||||
public Object getGift39() {
|
||||
return gift39;
|
||||
}
|
||||
|
||||
public void setGift39(Object gift39) {
|
||||
this.gift39 = gift39;
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
219
src/main/java/com/hiczp/bilibili/api/live/entity/UserEntity.java
Normal file
219
src/main/java/com/hiczp/bilibili/api/live/entity/UserEntity.java
Normal file
@ -0,0 +1,219 @@
|
||||
package com.hiczp.bilibili.api.live.entity;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class UserEntity {
|
||||
/**
|
||||
* code : 0
|
||||
* message : ok
|
||||
* data : {"silver":1896,"gold":0,"vip":0,"svip":0,"svip_time":"0000-00-00 00:00:00","vip_time":"0000-00-00 00:00:00","room_id":1110317,"user_level":20,"user_level_color":6406234,"vip_view_status":1,"isSign":1,"use_count":0,"wearTitle":{"title":"0","activity":"0"}}
|
||||
*/
|
||||
|
||||
@SerializedName("code")
|
||||
private int code;
|
||||
@SerializedName("message")
|
||||
private String message;
|
||||
@SerializedName("data")
|
||||
private DataEntity data;
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public DataEntity getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(DataEntity data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static class DataEntity {
|
||||
/**
|
||||
* silver : 1896
|
||||
* gold : 0
|
||||
* vip : 0
|
||||
* svip : 0
|
||||
* svip_time : 0000-00-00 00:00:00
|
||||
* vip_time : 0000-00-00 00:00:00
|
||||
* room_id : 1110317
|
||||
* user_level : 20
|
||||
* user_level_color : 6406234
|
||||
* vip_view_status : 1
|
||||
* isSign : 1
|
||||
* use_count : 0
|
||||
* wearTitle : {"title":"0","activity":"0"}
|
||||
*/
|
||||
|
||||
@SerializedName("silver")
|
||||
private int silver;
|
||||
@SerializedName("gold")
|
||||
private int gold;
|
||||
@SerializedName("vip")
|
||||
private int vip;
|
||||
@SerializedName("svip")
|
||||
private int svip;
|
||||
@SerializedName("svip_time")
|
||||
private String svipTime;
|
||||
@SerializedName("vip_time")
|
||||
private String vipTime;
|
||||
@SerializedName("room_id")
|
||||
private int roomId;
|
||||
@SerializedName("user_level")
|
||||
private int userLevel;
|
||||
@SerializedName("user_level_color")
|
||||
private int userLevelColor;
|
||||
@SerializedName("vip_view_status")
|
||||
private int vipViewStatus;
|
||||
@SerializedName("isSign")
|
||||
private int isSign;
|
||||
@SerializedName("use_count")
|
||||
private int useCount;
|
||||
@SerializedName("wearTitle")
|
||||
private WearTitleEntity wearTitle;
|
||||
|
||||
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 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 int getRoomId() {
|
||||
return roomId;
|
||||
}
|
||||
|
||||
public void setRoomId(int roomId) {
|
||||
this.roomId = roomId;
|
||||
}
|
||||
|
||||
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 getVipViewStatus() {
|
||||
return vipViewStatus;
|
||||
}
|
||||
|
||||
public void setVipViewStatus(int vipViewStatus) {
|
||||
this.vipViewStatus = vipViewStatus;
|
||||
}
|
||||
|
||||
public int getIsSign() {
|
||||
return isSign;
|
||||
}
|
||||
|
||||
public void setIsSign(int isSign) {
|
||||
this.isSign = isSign;
|
||||
}
|
||||
|
||||
public int getUseCount() {
|
||||
return useCount;
|
||||
}
|
||||
|
||||
public void setUseCount(int useCount) {
|
||||
this.useCount = useCount;
|
||||
}
|
||||
|
||||
public WearTitleEntity getWearTitle() {
|
||||
return wearTitle;
|
||||
}
|
||||
|
||||
public void setWearTitle(WearTitleEntity wearTitle) {
|
||||
this.wearTitle = wearTitle;
|
||||
}
|
||||
|
||||
public static class WearTitleEntity {
|
||||
/**
|
||||
* title : 0
|
||||
* activity : 0
|
||||
*/
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.hiczp.bilibili.api.passport;
|
||||
|
||||
import com.hiczp.bilibili.api.passport.entity.*;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface PassportService {
|
||||
@POST("api/oauth2/getKey")
|
||||
Call<KeyEntity> getKey();
|
||||
|
||||
@POST("api/oauth2/login")
|
||||
Call<LoginResponseEntity> login(@Query("username") String username, @Query("password") String password);
|
||||
|
||||
@GET("api/oauth2/info")
|
||||
Call<InfoEntity> getInfo(@Query("access_token") String accessToken);
|
||||
|
||||
@POST("api/oauth2/refreshToken")
|
||||
Call<RefreshTokenResponseEntity> refreshToken(@Query("access_token") String accessToken, @Query("refresh_token") String refreshToken);
|
||||
|
||||
@POST("api/oauth2/revoke")
|
||||
Call<LogoutResponseEntity> logout(@Query("access_token") String accessToken);
|
||||
}
|
@ -0,0 +1,124 @@
|
||||
package com.hiczp.bilibili.api.passport.entity;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class InfoEntity {
|
||||
/**
|
||||
* ts : 1509555703
|
||||
* code : 0
|
||||
* data : {"mid":20293030,"appid":878,"access_token":"ef3981aefcf27013dce6d0571eca79d9","expires_in":1465966,"userid":"bili_1178318619","uname":"czp3009"}
|
||||
*/
|
||||
|
||||
@SerializedName("ts")
|
||||
private int ts;
|
||||
@SerializedName("code")
|
||||
private int code;
|
||||
@SerializedName("message")
|
||||
private String message;
|
||||
@SerializedName("data")
|
||||
private DataEntity data;
|
||||
|
||||
public int getTs() {
|
||||
return ts;
|
||||
}
|
||||
|
||||
public void setTs(int ts) {
|
||||
this.ts = ts;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public DataEntity getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(DataEntity data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static class DataEntity {
|
||||
/**
|
||||
* mid : 20293030
|
||||
* appid : 878
|
||||
* access_token : ef3981aefcf27013dce6d0571eca79d9
|
||||
* expires_in : 1465966
|
||||
* userid : bili_1178318619
|
||||
* uname : czp3009
|
||||
*/
|
||||
|
||||
@SerializedName("mid")
|
||||
private int mid;
|
||||
@SerializedName("appid")
|
||||
private int appid;
|
||||
@SerializedName("access_token")
|
||||
private String accessToken;
|
||||
@SerializedName("expires_in")
|
||||
private int expiresIn;
|
||||
@SerializedName("userid")
|
||||
private String userid;
|
||||
@SerializedName("uname")
|
||||
private String uname;
|
||||
|
||||
public int getMid() {
|
||||
return mid;
|
||||
}
|
||||
|
||||
public void setMid(int mid) {
|
||||
this.mid = mid;
|
||||
}
|
||||
|
||||
public int getAppid() {
|
||||
return appid;
|
||||
}
|
||||
|
||||
public void setAppid(int appid) {
|
||||
this.appid = appid;
|
||||
}
|
||||
|
||||
public String getAccessToken() {
|
||||
return accessToken;
|
||||
}
|
||||
|
||||
public void setAccessToken(String accessToken) {
|
||||
this.accessToken = accessToken;
|
||||
}
|
||||
|
||||
public int getExpiresIn() {
|
||||
return expiresIn;
|
||||
}
|
||||
|
||||
public void setExpiresIn(int expiresIn) {
|
||||
this.expiresIn = expiresIn;
|
||||
}
|
||||
|
||||
public String getUserid() {
|
||||
return userid;
|
||||
}
|
||||
|
||||
public void setUserid(String userid) {
|
||||
this.userid = userid;
|
||||
}
|
||||
|
||||
public String getUname() {
|
||||
return uname;
|
||||
}
|
||||
|
||||
public void setUname(String uname) {
|
||||
this.uname = uname;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
package com.hiczp.bilibili.api.passport.entity;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class KeyEntity {
|
||||
/**
|
||||
* ts : 1509555699
|
||||
* code : 0
|
||||
* data : {"hash":"8b9030ef5ff6d9f6","key":"-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCdScM09sZJqFPX7bvmB2y6i08J\nbHsa0v4THafPbJN9NoaZ9Djz1LmeLkVlmWx1DwgHVW+K7LVWT5FV3johacVRuV98\n37+RNntEK6SE82MPcl7fA++dmW2cLlAjsIIkrX+aIvvSGCuUfcWpWFy3YVDqhuHr\nNDjdNcaefJIQHMW+sQIDAQAB\n-----END PUBLIC KEY-----\n"}
|
||||
*/
|
||||
|
||||
@SerializedName("ts")
|
||||
private int ts;
|
||||
@SerializedName("code")
|
||||
private int code;
|
||||
@SerializedName("message")
|
||||
private String message;
|
||||
@SerializedName("data")
|
||||
private DataEntity data;
|
||||
|
||||
public int getTs() {
|
||||
return ts;
|
||||
}
|
||||
|
||||
public void setTs(int ts) {
|
||||
this.ts = ts;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public DataEntity getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(DataEntity data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static class DataEntity {
|
||||
/**
|
||||
* hash : 8b9030ef5ff6d9f6
|
||||
* key : -----BEGIN PUBLIC KEY-----
|
||||
* MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCdScM09sZJqFPX7bvmB2y6i08J
|
||||
* bHsa0v4THafPbJN9NoaZ9Djz1LmeLkVlmWx1DwgHVW+K7LVWT5FV3johacVRuV98
|
||||
* 37+RNntEK6SE82MPcl7fA++dmW2cLlAjsIIkrX+aIvvSGCuUfcWpWFy3YVDqhuHr
|
||||
* NDjdNcaefJIQHMW+sQIDAQAB
|
||||
* -----END PUBLIC KEY-----
|
||||
*/
|
||||
|
||||
@SerializedName("hash")
|
||||
private String hash;
|
||||
@SerializedName("key")
|
||||
private String key;
|
||||
|
||||
public String getHash() {
|
||||
return hash;
|
||||
}
|
||||
|
||||
public void setHash(String hash) {
|
||||
this.hash = hash;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,102 @@
|
||||
package com.hiczp.bilibili.api.passport.entity;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class LoginResponseEntity {
|
||||
/**
|
||||
* code : 0
|
||||
* data : {"access_token":"8501735069b043dd62c3bb88810444fd","refresh_token":"d41affc888082ffa11d7d2c37ad0cf2c","mid":20293030,"expires_in":2592000}
|
||||
* ts : 1509734025
|
||||
*/
|
||||
|
||||
@SerializedName("code")
|
||||
private int code;
|
||||
@SerializedName("message")
|
||||
private String message;
|
||||
@SerializedName("data")
|
||||
private DataEntity data;
|
||||
@SerializedName("ts")
|
||||
private int ts;
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public DataEntity getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(DataEntity data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public int getTs() {
|
||||
return ts;
|
||||
}
|
||||
|
||||
public void setTs(int ts) {
|
||||
this.ts = ts;
|
||||
}
|
||||
|
||||
public static class DataEntity {
|
||||
/**
|
||||
* access_token : 8501735069b043dd62c3bb88810444fd
|
||||
* refresh_token : d41affc888082ffa11d7d2c37ad0cf2c
|
||||
* mid : 20293030
|
||||
* expires_in : 2592000
|
||||
*/
|
||||
|
||||
@SerializedName("access_token")
|
||||
private String accessToken;
|
||||
@SerializedName("refresh_token")
|
||||
private String refreshToken;
|
||||
@SerializedName("mid")
|
||||
private int mid;
|
||||
@SerializedName("expires_in")
|
||||
private int expiresIn;
|
||||
|
||||
public String getAccessToken() {
|
||||
return accessToken;
|
||||
}
|
||||
|
||||
public void setAccessToken(String accessToken) {
|
||||
this.accessToken = accessToken;
|
||||
}
|
||||
|
||||
public String getRefreshToken() {
|
||||
return refreshToken;
|
||||
}
|
||||
|
||||
public void setRefreshToken(String refreshToken) {
|
||||
this.refreshToken = refreshToken;
|
||||
}
|
||||
|
||||
public int getMid() {
|
||||
return mid;
|
||||
}
|
||||
|
||||
public void setMid(int mid) {
|
||||
this.mid = mid;
|
||||
}
|
||||
|
||||
public int getExpiresIn() {
|
||||
return expiresIn;
|
||||
}
|
||||
|
||||
public void setExpiresIn(int expiresIn) {
|
||||
this.expiresIn = expiresIn;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package com.hiczp.bilibili.api.passport.entity;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class LogoutResponseEntity {
|
||||
/**
|
||||
* message : access_key not found.
|
||||
* ts : 1509555707
|
||||
* code : -901
|
||||
*/
|
||||
|
||||
@SerializedName("message")
|
||||
private String message;
|
||||
@SerializedName("ts")
|
||||
private int ts;
|
||||
@SerializedName("code")
|
||||
private int code;
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public int getTs() {
|
||||
return ts;
|
||||
}
|
||||
|
||||
public void setTs(int ts) {
|
||||
this.ts = ts;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
}
|
@ -0,0 +1,102 @@
|
||||
package com.hiczp.bilibili.api.passport.entity;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class RefreshTokenResponseEntity {
|
||||
/**
|
||||
* ts : 1509734125
|
||||
* code : 0
|
||||
* data : {"mid":20293030,"refresh_token":"19d64022154e033574df4c753fc7926d","access_token":"f64530df1fb491ae090b67e191d86f58","expires_in":2592000}
|
||||
*/
|
||||
|
||||
@SerializedName("ts")
|
||||
private int ts;
|
||||
@SerializedName("code")
|
||||
private int code;
|
||||
@SerializedName("message")
|
||||
private String message;
|
||||
@SerializedName("data")
|
||||
private DataEntity data;
|
||||
|
||||
public int getTs() {
|
||||
return ts;
|
||||
}
|
||||
|
||||
public void setTs(int ts) {
|
||||
this.ts = ts;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public DataEntity getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(DataEntity data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static class DataEntity {
|
||||
/**
|
||||
* mid : 20293030
|
||||
* refresh_token : 19d64022154e033574df4c753fc7926d
|
||||
* access_token : f64530df1fb491ae090b67e191d86f58
|
||||
* expires_in : 2592000
|
||||
*/
|
||||
|
||||
@SerializedName("mid")
|
||||
private int mid;
|
||||
@SerializedName("refresh_token")
|
||||
private String refreshToken;
|
||||
@SerializedName("access_token")
|
||||
private String accessToken;
|
||||
@SerializedName("expires_in")
|
||||
private int expiresIn;
|
||||
|
||||
public int getMid() {
|
||||
return mid;
|
||||
}
|
||||
|
||||
public void setMid(int mid) {
|
||||
this.mid = mid;
|
||||
}
|
||||
|
||||
public String getRefreshToken() {
|
||||
return refreshToken;
|
||||
}
|
||||
|
||||
public void setRefreshToken(String refreshToken) {
|
||||
this.refreshToken = refreshToken;
|
||||
}
|
||||
|
||||
public String getAccessToken() {
|
||||
return accessToken;
|
||||
}
|
||||
|
||||
public void setAccessToken(String accessToken) {
|
||||
this.accessToken = accessToken;
|
||||
}
|
||||
|
||||
public int getExpiresIn() {
|
||||
return expiresIn;
|
||||
}
|
||||
|
||||
public void setExpiresIn(int expiresIn) {
|
||||
this.expiresIn = expiresIn;
|
||||
}
|
||||
}
|
||||
}
|
41
src/test/java/com/hiczp/bilibili/api/test/Config.java
Normal file
41
src/test/java/com/hiczp/bilibili/api/test/Config.java
Normal file
@ -0,0 +1,41 @@
|
||||
package com.hiczp.bilibili.api.test;
|
||||
|
||||
public class Config {
|
||||
private static Config config;
|
||||
|
||||
private String username;
|
||||
private String password;
|
||||
private int roomId;
|
||||
|
||||
static Config getInstance() {
|
||||
return config;
|
||||
}
|
||||
|
||||
static void setConfig(Config config) {
|
||||
Config.config = config;
|
||||
}
|
||||
|
||||
String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
int getRoomId() {
|
||||
return roomId;
|
||||
}
|
||||
|
||||
public void setRoomId(int roomId) {
|
||||
this.roomId = roomId;
|
||||
}
|
||||
}
|
287
src/test/java/com/hiczp/bilibili/api/test/LiveServiceTest.java
Normal file
287
src/test/java/com/hiczp/bilibili/api/test/LiveServiceTest.java
Normal file
@ -0,0 +1,287 @@
|
||||
package com.hiczp.bilibili.api.test;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.hiczp.bilibili.api.BilibiliRESTAPI;
|
||||
import com.hiczp.bilibili.api.Utils;
|
||||
import com.hiczp.bilibili.api.live.entity.BulletScreenEntity;
|
||||
import com.hiczp.bilibili.api.live.entity.GiftEntity;
|
||||
import com.hiczp.bilibili.api.live.entity.LiveRoomInfoEntity;
|
||||
import com.hiczp.bilibili.api.live.entity.PlayerBagEntity;
|
||||
import org.junit.After;
|
||||
import org.junit.FixMethodOrder;
|
||||
import org.junit.Test;
|
||||
import org.junit.runners.MethodSorters;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
public class LiveServiceTest {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(LiveServiceTest.class);
|
||||
private static final Gson GSON = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting().create();
|
||||
private static int roomId = Config.getInstance().getRoomId();
|
||||
private static LiveRoomInfoEntity.LiveRoomEntity liveRoomEntity;
|
||||
private static PlayerBagEntity.BagGiftEntity firstGiftInPlayerBag;
|
||||
|
||||
@Test
|
||||
public void _00getBulletScreenConfig() throws IOException {
|
||||
LOGGER.info("Getting Bullet Screen config");
|
||||
GSON.toJson(
|
||||
BilibiliRESTAPI.getLiveService()
|
||||
.getBulletScreenConfig("all")
|
||||
.execute()
|
||||
.body(),
|
||||
System.out
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void _01getHistoryBulletScreens() throws Exception {
|
||||
LOGGER.info("Getting history Bullet Screens of room " + roomId);
|
||||
GSON.toJson(
|
||||
BilibiliRESTAPI.getLiveService()
|
||||
.getHistoryBulletScreens(roomId)
|
||||
.execute()
|
||||
.body(),
|
||||
System.out
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void _02getRoomInfo() throws Exception {
|
||||
LOGGER.info("Getting info of live room " + roomId);
|
||||
LiveRoomInfoEntity liveRoomInfoEntity = BilibiliRESTAPI.getLiveService()
|
||||
.getRoomInfo(roomId)
|
||||
.execute()
|
||||
.body();
|
||||
liveRoomEntity = liveRoomInfoEntity.getData();
|
||||
roomId = liveRoomEntity.getRoomId();
|
||||
GSON.toJson(
|
||||
liveRoomInfoEntity,
|
||||
System.out);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void _03isFollowed() throws Exception {
|
||||
LOGGER.info("Getting is followed user " + liveRoomEntity.getMid());
|
||||
GSON.toJson(
|
||||
BilibiliRESTAPI.getLiveService()
|
||||
.isFollowed(liveRoomEntity.getMid())
|
||||
.execute()
|
||||
.body(),
|
||||
System.out
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void _04sendDaily() throws Exception {
|
||||
LOGGER.info("Sending daily");
|
||||
GSON.toJson(
|
||||
BilibiliRESTAPI.getLiveService()
|
||||
.sendDaily()
|
||||
.execute()
|
||||
.body(),
|
||||
System.out
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void _05getAllItem() throws Exception {
|
||||
LOGGER.info("Getting all items");
|
||||
GSON.toJson(
|
||||
BilibiliRESTAPI.getLiveService()
|
||||
.getAllItem()
|
||||
.execute()
|
||||
.body(),
|
||||
System.out
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void _06getAppSmallTV() throws Exception {
|
||||
LOGGER.info("Getting App Small TV info");
|
||||
GSON.toJson(
|
||||
BilibiliRESTAPI.getLiveService()
|
||||
.getAppSmallTV()
|
||||
.execute()
|
||||
.body(),
|
||||
System.out
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void _07getTitle() throws Exception {
|
||||
LOGGER.info("Getting titles");
|
||||
GSON.toJson(
|
||||
BilibiliRESTAPI.getLiveService()
|
||||
.getTitle()
|
||||
.execute()
|
||||
.body(),
|
||||
System.out
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void _08getSpecialGift() throws Exception {
|
||||
LOGGER.info("Getting special gift");
|
||||
GSON.toJson(
|
||||
BilibiliRESTAPI.getLiveService()
|
||||
.getSpecialGift(roomId)
|
||||
.execute()
|
||||
.body(),
|
||||
System.out
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void _09getUserInfo() throws Exception {
|
||||
LOGGER.info("Getting user info");
|
||||
GSON.toJson(
|
||||
BilibiliRESTAPI.getLiveService()
|
||||
.getUserInfo()
|
||||
.execute()
|
||||
.body(),
|
||||
System.out
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void _10getPlayUrl() throws Exception {
|
||||
LOGGER.info("Getting play url of room " + roomId);
|
||||
GSON.toJson(
|
||||
BilibiliRESTAPI.getLiveService()
|
||||
.getPlayUrl(roomId, "json")
|
||||
.execute()
|
||||
.body(),
|
||||
System.out
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void _11sendOnlineHeart() throws Exception {
|
||||
LOGGER.info("Sending online heart to room " + roomId);
|
||||
GSON.toJson(
|
||||
BilibiliRESTAPI.getLiveService()
|
||||
.sendOnlineHeart(roomId, Utils.getScale())
|
||||
.execute()
|
||||
.body(),
|
||||
System.out
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void _12sendBulletScreen() throws Exception {
|
||||
LOGGER.info("Sending Bullet Screen to room " + roomId);
|
||||
GSON.toJson(
|
||||
BilibiliRESTAPI.getLiveService()
|
||||
.sendBulletScreen(new BulletScreenEntity(roomId, new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())))
|
||||
.execute()
|
||||
.body(),
|
||||
System.out
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void _13getFreeSilverCurrentTask() throws Exception {
|
||||
LOGGER.info("Getting free silver current task");
|
||||
GSON.toJson(
|
||||
BilibiliRESTAPI.getLiveService()
|
||||
.getFreeSilverCurrentTask()
|
||||
.execute()
|
||||
.body(),
|
||||
System.out
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void _14getFreeSilverAward() throws Exception {
|
||||
LOGGER.info("Getting free silver award");
|
||||
GSON.toJson(
|
||||
BilibiliRESTAPI.getLiveService()
|
||||
.getFreeSilverAward()
|
||||
.execute()
|
||||
.body(),
|
||||
System.out
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void _15getPlayerBag() throws Exception {
|
||||
LOGGER.info("Getting player bag");
|
||||
PlayerBagEntity playerBagEntity = BilibiliRESTAPI.getLiveService()
|
||||
.getPlayerBag()
|
||||
.execute()
|
||||
.body();
|
||||
try {
|
||||
firstGiftInPlayerBag = playerBagEntity.getData().get(0);
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
LOGGER.error("Current user don't have any gift");
|
||||
}
|
||||
GSON.toJson(
|
||||
playerBagEntity,
|
||||
System.out
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void _16getActivityGifts() throws Exception {
|
||||
LOGGER.info("Getting activity gifts");
|
||||
GSON.toJson(
|
||||
BilibiliRESTAPI.getLiveService()
|
||||
.getActivityGifts(roomId)
|
||||
.execute()
|
||||
.body(),
|
||||
System.out
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void _17sendGift() throws Exception {
|
||||
if (firstGiftInPlayerBag != null) {
|
||||
int number = 1;
|
||||
LOGGER.info("Sending {} {} to room of user '{}'", number, firstGiftInPlayerBag.getGiftName(), liveRoomEntity.getUname());
|
||||
GSON.toJson(
|
||||
BilibiliRESTAPI.getLiveService()
|
||||
.sendGift(new GiftEntity(firstGiftInPlayerBag, number, liveRoomEntity))
|
||||
.execute()
|
||||
.body(),
|
||||
System.out
|
||||
);
|
||||
} else {
|
||||
LOGGER.error("No gift available in player bag, ignore sending gift test");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void _18getGiftTop() throws Exception {
|
||||
LOGGER.info("Getting gift top");
|
||||
GSON.toJson(
|
||||
BilibiliRESTAPI.getLiveService()
|
||||
.getGiftTop(roomId)
|
||||
.execute()
|
||||
.body(),
|
||||
System.out
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void _19getSignInfo() throws Exception {
|
||||
LOGGER.info("Getting sign info");
|
||||
GSON.toJson(
|
||||
BilibiliRESTAPI.getLiveService()
|
||||
.getSignInfo()
|
||||
.execute()
|
||||
.body(),
|
||||
System.out
|
||||
);
|
||||
}
|
||||
|
||||
@After
|
||||
public void endLine() {
|
||||
System.out.println();
|
||||
}
|
||||
}
|
50
src/test/java/com/hiczp/bilibili/api/test/LoginTest.java
Normal file
50
src/test/java/com/hiczp/bilibili/api/test/LoginTest.java
Normal file
@ -0,0 +1,50 @@
|
||||
package com.hiczp.bilibili.api.test;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.hiczp.bilibili.api.BilibiliRESTAPI;
|
||||
import org.junit.After;
|
||||
import org.junit.FixMethodOrder;
|
||||
import org.junit.Test;
|
||||
import org.junit.runners.MethodSorters;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
public class LoginTest {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(LoginTest.class);
|
||||
private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
|
||||
|
||||
@Test
|
||||
public void _0login() throws Exception {
|
||||
LOGGER.info("Start login test");
|
||||
Config config = Config.getInstance();
|
||||
GSON.toJson(
|
||||
BilibiliRESTAPI.login(config.getUsername(), config.getPassword()),
|
||||
System.out
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void _1info() throws Exception {
|
||||
LOGGER.info("Getting user info");
|
||||
GSON.toJson(
|
||||
BilibiliRESTAPI.getAccountInfo(),
|
||||
System.out
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void _2refreshToken() throws Exception {
|
||||
LOGGER.info("Refreshing token");
|
||||
GSON.toJson(
|
||||
BilibiliRESTAPI.refreshToken(),
|
||||
System.out
|
||||
);
|
||||
}
|
||||
|
||||
@After
|
||||
public void endLine() {
|
||||
System.out.println();
|
||||
}
|
||||
}
|
28
src/test/java/com/hiczp/bilibili/api/test/LogoutTest.java
Normal file
28
src/test/java/com/hiczp/bilibili/api/test/LogoutTest.java
Normal file
@ -0,0 +1,28 @@
|
||||
package com.hiczp.bilibili.api.test;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.hiczp.bilibili.api.BilibiliRESTAPI;
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class LogoutTest {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(LogoutTest.class);
|
||||
private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
|
||||
|
||||
@Test
|
||||
public void logout() throws Exception {
|
||||
LOGGER.info("Logout");
|
||||
GSON.toJson(
|
||||
BilibiliRESTAPI.logout(),
|
||||
System.out
|
||||
);
|
||||
}
|
||||
|
||||
@After
|
||||
public void endLine() {
|
||||
System.out.println();
|
||||
}
|
||||
}
|
40
src/test/java/com/hiczp/bilibili/api/test/RuleSuite.java
Normal file
40
src/test/java/com/hiczp/bilibili/api/test/RuleSuite.java
Normal file
@ -0,0 +1,40 @@
|
||||
package com.hiczp.bilibili.api.test;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import org.apache.log4j.BasicConfigurator;
|
||||
import org.junit.ClassRule;
|
||||
import org.junit.rules.ExternalResource;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Suite;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
@RunWith(Suite.class)
|
||||
@Suite.SuiteClasses({
|
||||
LoginTest.class,
|
||||
LiveServiceTest.class,
|
||||
LogoutTest.class
|
||||
})
|
||||
public class RuleSuite {
|
||||
@ClassRule
|
||||
public static ExternalResource externalResource = new ExternalResource() {
|
||||
@Override
|
||||
protected void before() throws Throwable {
|
||||
//初始化 slf4j
|
||||
BasicConfigurator.configure();
|
||||
//读取配置文件
|
||||
try {
|
||||
Config.setConfig(
|
||||
new Gson().fromJson(
|
||||
new BufferedReader(new InputStreamReader(Config.class.getResourceAsStream("/config.json"))),
|
||||
Config.class
|
||||
)
|
||||
);
|
||||
} catch (NullPointerException e) {
|
||||
//抛出异常就可以取消测试
|
||||
throw new RuntimeException("Please create config file before tests");
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
5
src/test/resources/config-template.json
Normal file
5
src/test/resources/config-template.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"username": "xxxxx",
|
||||
"password": "xxxxx",
|
||||
"roomId": "23058"
|
||||
}
|
Loading…
Reference in New Issue
Block a user