> For the complete documentation index, see [llms.txt](https://polyv.gitbook.io/document/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://polyv.gitbook.io/document/docs/vod/java/listservice.md).

# List Service

## 描述

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

## 调用约束

1、接口调用有频率限制，[详细请查看](https://git.polyv.net/help-center/document-center/-/blob/master/vod/java/limit/README.md)，调用常见异常，[详细请查看](https://git.polyv.net/help-center/document-center/-/blob/master/vod/java/exceptionDoc/README.md)

## 单元测试

```java
	@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;
        }
    }
```

## 单元测试说明

1、请求正确，返回VodGetVideoListResponse对象，B端依据此对象处理业务逻辑；

2、请求参数校验不合格，抛出PloyvSdkException，错误信息见PloyvSdkException.getMessage()，如 \[ 输入参数 \[xxx.chat.VodxxxRequest]对象校验失败，失败字段 \[pic不能为空 / msg不能为空] ]

3、服务器处理异常，抛出PloyvSdkException，错误信息见PloyvSdkException.getMessage()，如 \[ 保利威请求返回数据错误，请求流水号：66e7ad29fd04425a84c2b2b562d2025b，错误原因： invalid signature. ]

## 请求入参描述

| 参数名            | 必选    | 类型      | 说明                                                                                                                                  |
| -------------- | ----- | ------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| filters        | false | String  | 需要返回的视频信息，多个以英文逗号分隔，取值：basicInfo,metaData,transcodeInfo,snapshotInfo, 分别代表基础信息、元数据、转码信息、截图信息，默认仅返回基础信息                              |
| categoryId     | false | String  | 视频分类ID【对应api文档的**cateId**字段】                                                                                                        |
| title          | false | String  | 按标题模糊搜索                                                                                                                             |
| tag            | false | String  | 按视频标签模糊搜索                                                                                                                           |
| uploader       | false | String  | 上传者                                                                                                                                 |
| status         | false | String  | 视频状态,60/61已发布；10等待编码；20正在编码；50等待审核；51审核不通过；-1已删除；多个状态以英文逗号分隔，查询已发布状态的视频只需传61/60其中一个即可，如“61,50”                                      |
| containSubCate | false | Boolean | 是否包含子分类, true：包含, false：不包含                                                                                                         |
| startTime      | false | Date    | 开始时间，格式：yyyy-MM-dd HH:mm:ss                                                                                                         |
| endTime        | false | Date    | 结束时间，格式：yyyy-MM-dd HH:mm:ss                                                                                                         |
| encrypted      | false | Boolean | 是否加密                                                                                                                                |
| playAuthEnable | false | Boolean | 是否开启了播放授权                                                                                                                           |
| sort           | false | String  | 结果排序，可以按创建时间或播放次数降序/升序排序，取值：creationTimeAsc（创建时间升序）、creationTimeDesc（创建时间降序）、playTimesAsc（播放次数升序）、playTimesDesc（播放次数降序），默认按撞见时间升序排序 |
| currentPage    | false | Integer | 页数，默认为1【对应api文档的**page**字段】                                                                                                         |
| pageSize       | false | Integer | 每页显示的数据条数，默认每页显示20条数据                                                                                                               |

## 返回对象描述

| 参数名         | 类型      | 说明                                                                                                                                |
| ----------- | ------- | --------------------------------------------------------------------------------------------------------------------------------- |
| contents    | Array   | 返回内容【详见[VodGetVideoList参数描述](https://git.polyv.net/help-center/document-center/-/blob/master/vod/java/listService.md?id=polyv15)】 |
| pageSize    | Integer | 每页显示的数据条数，默认每页显示20条数据                                                                                                             |
| currentPage | Integer | 当前页【对应api文档的**pageNumber**字段】                                                                                                     |
| totalItems  | Integer | 记录总条数                                                                                                                             |
| totalPage   | Integer | 总页数【对应api文档的**totalPages**字段】                                                                                                     |

[**VodGetVideoList参数描述**](#/listService.md?id=polyv15)

| 参数名            | 类型           | 说明                                                                                                                               |
| -------------- | ------------ | -------------------------------------------------------------------------------------------------------------------------------- |
| videoId        | String       | 视频id【对应api文档的**vid**字段】                                                                                                          |
| basicInfo      | BasicInfo    | 视频基础信息【详见[BasicInfo参数描述](https://git.polyv.net/help-center/document-center/-/blob/master/vod/java/listService.md?id=polyv16)】    |
| metaData       | MetaData     | 元数据【详见[MetaData参数描述](https://git.polyv.net/help-center/document-center/-/blob/master/vod/java/listService.md?id=polyv17)】        |
| transcodeInfos | Array        | 转码信息【详见[TranscodeInfos参数描述](https://git.polyv.net/help-center/document-center/-/blob/master/vod/java/listService.md?id=polyv18)】 |
| snapshotInfo   | SnapshotInfo | 截图信息【详见[SnapshotInfo参数描述](https://git.polyv.net/help-center/document-center/-/blob/master/vod/java/listService.md?id=polyv19)】   |

[**BasicInfo参数描述**](#/listService.md?id=polyv16)

| 参数名          | 类型      | 说明                           |
| ------------ | ------- | ---------------------------- |
| title        | String  | 视频标题                         |
| description  | String  | 视频描述                         |
| duration     | Double  | 源视频时长，单位：秒                   |
| coverURL     | String  | 首图地址，大图                      |
| creationTime | Date    | 创建时间，格式：yyyy-MM-dd HH:mm:ss  |
| updateTime   | Date    | 更新时间，格式：yyyy-MM-dd HH:mm:ss  |
| size         | Long    | 源文件大小，单位：Bytes               |
| status       | Integer | 视频状态码                        |
| categoryId   | String  | 分类id【对应api文档的**cateId**字段】   |
| categoryName | String  | 分类名称【对应api文档的**cateName**字段】 |
| tags         | String  | 标签                           |
| uploader     | String  | 上传者                          |

[**MetaData参数描述**](#/listService.md?id=polyv17)

| 参数名      | 类型      | 说明               |
| -------- | ------- | ---------------- |
| size     | Long    | 源文件大小，单位：Bytes   |
| format   | String  | 视频容器类型，如mp4、flv等 |
| duration | Double  | 源视频时长，单位：秒       |
| bitrate  | Integer | 视频码率，单位：bps      |
| fps      | Integer | 视频帧率             |
| height   | Integer | 分辨率高，单位：px       |
| width    | Integer | 分辨率宽，单位：px       |
| codec    | String  | 编码格式，如h264、h265等 |

[**TranscodeInfos参数描述**](#/listService.md?id=polyv18)

| 参数名        | 类型      | 说明                                     |
| ---------- | ------- | -------------------------------------- |
| playUrl    | String  | 播放地址                                   |
| definition | String  | 清晰度，SOURCE:原清晰度,LD:普清,SD:标清,HD:高清      |
| bitrate    | Integer | 码率kbps                                 |
| duration   | Double  | 时长，秒                                   |
| encrypt    | Boolean | 加密视频为true，非加密为false                    |
| format     | String  | 转码格式，如mp4、flv、pdx、hls                  |
| fps        | Integer | 视频帧率                                   |
| height     | Integer | 分辨率高，单位：px                             |
| width      | Integer | 分辨率宽，单位：px                             |
| status     | String  | 视频状态, normal:可以正常播放,unavailable:不能正常播放 |

[**SnapshotInfo参数描述**](#/listService.md?id=polyv19)

| 参数名      | 类型    | 说明      |
| -------- | ----- | ------- |
| imageUrl | Array | 截图url数组 |

<br>
