搜索视频

接口URL

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

接口说明

(接口调用有频率限制,详细请查看)

1、接口用于搜索视频
2、接口支持https

请求方式

GET,POST

请求参数

参数名 必选 类型 说明
appId string 子账号appId
timestamp long 当前13位当前时间戳,3分钟有效
sign string 签名值,32位大写MD5值
cataId long 视频分类ID
title string 按标题搜索
uploader string 上传者
status string 视频状态
containSubCate string 是否包含子分类, Y 包含, N 不包含
startTime long 按创建时间范围查询,起始时间戳,13位时间戳
endTime long 结束时间戳,13位时间戳
page int 页码,默认为1
pageSize int 页面大小,默认为10
sort string 排序creationTimeDesc或creationTimeAsc

响应成功JSON示例:

// 请求成功
{
    "requestId": "5ede3d23-45f0-4661-99be-e95d07daf049",
    "code": 200,
    "status": "success",
    "error": null,
    "data": {
        "pageNumber": 5,
        "totalPages": 2,
        "pageSize": 7,
        "contents": [
              "vid": "",
              "basicInfo": {
                "title": "",
                "description": "",
                "duration": 0.00,
                "coverURL": "",
                "creationTime": "",
                "updateTime": "",
                "size": 0,
                "status": 0,
                "cateId": 0,
                "cateName": "",
                "tags": "",
                "uploader": ""
              }
        ],
        "totalItems": 4
      }
    }
}

响应失败JSON示例:

// 时间戳错误
{
    "requestId": "5ede3d23-45f0-4661-99be-e95d07daf049",
    "code": 400,
    "status": "error",
    "error": {
        "code": 100,
        "desc": "invalid timestamp"
    },
    "data": null
}
// appId不正确
{
    "requestId": "5ede3d23-45f0-4661-99be-e95d07daf049",
    "code": 400,
    "status": "error",
    "error": {
        "code": 101,
        "desc": "application not exist"
    },
    "data": null
}
// 子账号不存在
{
    "requestId": "5ede3d23-45f0-4661-99be-e95d07daf049",
    "code": 400,
    "status": "error",
    "error": {
        "code": 102,
        "desc": "user children not exist"
    },
    "data": null
}
// 子账号过期
{
    "requestId": "5ede3d23-45f0-4661-99be-e95d07daf049",
    "code": 403,
    "status": "error",
    "error": {
        "code": 103,
        "desc": "user children expired"
    },
    "data": null
}
// 签名错误
{
    "requestId": "5ede3d23-45f0-4661-99be-e95d07daf049",
    "code": 403,
    "status": "error",
    "error": {
        "code": 104,
        "desc": "invalid signature"
    },
    "data": null
}
// 账号权限不足
{
    "requestId": "5ede3d23-45f0-4661-99be-e95d07daf049",
    "code": 403,
    "status": "error",
    "error": {
        "code": 105,
        "desc": "permission limited"
    },
    "data": null
}
// 无法操作此分类,权限不足
{
    "requestId": "5ede3d23-45f0-4661-99be-e95d07daf049",
    "code": 400,
    "status": "error",
    "error": {
        "code": 106,
        "desc": "category limited"
    },
    "data": null
}
// 分类id不存在
{
    "requestId": "5ede3d23-45f0-4661-99be-e95d07daf049",
    "code": 400,
    "status": "error",
    "error": {
        "code": 3001,
        "desc": "category not exist"
    },
    "data": null
}

字段说明

字段 说明
requestId 本次请求的ID
code 响应http状态码
status 状态
error.code 错误码
error.desc 错误描述
data 返回结果集
data.pageNumber 当前的页数
data.pageSize 每页条数
data.totalItems 总的条数
data.contents 查询的结果列表
data.content[0].vid 视频id
data.contents[0].basicInfo.title 视频标题
data.contents[0].basicInfo.description 视频描述
data.contents[0].basicInfo.duration 源视频时长,单位:秒
data.contents[0].basicInfo.coverURL 首图地址,大图
data.contents[0].basicInfo.creationTime 创建时间
data.contents[0].basicInfo.updateTime 更新时间
data.contents[0].basicInfo.size 源文件大小,单位:Bytes
data.contents[0].basicInfo.status 视频状态码
data.contents[0].basicInfo.cateId 分类id, 如1为根目录
data.contents[0].basicInfo.cateName 分类名称
data.contents[0].basicInfo.tags 标签
data.contents[0].basicInfo.uploader 上传者
视频状态码 含义
60/61 已发布
10 等待编码
20 正在编码
50 等待审核
51 审核不通过
-1 已删除

java请求示例

public void testListVideo() {
        String url = "https://api.polyv.net/v3/video/list-video";
        // appId和加密串
        String appId = "xxxxxxx";
        String appSecret = "xxxxxxxxxxxxxxxxxx";

        long cataId = 1594482470001L;
        Map<String, String> params = new HashMap<>();
        params.put("cateId", String.valueOf(cataId));
        params.put("title", "标题1");
        params.put("uploader", "xxx");
        params.put("status", "60");
        params.put("containSubCate", "Y");
        params.put("page", String.valueOf(1));
        params.put("pageSize", String.valueOf(10));
        params.put("sort", "creationTimeDesc");
        // 调用Polyv的工具类方法设置sign
        PolyvTool.setLiveSign(params, appId, appSecret);
        String content = HttpClientUtil.getInstance()
                .sendHttpGet(url + "?" +  PolyvTool.mapJoinEncode(params));
        System.out.println(content);
}

签名规则及工具文件代码

https://dev.polyv.net/2020/liveproduct/l-api/rule/live-api-java-detail/

以上内容是否对您有帮助?根本没有帮助文档较差文档一般文档不错文档很好
Loading...