update
This commit is contained in:
parent
633543ab05
commit
c0a8478d10
@ -110,7 +110,7 @@ public class SaveLive {
|
|||||||
|
|
||||||
private String getLiveUrl(int roomId) {
|
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));
|
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");
|
return json.getJSONObject("data").getJSONArray("durl").getJSONObject(0).getString("url");
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
@ -125,6 +125,8 @@ public class SaveLive {
|
|||||||
com.yutou.bilibili.Tools.Log.i("开始录制:" + roomId);
|
com.yutou.bilibili.Tools.Log.i("开始录制:" + roomId);
|
||||||
QQBotManager.getInstance().sendMessage(roomId + " 已启动录制");
|
QQBotManager.getInstance().sendMessage(roomId + " 已启动录制");
|
||||||
HttpURLConnection connection = LiveUtils.getBiliHttpGet(url, LiveUtils.getCookie());
|
HttpURLConnection connection = LiveUtils.getBiliHttpGet(url, LiveUtils.getCookie());
|
||||||
|
connection.setReadTimeout(5000);
|
||||||
|
connection.setConnectTimeout(5000);
|
||||||
heartbeat = new Timer();
|
heartbeat = new Timer();
|
||||||
//Heartbeat beat = new Heartbeat();
|
//Heartbeat beat = new Heartbeat();
|
||||||
heartbeat.schedule(new Heartbeat(), 0, 30000);
|
heartbeat.schedule(new Heartbeat(), 0, 30000);
|
||||||
@ -154,8 +156,8 @@ public class SaveLive {
|
|||||||
QQBotManager.getInstance().sendMessage("录制完成:" + roomId + " save = " + isSave + " len = " + len);
|
QQBotManager.getInstance().sendMessage("录制完成:" + roomId + " save = " + isSave + " len = " + len);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
com.yutou.bilibili.Tools.Log.e(e);
|
com.yutou.bilibili.Tools.Log.e(e);
|
||||||
Log.i("录制发生意外:"+e.getMessage());
|
Log.i("录制发生意外:" + e.getMessage());
|
||||||
QQBotManager.getInstance().sendMessage("录制发生意外:"+e.getMessage());
|
QQBotManager.getInstance().sendMessage("录制发生意外:" + e.getMessage());
|
||||||
}
|
}
|
||||||
SaveLive.this.stop(roomId);
|
SaveLive.this.stop(roomId);
|
||||||
|
|
||||||
|
@ -249,7 +249,7 @@ public class QQBotManager implements ApplicationContextAware {
|
|||||||
for (Live live : Live.lives) {
|
for (Live live : Live.lives) {
|
||||||
JSONObject liveJson = LiveUtils.LiveInfoManager.getInstance().getInfo(live.getInfo().getRoomid());
|
JSONObject liveJson = LiveUtils.LiveInfoManager.getInstance().getInfo(live.getInfo().getRoomid());
|
||||||
if(LiveUtils.isLivePlayer(live.getInfo().getRoomid())){
|
if(LiveUtils.isLivePlayer(live.getInfo().getRoomid())){
|
||||||
builder.append("[直播中]");
|
builder.append("【直播中】");
|
||||||
}
|
}
|
||||||
builder
|
builder
|
||||||
.append("名字:").append(live.geData().getName()).append(" ")
|
.append("名字:").append(live.geData().getName()).append(" ")
|
||||||
|
@ -102,7 +102,7 @@ public class ApplicationInit implements ApplicationRunner {
|
|||||||
private void checkLive() {
|
private void checkLive() {
|
||||||
for (BilibiliUpInfo info : service.getUpInfo()) {
|
for (BilibiliUpInfo info : service.getUpInfo()) {
|
||||||
if (info.getOfflinelistening() == 1) {
|
if (info.getOfflinelistening() == 1) {
|
||||||
if (info.getLive() == 1) {
|
if (info.getEnable() == 1) {
|
||||||
Live live = LiveUtils.liveContains(info);
|
Live live = LiveUtils.liveContains(info);
|
||||||
if (live == null) {
|
if (live == null) {
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user