1、查询视频在不同终端的播放量排行,从播放行为产生到数据可查询的间隔时间为1~2小时
2、接口URL中的{userid}为点播账号userid,具体参考菜单【使用须知】->【获取密钥】
3、接口支持https协议
http://api.polyv.net/v2/videoview/{userid}/ranklist
http://api.polyv.net/v2/videoview/1b448be323/ranklist?start=2021-03-01&sign=F378D4041015727EA34C3CC58F9DC83334FA7266&end=2021-04-08&userId=1b448be323&ptime=1617875095741
强烈建议您使用点播Java SDK完成API的功能对接,点播Java SDK 对API调用逻辑、异常处理、数据签名、HTTP请求线程池进行了统一封装和优化。
private static final Logger log = LoggerFactory.getLogger(VodStatisticsTest.class);
/**
* 查询视频播放量排行
* @throws Exception
* @throws NoSuchAlgorithmException
*/
@Test
public void testGetPlaytimesRank() throws Exception, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String secretKey = super.secretKey;
String userId = super.userId;
String ptime = String.valueOf(System.currentTimeMillis());
//业务参数
String url = "http://api.polyv.net/v2/videoview/"+userId+"/ranklist";
String start = "2021-03-01";
String end = "2021-04-08";
Map<String, String> requestMap = new HashMap<>();
requestMap.put("userId", userId);
requestMap.put("ptime", ptime);
requestMap.put("start", start);
requestMap.put("end", end);
requestMap.put("sign", VodSignUtil.getSign(requestMap, secretKey));
String response = HttpUtil.get(url, requestMap);
log.debug("测试查询视频播放量排行,{}", response);
//do somethings
}
{
"code":200,
"status":"success",
"message":"success",
"data":{
"totalMoVideoView":0,
"pcVideoDailys":[
{
"videoId":"1b448be32370f4822ac40fd926112a66_1",
"title":"视频标题",
"duration":"00:00:45",
"pcVideoView":2,
"mobileVideoView":0
},
{
"videoId":"1b448be3233659acf35d430ba9210bd4_1",
"title":"junit-远程批量上传视频",
"duration":"00:01:25",
"pcVideoView":2,
"mobileVideoView":0
},
{
"videoId":"1b448be323d66f3dae8db5af9f1fdce6_1",
"title":"a",
"duration":"00:00:44",
"pcVideoView":2,
"mobileVideoView":0
},
{
"videoId":"1b448be323b452641878b54f21241188_1",
"title":"合并美食视频",
"duration":"00:01:06",
"pcVideoView":2,
"mobileVideoView":0
},
{
"videoId":"1b448be323a8649edcfea26c0f870def_1",
"title":"pro_compress-w431sfrmnq.mp4",
"duration":"00:01:37",
"pcVideoView":2,
"mobileVideoView":0
},
{
"videoId":"1b448be323a6a1a6c0c237856f555e88_1",
"title":"hello,word",
"duration":"00:00:24",
"pcVideoView":1,
"mobileVideoView":0
},
{
"videoId":"1b448be323a146649ad0cc89d0faed9c_1",
"title":"junit合并并修改_1",
"duration":"00:03:11",
"pcVideoView":1,
"mobileVideoView":0
},
{
"videoId":"1b448be3239482977934f099f2ceaa0a_1",
"title":"测试异步上传视频1",
"duration":"00:00:17",
"pcVideoView":1,
"mobileVideoView":0
}
],
"moVideoDailys":[
{
"videoId":"1b448be32370f4822ac40fd926112a66_1",
"title":"视频标题",
"duration":"00:00:45",
"pcVideoView":2,
"mobileVideoView":0
},
{
"videoId":"1b448be3233659acf35d430ba9210bd4_1",
"title":"junit-远程批量上传视频",
"duration":"00:01:25",
"pcVideoView":2,
"mobileVideoView":0
},
{
"videoId":"1b448be323d66f3dae8db5af9f1fdce6_1",
"title":"a",
"duration":"00:00:44",
"pcVideoView":2,
"mobileVideoView":0
},
{
"videoId":"1b448be323b452641878b54f21241188_1",
"title":"合并美食视频",
"duration":"00:01:06",
"pcVideoView":2,
"mobileVideoView":0
},
{
"videoId":"1b448be323a8649edcfea26c0f870def_1",
"title":"pro_compress-w431sfrmnq.mp4",
"duration":"00:01:37",
"pcVideoView":2,
"mobileVideoView":0
},
{
"videoId":"1b448be323a6a1a6c0c237856f555e88_1",
"title":"hello,word",
"duration":"00:00:24",
"pcVideoView":1,
"mobileVideoView":0
},
{
"videoId":"1b448be323a146649ad0cc89d0faed9c_1",
"title":"junit合并并修改_1",
"duration":"00:03:11",
"pcVideoView":1,
"mobileVideoView":0
},
{
"videoId":"1b448be3239482977934f099f2ceaa0a_1",
"title":"测试异步上传视频1",
"duration":"00:00:17",
"pcVideoView":1,
"mobileVideoView":0
}
],
"totalPcVideoView":13
}
}
{
"code": 400,
"status": "error",
"message": "ptime is too old.",
"data": ""
}