Polyv Help Center

Help Center

listService

Updated: 2023-09-22 17:47:34

1. Query Video List

Description

通过视频标题、分类、标签等条件分页查询视频列表
接口地址(仅做说明使用):https://api.polyv.net/v2/video/search-videos

Call Constraints

  1. The API call has a frequency limit. Click here for details. For common call exceptions, click here for details.

Unit Test

    @Test
    public void testGetVideoList() throws IOException, NoSuchAlgorithmException {
        VodGetVideoListRequest vodGetVideoListRequest = new VodGetVideoListRequest();
        VodGetVideoListResponse vodGetVideoListResponse = null;
        try {
            vodGetVideoListRequest.setFilters("basicInfo,metaData,transcodeInfo,snapshotInfo")
                    .setCategoryId("1602300731843")
                    .setTitle("junit-远程批量上传视频")
                    .setStatus("60,61")
                    .setTag("")
                    .setContainSubCate(Boolean.TRUE)
                    .setStartTime(super.getDate(2021, 1, 15, 9, 15, 15))
                    .setEndTime(super.getDate(2021, 3, 15, 9, 15, 15))
                    .setEncrypted(Boolean.FALSE)
                    .setPlayAuthEnable(Boolean.FALSE)
                    .setSort("creationTimeDesc")
                    .setCurrentPage(1)
                    .setPageSize(10);
            vodGetVideoListResponse = new VodListServiceImpl().getVideoList(vodGetVideoListRequest);
            Assert.assertNotNull(vodGetVideoListResponse);
            if (vodGetVideoListResponse != null) {
                log.debug("测试查询视频列表成功,{}", JSON.toJSONString(vodGetVideoListResponse));
            }
        } catch (PloyvSdkException e) {
            //参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
            log.error(e.getMessage(), e);
            // 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
            throw e;
        } catch (Exception e) {
            log.error("SDK调用异常", e);
            throw e;
        }
    }

Unit Test Description

  1. If the request is correct, a VodGetVideoListResponse object is returned. The B-end processes business logic based on this object.

  2. If the request parameter validation fails, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Input parameter [xxx.chat.VodxxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty]].

  3. If the server processes abnormally, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.]

Request Parameter Description

Parameter Name Required Type Description
filters false String Video information to be returned, separated by commas. Values: basicInfo, metaData, transcodeInfo, snapshotInfo, representing basic info, metadata, transcoding info, and snapshot info respectively. Default returns only basic info.
categoryId false String Video category ID [corresponds to the cateId field in the API documentation]
title false String Fuzzy search by title
tag false String Fuzzy search by video tag
uploader false String Uploader
status false String Video status: 60/61 published; 10 waiting for encoding; 20 encoding; 50 waiting for review; 51 review failed; -1 deleted. Multiple statuses separated by commas. To query published videos, pass only 61 or 60, e.g., "61,50".
containSubCate false Boolean Whether to include subcategories: true includes, false excludes.
startTime false Date Start time, format: yyyy-MM-dd HH:mm:ss
endTime false Date End time, format: yyyy-MM-dd HH:mm:ss
encrypted false Boolean Whether encrypted
playAuthEnable false Boolean Whether playback authorization is enabled
sort false String Result sorting. Can be sorted by creation time or play count in ascending/descending order. Values: creationTimeAsc (creation time ascending), creationTimeDesc (creation time descending), playTimesAsc (play count ascending), playTimesDesc (play count descending). Default is ascending by creation time.
currentPage false Integer Page number, default is 1 [corresponds to the page field in the API documentation]
pageSize false Integer Number of data items per page, default is 20.

Return Object Description

Parameter Name Type Description
contents Array Returned content [see VodGetVideoList Parameter Description for details]
pageSize Integer Number of data items per page, default is 20.
currentPage Integer Current page [corresponds to the pageNumber field in the API documentation]
totalItems Integer Total number of records
totalPage Integer Total number of pages [corresponds to the totalPages field in the API documentation]
VodGetVideoList Parameter Description
Parameter Name Type Description
videoId String Video ID [corresponds to the vid field in the API documentation]
basicInfo BasicInfo Basic video info [see BasicInfo Parameter Description for details]
metaData MetaData Metadata [see MetaData Parameter Description for details]
transcodeInfos Array Transcoding info [see TranscodeInfos Parameter Description for details]
snapshotInfo SnapshotInfo Snapshot info [see SnapshotInfo Parameter Description for details]
BasicInfo Parameter Description
Parameter Name Type Description
title String Video title
description String Video description
duration Double Source video duration, in seconds
coverURL String Thumbnail URL, large image
creationTime Date Creation time, format: yyyy-MM-dd HH:mm:ss
updateTime Date Update time, format: yyyy-MM-dd HH:mm:ss
size Long Source file size, in Bytes
status Integer Video status code
categoryId String Category ID [corresponds to the cateId field in the API documentation]
categoryName String Category name [corresponds to the cateName field in the API documentation]
tags String Tags
uploader String Uploader
MetaData Parameter Description
Parameter Name Type Description
size Long Source file size, in Bytes
format String Video container type, e.g., mp4, flv
duration Double Source video duration, in seconds
bitrate Integer Video bitrate, in bps
fps Integer Video frame rate
height Integer Resolution height, in px
width Integer Resolution width, in px
codec String Encoding format, e.g., h264, h265
TranscodeInfos Parameter Description
Parameter Name Type Description
playUrl String Playback URL
definition String Definition: SOURCE (original), LD (low definition), SD (standard definition), HD (high definition)
bitrate Integer Bitrate in kbps
duration Double Duration in seconds
encrypt Boolean True if encrypted, false if not
format String Transcoding format, e.g., mp4, flv, pdx, hls
fps Integer Video frame rate
height Integer Resolution height, in px
width Integer Resolution width, in px
status String Video status: normal (playable), unavailable (not playable)
SnapshotInfo Parameter Description
Parameter Name Type Description
imageUrl Array Array of snapshot URLs

联系客服,在线咨询