diff --git a/src/main/java/com/yutou/bilibili/BiliBili/Live.java b/src/main/java/com/yutou/bilibili/BiliBili/Live.java index b0f4ccc..d25c8c2 100644 --- a/src/main/java/com/yutou/bilibili/BiliBili/Live.java +++ b/src/main/java/com/yutou/bilibili/BiliBili/Live.java @@ -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 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)); diff --git a/src/main/java/com/yutou/bilibili/BiliBili/LiveUtils.java b/src/main/java/com/yutou/bilibili/BiliBili/LiveUtils.java index 2b86ef1..7192b7f 100644 --- a/src/main/java/com/yutou/bilibili/BiliBili/LiveUtils.java +++ b/src/main/java/com/yutou/bilibili/BiliBili/LiveUtils.java @@ -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); + } + } + }