Polyv Help Center

Help Center

Batch Query Video Analysis

Updated: 2025-03-12 17:14:55

API Description

1、分页查询所有已发布视频的视频分析数据
2、接口支持https协议

API URL

https://api.polyv.net/v3/advance/video/list

Request Method

GET

API Constraints

  1. The API supports both HTTP and HTTPS. HTTPS is recommended for security. API calls have frequency limits. See details
  2. For advanced analysis features, see: Video Advanced Analysis
  3. Due to large data volume and computation, analysis results are only available the next day
  4. The batch query API can only query video data with a status of Published

Request Parameter Description

Parameter Required Type Description
appId true String Live streaming appId. You can view your live appId and appSecret in "Cloud VOD" -> "Settings" -> "API Interface"
timestamp true Long Current time in milliseconds, valid for 30 minutes
page false Integer Page number, starting from 1, default is 1
pageSize false Integer Page size, default is 10, maximum is 100
vidList false String VID collection. Pass this parameter to batch query video analysis data for specific VIDs. Separate multiple VIDs with commas. Maximum 100 VIDs per call. Example: 833584471db2eb2b9d0b582e7e755c66_8,833584471d0ed109bb261b104f584896_8
sign true String Signature, 32-character uppercase MD5 value See MD5 Signature Generation Rules

Example

https://api.polyv.net/v3/advance/video/list?timestamp=1682498437763&appId=gf24khyndx&page=1&pageSize=10&sign=4C62E7E1FDBD500C032A2E047B8C6A43

Response Parameter Description

Parameter Type Description
code Integer Response status code, 200 for success, non-200 for failure See Global Error Description
status String Response status text
requestId String Unique request identifier. If the API call fails, provide this ID to customer service for troubleshooting
data Object Detailed video analysis data on success See data field description
error Object Error information on failure See error field description

data Field Description

Parameter Type Description
pageNumber Integer Page number
pageSize Integer Page size
totalPages Integer Total pages
totalItems Integer Total number of items
contents List See contents field description

contents Field Description

Parameter Type Description
videoId String Video ID
videoName String Video name
duration Integer Video duration, in seconds
playTimes Integer Number of plays
uniqueViewerCount Integer Number of unique viewers
avgCompletionRate Double Average completion rate
viewHeatmap String View heatmap, e.g., ["0-20:662","21-100:665"] indicates 662 views from 0 to 20 seconds and 665 views from 21 to 100 seconds
uniqueViewHeatmap String Unique view heatmap, e.g., ["0-20:614","21-100:615"] indicates 614 unique viewers from 0 to 20 seconds and 615 from 21 to 100 seconds
error Field Description
code desc Description
9 undefined error Unknown exception
4013 vid illegal Invalid video VID. Check the video ID in the parameters

Java Request Example

For quick integration of the base code, download the relevant dependency source code. Click to download source code. After downloading, add it to your project. The test cases include HttpUtil.java and LiveSignUtil.java in the downloaded file.

    private static final Logger log = LoggerFactory.getLogger(ChannelOperateTest.class);
    /**
     * 批量查询视频分析
     * @throws IOException
     * @throws NoSuchAlgorithmException
     */
    @Test
    public void getVideoAdvanceTest() throws IOException, NoSuchAlgorithmException {
        //公共参数,填写自己的实际参数
        String appId = super.appId;//注意此处为appId
        String appSecret = super.appSecret;//注意此处为appSecret,非secretKey
        String timestamp = String.valueOf(System.currentTimeMillis());
        
        //业务参数
        String url = "https://api.polyv.net/v3/advance/video/list";
        
        //http 调用逻辑
        Map<String, String> requestMap = new HashMap<>();
        requestMap.put("appId", appId);
        requestMap.put("timestamp", timestamp);
        requestMap.put("page", "1");
        requestMap.put("pageSize", "1");
        
        requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
        String response = HttpUtil.get(url, requestMap);
        
        log.info("测试批量查询视频分析成功:{}", response);
        //do somethings
    
    }

Response Example

Success Example

{
    "requestId": "40d2ab85-73a4-4266-bcc6-8e828d8c9a9b",
    "code": 200,
    "status": "success",
    "error": null,
    "data": {
        "pageNumber": 1,
        "totalPages": 1,
        "pageSize": 10,
        "totalItems": 3,
        "contents": [
            {
                "videoId": "833584471db2eb2b9d0b582e7e755c66_8",
                "videoName": "导出18-平台设置",
                "duration": 145,
                "playTimes": 6,
                "uniqueViewerCount": 1,
                "avgCompletionRate": 0.03,
                "viewHeatmap": "[\"0-1:6\",\"2-2:4\",\"3-5:2\",\"6-15:1\"]",
                "uniqueViewHeatmap": "[\"0-15:1\"]"
            },
            {
                "videoId": "833584471d0ed109bb261b104f584896_8",
                "videoName": "导出17-数据统计",
                "duration": 129,
                "playTimes": 1,
                "uniqueViewerCount": 1,
                "avgCompletionRate": 0.2,
                "viewHeatmap": "[\"0-26:1\"]",
                "uniqueViewHeatmap": "[\"0-26:1\"]"
            },
            {
                "videoId": "833584471d80e5c1752460d2a07bd51c_8",
                "videoName": "导出16-默认模板",
                "duration": null,
                "playTimes": null,
                "uniqueViewerCount": null,
                "avgCompletionRate": null,
                "viewHeatmap": null,
                "uniqueViewHeatmap": null
            }
        ]
    }
}

Error Example

  • Unknown Exception
{
    "requestId": "492834b6-c1c6-4c5e-8609-ddc1f96da1e4",
    "code": 500,
    "status": "error",
    "error": {
        "code": 9,
        "desc": "undefined error"
    },
    "data": null
}
  • Invalid Video ID
{
    "requestId": "edcc2674-bf46-4db1-991c-0f7feab94200",
    "code": 400,
    "status": "error",
    "error": {
        "code": 4013,
        "desc": "vid illegal"
    },
    "data": null
}
联系客服,在线咨询