获取最热视频列表

点击这里查看旧版

接口URL

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

接口说明

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

获取用户最热门视频的列表

返回结果支持格式

XML/JSON

请求方式

POST,GET

请求数限制

TRUE

请求参数

参数名 必选 类型及范围 说明
userid true string 用户id
ptime true string 当前时间毫秒级时间戳(13位,三分钟有效)
pageNum true int 取第几页
numPerPage true int 平均每页多少条数据
sign true string 非业务参数,签名,40位大写SHA1值
jsonp false string 例如,正常情况{error:0,data:””},加 jsonp=a后返回a({error:0,data:””})
format false string 默认返回json格式,如果format=xml返回xml格式

返回结果

<xml> 
  <code>200</code>  
  <status>success</status>  
  <message>success</message>  
  <data> 
    <videoDetail> 
      <images_b>3828390191/5/38283901913ea95224af2bbd9e990ea5_0_b.jpg</images_b>  
      <images_b>3828390191/5/38283901913ea95224af2bbd9e990ea5_1_b.jpg</images_b>  
      <images_b>3828390191/5/38283901913ea95224af2bbd9e990ea5_2_b.jpg</images_b>  
      <images_b>3828390191/5/38283901913ea95224af2bbd9e990ea5_3_b.jpg</images_b>  
      <images_b>3828390191/5/38283901913ea95224af2bbd9e990ea5_4_b.jpg</images_b>  
      <images_b>3828390191/5/38283901913ea95224af2bbd9e990ea5_5_b.jpg</images_b>  
      <images>3828390191/5/38283901913ea95224af2bbd9e990ea5_0.jpg</images>  
      <images>3828390191/5/38283901913ea95224af2bbd9e990ea5_1.jpg</images>  
      <images>3828390191/5/38283901913ea95224af2bbd9e990ea5_2.jpg</images>  
      <images>3828390191/5/38283901913ea95224af2bbd9e990ea5_3.jpg</images>  
      <images>3828390191/5/38283901913ea95224af2bbd9e990ea5_4.jpg</images>  
      <images>3828390191/5/38283901913ea95224af2bbd9e990ea5_5.jpg</images>  
      <tag/>  
      <mp4>http://mpv.videocc.net/3828390191/5/38283901913ea95224af2bbd9e990ea5_1.mp4</mp4>  
      <title>0001.优酷网-【经典回顾】加州旅馆 2004版 中英字幕 老鹰乐队[超清版]-0003</title>  
      <df>3</df>  
      <times>0</times>  
      <vid>38283901913ea95224af2bbd9e990ea5_3</vid>  
      <mp4_1>http://mpv.videocc.net/3828390191/5/38283901913ea95224af2bbd9e990ea5_1.mp4</mp4_1>  
      <mp4_2>http://mpv.videocc.net/3828390191/5/38283901913ea95224af2bbd9e990ea5_2.mp4</mp4_2>  
      <mp4_3>http://mpv.videocc.net/3828390191/5/38283901913ea95224af2bbd9e990ea5_3.mp4</mp4_3>  
      <cataid>1</cataid>  
      <swf_link>http://player.polyv.net/videos/38283901913ea95224af2bbd9e990ea5_3.swf</swf_link>  
      <status>61</status>  
      <seed>0</seed>  
      <flv1>http://plvod01.videocc.net/3828390191/5/38283901913ea95224af2bbd9e990ea5_1.flv</flv1>  
      <flv2>http://plvod01.videocc.net/3828390191/5/38283901913ea95224af2bbd9e990ea5_2.flv</flv2>  
      <flv3>http://plvod01.videocc.net/3828390191/5/38283901913ea95224af2bbd9e990ea5_3.flv</flv3>  
      <sourcefile/>  
      <playerwidth>600</playerwidth>  
      <default_video>http://plvod01.videocc.net/3828390191/5/38283901913ea95224af2bbd9e990ea5_3.flv</default_video>  
      <duration>00:02:01</duration>  
      <first_image>http://img.videocc.net/uimage/3/3828390191/first_image/a15c4fe5-9fdc-4a38-adc0-2e6097757fbb_s.jpg</first_image>  
      <original_definition>1104x622</original_definition>  
      <context/>  
      <playerheight>337</playerheight>  
      <ptime>2017-04-25 11:35:06</ptime>  
      <source_filesize>22502693</source_filesize>  
      <filesize1>4755814</filesize1>  
      <filesize2>8694257</filesize2>  
      <filesize3>21784017</filesize3>  
      <md5checksum>8c6a35b5e92f84437c56de6f40b39973</md5checksum>  
      <hls>http://hls.videocc.net/3828390191/3/38283901913ea95224af2bbd9e990ea5_1.m3u8</hls>  
      <hls>http://hls.videocc.net/3828390191/3/38283901913ea95224af2bbd9e990ea5_2.m3u8</hls>  
      <hls>http://hls.videocc.net/3828390191/3/38283901913ea95224af2bbd9e990ea5_3.m3u8</hls>  
      <previewVid>v63c44pl69mnc04m6l6512ck4468m41cl_6</previewVid>  
      <uploader> 
        <email>test2@zzs.com</email>  
        <name>test2</name>  
        <role>上传者</role> 
      </uploader>
      <keepsource>0<keepsource/>
      <hlsLevel>open</hlsLevel>
      <cataname>新建分类测试</cataname>
    </videoDetail> 
  </data> 
