根据授权播放开关状态查询视频

接口URL

http://api.polyv.net/v2/video/{userid}/list

接口说明

根据授权播放开关状态查询视频

支持格式

JSON

请求方式

GET

请求参数

参数名 必选 类型及范围 说明
ptime true string 当前时间的毫秒级时间戳(13位),30分钟内有效
sign true string 签名
userid true string 用户id(拼接在url,无需另外传参数)
playauth true number 是否开启(开启为1,没开启为0)
numPerPage false int 每页取多少条数据(默认为99)
pageNum false int 取第几页(默认为1)

注意事项

所有有值的参数,按照字母排序方式以key=value&key=value的格式串起来,最后拼上secretkey,以SHA-1方式加密并全部大写化。(注意,当参数没有传递,或者传递了空值,sign不需要将此参数计算进去)

例如:api传递了ptime,vid。ptime为1,vid为test1,userid对应用户的secretkey为test2
则sign的值为:ptime=1&vid=test1test2经过SHA-1加密后大写化为: C2B1558D697EA3AF4ED2FC90152751860C1E2163。

返回错误结果JSON示例

{
  "code": 400,
  "status": "error",
  "message": "ptime is too old.",
  "data": ""
}

返回正确结果JSON示例

{
  "code": 200,
  "status": "200",
  "message": "195",
  "data": [
    {
      "duration": "00:02:28",
      "vid": "8l8v64820da93146cfb86697d90c7f63_8",
      "date": "2017-11-17 14:39",
      "uploader": "主账号",
      "cataid": "1490846401832",
      "sourceFileSize": "15.95 MB",
      "firstImage": "http://img.videocc.net/uimage/8/8l8v64820d/3/8l8v64820da93146cfb86697d90c7f63_0.jpg",
      "cataname": "4",
      "title": "d带宽s(1).mp4",
      "status": "审核不通过"
    },
    {
      "duration": "00:00:02",
      "vid": "8l8v64820d40d49375523f393bfa53aa_8",
      "date": "2017-11-17 14:04",
      "uploader": "主账号",
      "cataid": "1494991264900",
      "sourceFileSize": "225.08 KB",
      "firstImage": "http://img.videocc.net/uimage/8/8l8v64820d/a/8l8v64820d40d49375523f393bfa53aa_0.jpg",
      "cataname": "<script>alert()</script>",
      "title": "pt_1450256414551.mp4",
      "status": "已发布"
    },
    {
      "duration": "00:59:54",
      "vid": "8l8v64820d727ad8dcbd74c53d4e47d6_8",
      "date": "2017-10-11 11:42",
      "uploader": "主账号",
      "cataid": "1461120809847",
      "sourceFileSize": "227.61 MB",
      "firstImage": "http://img.videocc.net/uimage/8/8l8v64820d/6/8l8v64820d727ad8dcbd74c53d4e47d6_5.jpg",
      "cataname": "uu",
      "title": "wKjJ0VZ6d6zxwMtWCNCEmYWT2wk757",
      "status": "已发布"
    },
    {
      "duration": "00:01:14",
      "vid": "8l8v64820df4e2f48bd5d9b65690c9d4_8",
      "date": "2017-07-20 14:50",
      "uploader": "主账号",
      "cataid": "1407743526800",
      "sourceFileSize": "23.57 MB",
      "firstImage": "http://img.videocc.net/uimage/8/8l8v64820d/4/8l8v64820df4e2f48bd5d9b65690c9d4_5.jpg",
      "cataname": "广告分类11111111111111111111",
      "title": "1122daffd",
      "status": "已发布"
    },
    {
      "duration": "00:05:05",
      "vid": "8l8v64820dcad904c482b2edba9be34f_8",
      "date": "2017-11-01 11:31",
      "uploader": "API",
      "cataid": "1407743526800",
      "sourceFileSize": "38.42 MB",
      "firstImage": "http://img.videocc.net/uimage/8/8l8v64820d/f/8l8v64820dcad904c482b2edba9be34f_0.jpg",
      "cataname": "广告分类11111111111111111111",
      "title": "朴树 - 平凡之路-test.mkv",
      "status": "已发布"
    }
  ]
}

返回结果data表示成功修改的数量.

字段说明

字段 说明
code 返回码
status 返回状态
message 返回信息
data 操作结果

响应代码与响应信息对应

code message data 说明
400 sign can not be empty. 加密串为空
400 ptime is too old. 时间戳过期
400 ptime is illegal. ptime超出当前时间3分钟
400 Could not find user by userid. userid不存在
400 the sign is not right. 加密串错误
500 查询失败. 后台抛异常
200 视频列表的总数 分页查询到的视频列表 查询成功

PHP示例代码

<?php
header("Content-type: text/html; charset=utf-8");
$userid="3828390191";
//$jsonp="a";
$ptime=time()*1000;//13位
$playauth="1";
$secretkey="tIQp4ATe9Z";
if(empty($jsonp)){
  $str="playauth=".$playauth."&ptime=".$ptime.$secretkey;
}else{
  $str="jsonp=".$jsonp."&playauth=".$playauth."&ptime=".$ptime.$secretkey;
}
echo $str.'';
$hash=strtoupper(sha1($str));
echo $hash.'';
$url="http://api.polyv.net/v2/video/{$userid}/list?playauth={$playauth}&ptime={$ptime}&sign={$hash}";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$output = curl_exec($ch);
curl_close($ch);
//打印获得的数据
print_r($output);
?>

签名规则:

将非空的请求参数按照参数名字典顺序排列,连接参数名与参数值,并在尾部加上secretkey,生成40位大写SHA1值,作为sign。 以下是示例过程:

1、请求参数为

"ptime" = "1493188350000"
"playauth" = "1"

2、将请求参数按照参数名字典顺序排列

"playauth" = "1"
"ptime" = "1493188350000"

3、连接字符串
连接参数名与参数值,并在尾部加上secretkey(secretkey的值为tIQp4ATe9Z),如下:

playauth=1&ptime=1493188350000tIQp4ATe9Z

4、生成签名sign

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