diff --git a/videolive/live_bilibili.js b/videolive/live_bilibili.js index 5bcf785..9ceccf7 100644 --- a/videolive/live_bilibili.js +++ b/videolive/live_bilibili.js @@ -19,7 +19,6 @@ let userIdx = 0 let userCount = 0 // let baseUrl = 'http://423n669m71.no-ip.org:9000/api/endpoints/2'; // let apiKey = "ptr_oQzrYfeDBfuGSbaK2qOM83zN94RyEZfO8v+DdUJwccA=" -let baseUrl = 'http://172.17.0.5:9000/api/endpoints/2';//portainer容器的地址 let apiKey = "ptr_oQzrYfeDBfuGSbaK2qOM83zN94RyEZfO8v+DdUJwccA=" /////////////////////////////////////////////////////////////////// @@ -35,13 +34,22 @@ class UserInfo { } async restartContainers () { - let url = `${baseUrl}/docker/containers/e31e436df4b242a5820804e1a947f37971e60f35df02ee82c02bd62ad24038cf/restart` - let body = {}; - let boydStr = JSON.stringify(body); - let urlObject = popudocket(url, "", this.apiKey) - await httpRequest('post', urlObject) - let result = httpResult; - console.log(result); + for (let i = 1; i < 9; i++) { + let baseUrl = `http://172.17.0.${i}:9000/api/endpoints/2`;//portainer容器的地址 + let url = `${baseUrl}/docker/containers/b3319a7266615d2f3c45825f3b9018437034dc9bcca40f3cbcac952bfc0a6bc8/restart` + let body = {}; + let boydStr = JSON.stringify(body); + let urlObject = popudocket(url, "", this.apiKey) + await httpRequest('post', urlObject) + let result = httpResult; + if(result!=null) + { + console.log(`IP 172.17.0.${i}`); + console.log(result); + break; + } + } + } async getIsLive () { @@ -52,16 +60,16 @@ class UserInfo { await httpRequest('get', urlObject) let result = httpResult; if (!result?.data?.room_info?.live_status) { - console.log("未开播",result) + console.log("未开播", result) } return result?.data?.room_info?.live_status == 1; } async startLive () { - console.log("ck: "+this.ck); + console.log("ck: " + this.ck); let cookJson = $.str2json(this.ck, ";"); - if(!cookJson.bili_jct) - cookJson = $.str2json(this.ck, "; "); + if (!cookJson.bili_jct) + cookJson = $.str2json(this.ck, "; "); let url = `https://api.live.bilibili.com/room/v1/Room/startLive` let body = {}; let csrf = cookJson.bili_jct @@ -99,6 +107,7 @@ class UserInfo { } !(async () => { + if (typeof $request !== "undefined") { await GetRewrite() } else {