获取最热视频列表

点击这里查看旧版

接口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/>
<data>
<video>
<title>58.flv</title>
<times>699</times>
<vid>e2e84a73838206ff3b459cd5f05dbaaa_e</vid>
<tag/>
<duration>00:00:15</duration>
<swf_link>http://player.polyv.net/videos/e2e84a73838206ff3b459cd5f05dbaaa_e.swf</swf_link>
<first_image>
e2e84a7383/a/e2e84a73838206ff3b459cd5f05dbaaa_0.jpg
</first_image>
<context/>
<ptime>1421227460244</ptime>
</video>
<video>
<title>心态的能量</title>
<times>267</times>
<vid>e2e84a73839658998dc52f06ee0c3ca0_e</vid>
<tag>心,灵,鸡,汤</tag>
<duration>00:21:42</duration>
<swf_link>http://player.polyv.net/videos/e2e84a73839658998dc52f06ee0c3ca0_e.swf</swf_link>
<first_image>
e2e84a7383/first_image/cdc061f4-fc44-4b6e-926b-a9c4f434068e_s.jpg
</first_image>
<context/>
<ptime>1410225867567</ptime>
</video>
<video>
<title>jstest</title>
<times>210</times>
<vid>e2e84a73833cdbc84d68161b204f6af3_e</vid>
<tag/>
<duration>00:04:57</duration>
<swf_link>http://player.polyv.net/videos/e2e84a73833cdbc84d68161b204f6af3_e.swf</swf_link>
<first_image>
e2e84a7383/3/e2e84a73833cdbc84d68161b204f6af3_0.jpg
</first_image>
<context/>
<ptime>1419235390591</ptime>
</video>
<video>
<title>osc-02又拍云</title>
<times>139</times>
<vid>e2e84a738353143988a98e870463d0b1_e</vid>
<tag/>
<duration>00:28:53</duration>
<swf_link>http://player.polyv.net/videos/e2e84a738353143988a98e870463d0b1_e.swf</swf_link>
<first_image>
e2e84a7383/1/e2e84a738353143988a98e870463d0b1_0.jpg
</first_image>
<context/>
<ptime>1427359138265</ptime>
</video>
<video>
<title>2-账单 在线观看 - 酷6视频_0</title>
<times>130</times>
<vid>e2e84a7383588b2fcb5f9453b12d26ce_e</vid>
<tag/>
<duration>00:04:56</duration>
<swf_link>http://player.polyv.net/videos/e2e84a7383588b2fcb5f9453b12d26ce_e.swf</swf_link>
<first_image>
e2e84a7383/e/e2e84a7383588b2fcb5f9453b12d26ce_0.jpg
</first_image>
<context/>
<ptime>1434100174562</ptime>
</video>
<video>
<title>问答</title>
<times>114</times>
<vid>e2e84a73834420049e9227c4bd1ddbc5_e</vid>
<tag>心灵鸡汤</tag>
<duration>00:00:30</duration>
<swf_link>http://player.polyv.net/videos/e2e84a73834420049e9227c4bd1ddbc5_e.swf</swf_link>
<first_image>
e2e84a7383/5/e2e84a73834420049e9227c4bd1ddbc5_0.jpg
</first_image>
<context>动物</context>
<ptime>1410227047345</ptime>
</video>
<video>
<title>微电影《万花筒》 在线观看 - 酷6视频_0</title>
<times>109</times>
<vid>e2e84a73831904b40250c484d8d5febf_e</vid>
<tag/>
<duration>00:04:57</duration>
<swf_link>http://player.polyv.net/videos/e2e84a73831904b40250c484d8d5febf_e.swf</swf_link>
<first_image>
e2e84a7383/f/e2e84a73831904b40250c484d8d5febf_0.jpg
</first_image>
<context/>
<ptime>1427358984175</ptime>
</video>
<video>
<title>课件</title>
<times>104</times>
<vid>e2e84a7383a3276af77d75de601b492f_e</vid>
<tag>心,灵,鸡,汤</tag>
<duration>00:00:15</duration>
<swf_link>http://player.polyv.net/videos/e2e84a7383a3276af77d75de601b492f_e.swf</swf_link>
<first_image>
e2e84a7383/f/e2e84a7383a3276af77d75de601b492f_0.jpg
</first_image>
<context/>
<ptime>1410227027868</ptime>
</video>
<video>
<title>
【Youtube奇趣精选】2分钟灾难大片!最后的结尾竟然。。。—在线播放—优酷网,视频高清在线观看_0
</title>
<times>94</times>
<vid>e2e84a73839ec97a51c368d746dd2d09_e</vid>
<tag/>
<duration>00:00:15</duration>
<swf_link>http://player.polyv.net/videos/e2e84a73839ec97a51c368d746dd2d09_e.swf</swf_link>
<first_image>
e2e84a7383/9/e2e84a73839ec97a51c368d746dd2d09_0.jpg
</first_image>
<context/>
<ptime>1410940885598</ptime>
</video>
<video>
<title>90d87625bf71ffef9e55c51ea08b9844.mp4</title>
<times>93</times>
<vid>e2e84a7383abdd082984818d4ac96048_e</vid>
<tag/>
<duration>00:02:34</duration>
<swf_link>http://player.polyv.net/videos/e2e84a7383abdd082984818d4ac96048_e.swf</swf_link>
<first_image>
e2e84a7383/8/e2e84a7383abdd082984818d4ac96048_1.jpg
</first_image>
<context>90d87625bf71ffef9e55c51ea08b9844.mp4</context>
<ptime>1419922512446</ptime>
</video>
</data>
</xml>

