From c0a8478d10970350ad5cfe8b421f22dadd902ff2 Mon Sep 17 00:00:00 2001 From: yutou Date: Tue, 13 Apr 2021 17:38:54 +0800 Subject: [PATCH] update --- .../java/com/yutou/bilibili/BiliBili/Tools/SaveLive.java | 8 +++++--- src/main/java/com/yutou/bilibili/QQBot/QQBotManager.java | 2 +- .../java/com/yutou/bilibili/Tools/ApplicationInit.java | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/yutou/bilibili/BiliBili/Tools/SaveLive.java b/src/main/java/com/yutou/bilibili/BiliBili/Tools/SaveLive.java index 76d06d8..cc4a3d5 100644 --- a/src/main/java/com/yutou/bilibili/BiliBili/Tools/SaveLive.java +++ b/src/main/java/com/yutou/bilibili/BiliBili/Tools/SaveLive.java @@ -110,7 +110,7 @@ public class SaveLive { private String getLiveUrl(int roomId) { JSONObject json = LiveUtils.http_get(String.format("https://api.live.bilibili.com/xlive/web-room/v1/playUrl/playUrl?cid=%d&platform=web", roomId)); - if (json.getInteger("code") == 0) { + if (json != null && json.getInteger("code") == 0) { return json.getJSONObject("data").getJSONArray("durl").getJSONObject(0).getString("url"); } else { return null; @@ -125,6 +125,8 @@ public class SaveLive { com.yutou.bilibili.Tools.Log.i("开始录制:" + roomId); QQBotManager.getInstance().sendMessage(roomId + " 已启动录制"); HttpURLConnection connection = LiveUtils.getBiliHttpGet(url, LiveUtils.getCookie()); + connection.setReadTimeout(5000); + connection.setConnectTimeout(5000); heartbeat = new Timer(); //Heartbeat beat = new Heartbeat(); heartbeat.schedule(new Heartbeat(), 0, 30000); @@ -154,8 +156,8 @@ public class SaveLive { QQBotManager.getInstance().sendMessage("录制完成:" + roomId + " save = " + isSave + " len = " + len); } catch (Exception e) { com.yutou.bilibili.Tools.Log.e(e); - Log.i("录制发生意外:"+e.getMessage()); - QQBotManager.getInstance().sendMessage("录制发生意外:"+e.getMessage()); + Log.i("录制发生意外:" + e.getMessage()); + QQBotManager.getInstance().sendMessage("录制发生意外:" + e.getMessage()); } SaveLive.this.stop(roomId); diff --git a/src/main/java/com/yutou/bilibili/QQBot/QQBotManager.java b/src/main/java/com/yutou/bilibili/QQBot/QQBotManager.java index 7038bd6..babe217 100644 --- a/src/main/java/com/yutou/bilibili/QQBot/QQBotManager.java +++ b/src/main/java/com/yutou/bilibili/QQBot/QQBotManager.java @@ -249,7 +249,7 @@ public class QQBotManager implements ApplicationContextAware { for (Live live : Live.lives) { JSONObject liveJson = LiveUtils.LiveInfoManager.getInstance().getInfo(live.getInfo().getRoomid()); if(LiveUtils.isLivePlayer(live.getInfo().getRoomid())){ - builder.append("[直播中]"); + builder.append("【直播中】"); } builder .append("名字:").append(live.geData().getName()).append(" ") diff --git a/src/main/java/com/yutou/bilibili/Tools/ApplicationInit.java b/src/main/java/com/yutou/bilibili/Tools/ApplicationInit.java index 493d386..5f8cb5a 100644 --- a/src/main/java/com/yutou/bilibili/Tools/ApplicationInit.java +++ b/src/main/java/com/yutou/bilibili/Tools/ApplicationInit.java @@ -102,7 +102,7 @@ public class ApplicationInit implements ApplicationRunner { private void checkLive() { for (BilibiliUpInfo info : service.getUpInfo()) { if (info.getOfflinelistening() == 1) { - if (info.getLive() == 1) { + if (info.getEnable() == 1) { Live live = LiveUtils.liveContains(info); if (live == null) { try {