1、通过时间区间分页查询观看行为分析数据
2、接口URL中的{userid}为点播账号userid,具体参考菜单【使用须知】->【获取密钥】
3、观看完成度=用户观看有效时长/视频时长,例如:视频A时长为50分钟,用户观看了第0~20分钟,拖拽进度条后观看了第10~30分钟,此时用户有效观看时长为30分钟,则完成度为 30/50=60%
4、接口支持https协议
http://api.polyv.net/v2/advance/play/{userid}
http://api.polyv.net/v2/advance/play/1b448be323?vid=1b448be323ae991b1dfc5136597618d1_1&start=2021-03-10+15%3A21%3A01&sign=12BD21B68CE506562F6C79B7615254EB668B2DFB&pageSize=5&end=2021-04-07+15%3A21%3A01&userid=1b448be323&ptime=1617786046170
private static final Logger log = LoggerFactory.getLogger(VodBigdataTest.class);
/**
* 查询观看行为分析
*/
@Test
public void testGetPlayAnalysis() throws Exception, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String secretKey = super.secretKey;
String userId = super.userId;
String ptime = String.valueOf(System.currentTimeMillis());
//业务参数
String url = String.format("http://api.polyv.net/v2/advance/play/%s", userId);
String start = "2021-03-10 15:21:01";
String end = "2021-04-07 15:21:01";
String pageSize = "5";
String vid = "1b448be323ae991b1dfc5136597618d1_1";
Map<String, String> requestMap = new HashMap<>();
requestMap.put("userid", userId);
requestMap.put("ptime", ptime);
requestMap.put("start", start);
requestMap.put("end", end);
requestMap.put("pageSize", pageSize);
requestMap.put("vid", vid);
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": {
"pageSize": 5,
"contents": [{
"startTime": "2021-04-06 16:29:06",
"videoId": "1b448be323ae991b1dfc5136597618d1_1",
"videoName": "小猫2",
"videoImage": "//img.videocc.net/uimage/1/1b448be323/first_image/cd09cde7-acb0-4662-b24d-fee4b4e3f885_s.jpg",
"videoDuration": 15,
"deviceClass": "Desktop",
"osName": "Windows NT",
"osVersion": "10.0",
"agentName": "Edge",
"agentVersion": "89.0.774.68",
"referer": "https://share.plvideo.cn/front/video/preview?vid=1b448be323ae991b1dfc5136597618d1_1",
"ip": "xxxxxxx",
"country": "中国",
"province": "湖南",
"city": "长沙",
"isp": "中国电信",
"viewerId": "N/A",
"viewerNickName": "N/A",
"viewerAvatar": "N/A",
"totalVideoCount": 0,
"heatmap": "[\"0-15:1\"]",
"completionRate": 1.0,
"status": 61,
"playId": "1617697736110X1071695"
}, {
"startTime": "2021-04-02 17:11:48",
"videoId": "1b448be323ae991b1dfc5136597618d1_1",
"videoName": "小猫2",
"videoImage": "//img.videocc.net/uimage/1/1b448be323/first_image/cd09cde7-acb0-4662-b24d-fee4b4e3f885_s.jpg",
"videoDuration": 15,
"deviceClass": "Desktop",
"osName": "Windows NT",
"osVersion": "10.0",
"agentName": "Edge",
"agentVersion": "89.0.774.63",
"referer": "https://share.plvideo.cn/front/video/preview?vid=1b448be323ae991b1dfc5136597618d1_1",
"ip": "xxxxxxx",
"country": "中国",
"province": "湖南",
"city": "长沙",
"isp": "中国电信",
"viewerId": "N/A",
"viewerNickName": "N/A",
"viewerAvatar": "N/A",
"totalVideoCount": 0,
"heatmap": "[\"0-15:1\"]",
"completionRate": 1.0,
"status": 61,
"playId": "1617354698104X1597608"
}, {
"startTime": "2021-03-31 16:28:14",
"videoId": "1b448be323ae991b1dfc5136597618d1_1",
"videoName": "小猫2",
"videoImage": "//img.videocc.net/uimage/1/1b448be323/first_image/cd09cde7-acb0-4662-b24d-fee4b4e3f885_s.jpg",
"videoDuration": 15,
"deviceClass": "Desktop",
"osName": "Windows NT",
"osVersion": "10.0",
"agentName": "Edge",
"agentVersion": "89.0.774.63",
"referer": "https://share.plvideo.cn/front/video/preview?vid=1b448be323ae991b1dfc5136597618d1_1",
"ip": "xxxxxxx",
"country": "中国",
"province": "湖南",
"city": "长沙",
"isp": "中国电信",
"viewerId": "N/A",
"viewerNickName": "N/A",
"viewerAvatar": "N/A",
"totalVideoCount": 0,
"heatmap": "[\"0-15:1\"]",
"completionRate": 1.0,
"status": 61,
"playId": "1617179283819X1803923"
}, {
"startTime": "2021-03-31 16:26:10",
"videoId": "1b448be323ae991b1dfc5136597618d1_1",
"videoName": "小猫2",
"videoImage": "//img.videocc.net/uimage/1/1b448be323/first_image/cd09cde7-acb0-4662-b24d-fee4b4e3f885_s.jpg",
"videoDuration": 15,
"deviceClass": "Phone",
"osName": "Android",
"osVersion": "6.0",
"agentName": "WeChat",
"agentVersion": "8.0.2.1860",
"referer": "https://share.plvideo.cn/front/video/view?vid=1b448be323ae991b1dfc5136597618d1_1",
"ip": "xxxxxxx",
"country": "中国",
"province": "湖南",
"city": "长沙",
"isp": "中国电信",
"viewerId": "N/A",
"viewerNickName": "N/A",
"viewerAvatar": "N/A",
"totalVideoCount": 0,
"heatmap": "[\"0-15:1\"]",
"completionRate": 1.0,
"status": 61,
"playId": "1617179158342X1197943"
}, {
"startTime": "2021-03-31 16:25:20",
"videoId": "1b448be323ae991b1dfc5136597618d1_1",
"videoName": "小猫2",
"videoImage": "//img.videocc.net/uimage/1/1b448be323/first_image/cd09cde7-acb0-4662-b24d-fee4b4e3f885_s.jpg",
"videoDuration": 15,
"deviceClass": "Desktop",
"osName": "Windows NT",
"osVersion": "10.0",
"agentName": "Edge",
"agentVersion": "89.0.774.63",
"referer": "https://share.plvideo.cn/front/video/preview?vid=1b448be323ae991b1dfc5136597618d1_1",
"ip": "xxxxxxx",
"country": "中国",
"province": "湖南",
"city": "长沙",
"isp": "中国电信",
"viewerId": "N/A",
"viewerNickName": "N/A",
"viewerAvatar": "N/A",
"totalVideoCount": 0,
"heatmap": "[\"0-15:1\"]",
"completionRate": 1.0,
"status": 61,
"playId": "1617179110026X1812455"
}],
"token": "2daa82aabd892f661e967ed365536c05ad832deccda9d0a66f380c6987d838b8e248525ef721439b95a56f9d2027734e5b0d72bbb3022c88a2ef50e2604de902",
"hasNextPage": true
}
}
{
"code": 400,
"status": "error",
"message": "ptime is too old.",
"data": ""
}