add user info

This commit is contained in:
Yutousama 2022-10-14 21:27:24 +08:00
parent 3d730206b9
commit 47e4039127
2 changed files with 26 additions and 14 deletions

View File

@ -296,9 +296,12 @@ public class BiliBiliUtils {
}
public static void main(String[] args) {
String url="https://xy218x85x123x8xy.mcdn.bilivideo.cn:4483/upgcxcode/12/12/17281212/17281212-16-80.flv?e=ig8euxZM2rNcNbNBhbdVhwdlhbUghwdVhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M=&uipk=5&nbs=1&deadline=1660538573&gen=playurlv2&os=mcdn&oi=2936701972&trid=00006f9623cac1514d8ea18fba3a15a756cau&mid=96300&platform=pc&upsig=25ddd1da610960e8e1d2e80dc97c2361&uparams=e,uipk,nbs,deadline,gen,os,oi,trid,mid,platform&mcdnid=11000101&bvc=vod&nettype=0&orderid=0,2&agrr=1&bw=253116&logo=A0000400&requestFrom=BILIBILI_HELPER_2.5.8";
/* String url="https://xy218x85x123x8xy.mcdn.bilivideo.cn:4483/upgcxcode/12/12/17281212/17281212-16-80.flv?e=ig8euxZM2rNcNbNBhbdVhwdlhbUghwdVhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M=&uipk=5&nbs=1&deadline=1660538573&gen=playurlv2&os=mcdn&oi=2936701972&trid=00006f9623cac1514d8ea18fba3a15a756cau&mid=96300&platform=pc&upsig=25ddd1da610960e8e1d2e80dc97c2361&uparams=e,uipk,nbs,deadline,gen,os,oi,trid,mid,platform&mcdnid=11000101&bvc=vod&nettype=0&orderid=0,2&agrr=1&bw=253116&logo=A0000400&requestFrom=BILIBILI_HELPER_2.5.8";
File file=BiliBiliUtils.download(url,"16.mp4",false);
System.out.println("file.getAbsolutePath() = " + file.getAbsolutePath());
System.out.println("file.getAbsolutePath() = " + file.getAbsolutePath());*/
System.out.println(getLiveRoom(42062));
System.out.println("--------------------------------------------");
System.out.println(getUserInfo(730732));
}
public static boolean sendLiveDanmu(long roomId,String msg){
@ -321,12 +324,20 @@ public class BiliBiliUtils {
JSONObject post = BiliBiliUtils.http_post("https://api.live.bilibili.com/xlive/revenue/v1/wallet/silver2coin", HttpTools.toUrlParams(body));
return post.getString("message");
}
public static boolean checkLiveRoom(int roomId){
public static JSONObject getLiveRoom(int roomId){
JSONObject body=new JSONObject();
body.put("room_id",roomId);
body.put("csrf",BiliLogin.getCookieToken());
body.put("csrf_token",BiliLogin.getCookieToken());
JSONObject post = BiliBiliUtils.http_post("https://api.live.bilibili.com/room/v1/Room/get_info", HttpTools.toUrlParams(body));
return BiliBiliUtils.http_post("https://api.live.bilibili.com/room/v1/Room/get_info", HttpTools.toUrlParams(body));
}
public static JSONObject getUserInfo(int mid){
JSONObject body=new JSONObject();
body.put("mid",mid);
return BiliBiliUtils.http_get("https://api.bilibili.com/x/space/acc/info?"+ HttpTools.toUrlParams(body));
}
public static boolean checkLiveRoom(int roomId){
JSONObject post=getLiveRoom(roomId);
return post.getInteger("code")==0;
}
}

View File

@ -72,19 +72,20 @@ public class BiliBiliLive extends Model {
}
} else {
message.append("直播签到操作失败\n");
message.append("-----直播签到房间号----\n");
Set<String> biliLive = RedisTools.list_get("bili_live");
for (String id : biliLive) {
message.append(id).append("\n");
}
}
} catch (Exception e) {
message = new StringBuilder("直播签到添加失败\n");
message.append("-----直播签到房间号-----\n");
Set<String> biliLive = RedisTools.list_get("bili_live");
for (String id : biliLive) {
message.append(id).append("\n");
}
}
message.append("-----直播签到房间号-----\n");
Set<String> biliLive = RedisTools.list_get("bili_live");
for (String id : biliLive) {
message.append(id)
.append(":")
.append(BiliBiliUtils.getUserInfo(
BiliBiliUtils.getLiveRoom(Integer.parseInt(id))
.getJSONObject("data")
.getInteger("mid")))
.append("\n");
}
QQBotManager.getInstance().sendMessage(qq, message.toString());