This commit is contained in:
yutou 2021-05-21 18:33:50 +08:00
parent a42cc0ed7c
commit c64300d76d
2 changed files with 14 additions and 2 deletions

View File

@ -175,7 +175,6 @@ public class Live implements ApplicationContextAware {
init = false;
}
decompress(bytes.array());
Log.i(AppTools.getToDayTimeToString(startTime),roomId,LiveUtils.getHex(bytes.array()).substring(16,32));
}
@Override
@ -290,9 +289,12 @@ public class Live implements ApplicationContextAware {
if (data.length > 32) {
List<String> list = LiveUtils.getMsgList(LiveUtils.dec(bytes), new ArrayList<>(), true);
String tmp="";
for (String str : list) {
processData(str, data);
tmp+=str.substring(0,16)+" | ";
}
Log.i(AppTools.getToDayTimeToString(startTime),roomId,"list size = "+list.size()+" data = "+tmp);
} else {
try {
JSONObject json = JSONObject.parseObject(new String(bytes, StandardCharsets.UTF_8));

View File

@ -185,7 +185,7 @@ public class LiveUtils {
public synchronized static JSONObject http_get(String url) {
try {
Log.i("调用url = "+url);
// Log.i("调用url = "+url);
HttpURLConnection connection = getBiliHttpGet(url, getCookie());
BufferedInputStream stream = new BufferedInputStream(connection.getInputStream());
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
@ -350,6 +350,9 @@ public class LiveUtils {
return http_get("https://api.live.bilibili.com/xlive/web-room/v1/index/getInfoByRoom?room_id=" + roomId);
}
private static JSONObject getLiveState(int roomId){
return http_get("https://api.live.bilibili.com/xlive/web-room/v2/index/getRoomPlayInfo?room_id=" + roomId);
}
public static String getLiveTitle(int roomId) {
JSONObject json = LiveInfoManager.getInstance().getInfo(roomId);
@ -468,4 +471,11 @@ public class LiveUtils {
}
}
public static void main(String[] args) {
int index=1000;
for (int i = 0; i < index; i++) {
LiveUtils.getLiveInfo(21686237);
}
}
}