1、通过频道号获取该频道某段时间的直播观看的统计数据
2、接口支持https协议
http://api.polyv.net/live/v3/channel/statistics/daily/summary
http://api.polyv.net/live/v3/channel/statistics/daily/summary?startDay=2021-6-1&appId=frlr1zazn3&endDay=2021-7-11&sign=3A891F01997FC54E486A1807C6E6DBF6&channelId=1965681×tamp=1652410270091
强烈建议您使用直播Java SDK完成API的功能对接,直播Java SDK 对API调用逻辑、异常处理、数据签名、HTTP请求线程池进行了统一封装和优化。
private static final Logger log = LoggerFactory.getLogger(ChannelViewDataTest.class);
/**
* 查询频道某段时间的直播观看详情数据
* @throws IOException
*/
@Test
public void testSummary() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId = super.appId;
String appSecret = super.appSecret;
String userId = super.userId;
String timestamp = String.valueOf(System.currentTimeMillis());
//业务参数
String url = "http://api.polyv.net/live/v3/channel/statistics/daily/summary";
String channelId = "1965681";
String startDay = "2021-6-1";
String endDay = "2021-7-11";
//http 调用逻辑
Map<String,String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp",timestamp);
requestMap.put("channelId",channelId);
requestMap.put("startDay",startDay);
requestMap.put("endDay",endDay);
requestMap.put("sign",LiveSignUtil.getSign(requestMap, appSecret));
String response = HttpUtil.get(url, requestMap);
log.info("测试查询频道某段时间的直播观看详情数据,返回值:{}",response);
//do somethings
}
{
"status":"success",
"result":[
{
"currentDay":"2020-10-20",
"channelId":1965681,
"userId":"1b448be323",
"pcPlayDuration":7,
"pcFlowSize":0,
"pcVideoView":7,
"pcUniqueViewer":1,
"mobilePlayDuration":0,
"mobileFlowSize":0,
"mobileVideoView":0,
"mobileUniqueViewer":0,
"createdTime":1603218100000,
"lastModified":1603218100000,
"creatorId":"1b448be323",
"creatorName":"主账号"
},
{
"currentDay":"2020-10-26",
"channelId":1965681,
"userId":"1b448be323",
"pcPlayDuration":17,
"pcFlowSize":0,
"pcVideoView":12,
"pcUniqueViewer":1,
"mobilePlayDuration":2,
"mobileFlowSize":0,
"mobileVideoView":1,
"mobileUniqueViewer":1,
"createdTime":1603736505000,
"lastModified":1603736505000,
"creatorId":"1b448be323",
"creatorName":"主账号"
},
{
"currentDay":"2020-11-12",
"channelId":1965681,
"userId":"1b448be323",
"pcPlayDuration":1,
"pcFlowSize":0,
"pcVideoView":1,
"pcUniqueViewer":1,
"mobilePlayDuration":0,
"mobileFlowSize":0,
"mobileVideoView":0,
"mobileUniqueViewer":0,
"createdTime":1605205271000,
"lastModified":1605205271000,
"creatorId":"1b448be323",
"creatorName":"主账号"
},
{
"currentDay":"2020-12-03",
"channelId":1965681,
"userId":"1b448be323",
"pcPlayDuration":1,
"pcFlowSize":0,
"pcVideoView":1,
"pcUniqueViewer":1,
"mobilePlayDuration":0,
"mobileFlowSize":0,
"mobileVideoView":0,
"mobileUniqueViewer":0,
"createdTime":1607019680000,
"lastModified":1607019680000,
"creatorId":"1b448be323",
"creatorName":"主账号"
}
]
}
{
"code": 400,
"status": "error",
"message": "invalid signature.",
"data": ""
}