</xml>

JSON示例

{
    code: 200,
    status: "success",
    message: "success",
    data: [{
        tag: "",
        mp4: "http://mpv.videocc.net/7d26575efe/f/7d26575efe097ad66523d19b094c8a8f_1.mp4",
        title: "Wildlife",
        df: 3,
        times: "30",
        vid: "7d26575efe097ad66523d19b094c8a8f_7",
        mp4_1: "http://mpv.videocc.net/7d26575efe/f/7d26575efe097ad66523d19b094c8a8f_1.mp4",
        mp4_2: "http://mpv.videocc.net/7d26575efe/f/7d26575efe097ad66523d19b094c8a8f_2.mp4",
        mp4_3: "http://mpv.videocc.net/7d26575efe/f/7d26575efe097ad66523d19b094c8a8f_3.mp4",
        cataid: "1491449370131",
        swf_link: "http://player.polyv.net/videos/7d26575efe097ad66523d19b094c8a8f_7.swf",
        status: "61",
        seed: 1,
        playerwidth: "600",
        duration: "00:00:30",
        first_image: "http://img.videocc.net/uimage/7/7d26575efe/f/7d26575efe097ad66523d19b094c8a8f_5.jpg",
        original_definition: "1280x720",
        context: "",
        playerheight: "337",
        ptime: "2017-04-06 15:23:36",
        source_filesize: 26246026,
        filesize: [
            1272725,
            2279413,
            5108761
        ],
        md5checksum: "d8c2eafd90c266e19ab9dcacc479f8af",
        hls: [
            "http://hls.videocc.net/7d26575efe/7/7d26575efe097ad66523d19b094c8a8f_1.m3u8",
            "http://hls.videocc.net/7d26575efe/7/7d26575efe097ad66523d19b094c8a8f_2.m3u8",
            "http://hls.videocc.net/7d26575efe/7/7d26575efe097ad66523d19b094c8a8f_3.m3u8"
        ],
        uploader: {
                "email": "test@test.com",
                "name": "cest",
                "role": "上传者"
         },
         keepsource: "0",
         cataname: "web加密"
        }]
}

字段说明

字段 说明
code 请求返回状态码
status 请求返回状态
message 请求返回信息
tag 视频标签
mp4 MP4源文件
title 标题
df 视频码率数
times 播放次数
vid 视频id
mp4_1 流畅码率mp4格式视频地址
mp4_2 高清码率mp4格式视频地址
mp4_3 超清码率mp4格式视频地址
cataid 分类id, 如1为根目录
swf_link 返回视频flash链接
status 视频状态码(data中的status)
seed 加密视频为1,非加密为0
playerwidth 视频宽度
duration 时长
first_image 视频首图
original_definition 最佳分辨率
context 视频描述
playerheight 视频高度
ptime 视频上传日期
source_filesize 源视频文件大小
md5checksum 上传到POLYV云平台的视频源文件的MD5值,可以用来校验是否上传错误或完整
hls 流畅、高清、超清清晰度的m3u8
total 视频总数
keepsource 是否为源文件,否:0,是:1
uploader.email 上传者邮箱
uploader.name 上传者名称
uploader.role 上传者角色,如管理员,上传者,主账号
hlsLevel 加密等级 open:非授权加密 web:web授权 app:app授权 wxa_app:小程序授权
cataname 分类名称

PHP示例代码

<?php
  header("Content-type: text/html; charset=utf-8");
  $userid="3828390191";
  $format="xml";
  $jsonp="";//(注意如果这里如果没有jsonp,则不需要拼接&jsonp=参数)
  $numPerPage=2;
  $pageNum=1;
  $ptime=time()*1000;//13位
  $secretkey="tIQp4ATe9Z";
  if (empty($jsonp)) {
      $str="format=".$format."&numPerPage=".$numPerPage."&pageNum=".$pageNum."&ptime=".$ptime.$secretkey;
      //echo "jsonp为空!";
      //echo $str.'';
  }else{
      $str="format=".$format."&jsonp=".$jsonp."&numPerPage=".$numPerPage."&pageNum=".$pageNum."&ptime=".$ptime.$secretkey;
  }
  $hash=strtoupper(sha1($str));
  //echo $hash.'';
  $url="http://api.polyv.net/v2/video/{$userid}/get-host-list";
  $post_data = array (
      "format" => $format,
      "jsonp" => $jsonp,
      "numPerPage" => $numPerPage,
      "pageNum" => $pageNum,
      "ptime" => $ptime,
      "sign" => $hash,
  );
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  // post数据
  curl_setopt($ch, CURLOPT_POST, 1);
  // post的变量
  curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
  $output = curl_exec($ch);
  curl_close($ch);
  //打印获得的数据
  print_r($output);
?>

签名规则:

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

1、请求参数为

ptime = "1493026932000"
format = "json"
pageNum = "1"
numPerPage = "2"

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

format = "json"
numPerPage = "2"
pageNum = "1"
ptime = "1493026932000"

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

format=json&numPerPage=2&pageNum=1&ptime=1493026932000tIQp4ATe9Z

4、生成签名sign

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