JSON示例

{
  code: 200,
  status: "success",
  message: "success",
  data: [
  {
    mp4: "http://mpv.videocc.net/3828390191/4/3828390191dfaa06cfcba9c3d65b58e4_1.mp4",
    title: "标题我是随便写的..",
    df: 3,
    times: "295",
    vid: "3828390191dfaa06cfcba9c3d65b58e4_3",
    mp4_1: "http://mpv.videocc.net/3828390191/4/3828390191dfaa06cfcba9c3d65b58e4_1.mp4",
    mp4_2: "http://mpv.videocc.net/3828390191/4/3828390191dfaa06cfcba9c3d65b58e4_2.mp4",
    mp4_3: "http://mpv.videocc.net/3828390191/4/3828390191dfaa06cfcba9c3d65b58e4_3.mp4",
    cataid: "1",
    swf_link: "http://player.polyv.net/videos/3828390191dfaa06cfcba9c3d65b58e4_3.swf",
    status: "60",
    seed: 0,
    playerwidth: "600",
    duration: "00:07:10",
    first_image: "http://img.videocc.net/uimage/3/3828390191/4/3828390191dfaa06cfcba9c3d65b58e4_0.jpg",
    original_definition: "1104x622",
    playerheight: "337",
    ptime: "2014-06-20 18:55:08",
    source_filesize: 65073207,
    filesize: [
      17230568,
      31694154,
      72074370
    ],
    md5checksum: "db33499bc1572d6f1f2fd743512a031f",
    hls: [
      "http://hls.videocc.net/3828390191/3/3828390191dfaa06cfcba9c3d65b58e4_1.m3u8",
      "http://hls.videocc.net/3828390191/3/3828390191dfaa06cfcba9c3d65b58e4_2.m3u8",
      "http://hls.videocc.net/3828390191/3/3828390191dfaa06cfcba9c3d65b58e4_3.m3u8"
    ]
    },
    {
    tag: "",
    mp4: "http://mpv.videocc.net/3828390191/c/38283901919cc9bd1e6a9f6dfdee851c_1.mp4",
    title: "字幕00",
    df: 3,
    times: "106",
    vid: "38283901919cc9bd1e6a9f6dfdee851c_3",
    mp4_1: "http://mpv.videocc.net/3828390191/c/38283901919cc9bd1e6a9f6dfdee851c_1.mp4",
    mp4_2: "http://mpv.videocc.net/3828390191/c/38283901919cc9bd1e6a9f6dfdee851c_2.mp4",
    mp4_3: "http://mpv.videocc.net/3828390191/c/38283901919cc9bd1e6a9f6dfdee851c_3.mp4",
    cataid: "1",
    swf_link: "http://player.polyv.net/videos/38283901919cc9bd1e6a9f6dfdee851c_3.swf",
    status: "60",
    seed: 1,
    playerwidth: "600",
    duration: "00:03:58",
    first_image: "http://img.videocc.net/uimage/3/3828390191/c/38283901919cc9bd1e6a9f6dfdee851c_2.jpg",
    original_definition: "1920x1080",
    context: "",
    playerheight: "337",
    ptime: "2016-03-23 18:24:32",
    source_filesize: 59982227,
    filesize: [
      9390640,
      16800894,
      37259464
    ],
    md5checksum: "5ec2c17e348e14c5a3a39283078dd823",
    hls: [
      "http://hls.videocc.net/3828390191/3/38283901919cc9bd1e6a9f6dfdee851c_1.m3u8",
      "http://hls.videocc.net/3828390191/3/38283901919cc9bd1e6a9f6dfdee851c_2.m3u8",
      "http://hls.videocc.net/3828390191/3/38283901919cc9bd1e6a9f6dfdee851c_3.m3u8"
    ]
  }
  ],
  total: 22
}

字段说明

字段 说明
error 错误提示
swf_link 返回flash连接
duration 返回时长
title 标题
first_image 视频图片
times 点击次数
tag 标签
context 内容
ptime 上传时间
vid 视频id

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...