https://api.polyv.net/live/v3/channel/statistics/get-live-durations
1、接口用于查询频道直播时长
2、支持多频道
3、接口支持https
{
"code": 200,
"status": "success",
"message": "",
"data": [
{
"duration": 1000,
"channelId": 108888
},
{
"duration": 222,
"channelId": 108188
}
]
}
{
"code": 400,
"status": "error",
"message": "appId is required.",
"data": ""
}
{
"code": 400,
"status": "error",
"message": "application not found.",
"data": ""
}
{
"code": 400,
"status": "error",
"message": "invalid timestamp.",
"data": ""
}
{
"code": 403,
"status": "error",
"message": "invalid signature.",
"data": ""
}
{
"code": 400,
"data": "",
"message": "illegal channel id: 10001",
"status": "error"
}
public static void test() {
String url = "https://api.polyv.net/live/v3/channel/statistics/get-live-durations";
// 用户对应的appId和加密串
String appId = "xxxxxxxxx";
String appSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxx";
String channelIds = "10001,10002";
Map<String, String> params = new HashMap<>();
params.put("channelIds", channelIds);
PolyvTool.setLiveSign(params, appId, appSecret);
// 调用Polyv的httpClient工具类发送请求
String content = HttpClientUtil.getInstance()
.sendHttpGet(url + "?" + PolyvTool.mapJoinNotEncode(params));
System.out.println(content);
}