帮助中心

点播管理API

上传视频

uploadfile

作用:上传本地视频

URL:

http://v.polyv.net/uc/services/rest?method=uploadfile

1.支持格式

JSON

2.HTTP请求方式

POST

3.请求数限制

TRUE

4.请求参数

参数名 必选 类型及范围 说明
writetokentruestring 用户的上传钥匙
JSONRPCtruestringjson格式,{“title”: “标题”, “tag”:“标签”,”desc”:“描述”}
Filedatatruefilefile类型,支持的文件格式为:.flv,.avi,.mpg,.mp4,.wmv,.mov,.3gp,.asf
cataid falselong设定上传视频的分类,分类的id可以在“视频管理”——“内容分类”中获取,如下图所示。cataid为catatree的最后一个long型的整数,catatree由cataid组成。当cataid值为1时,表示用户上传空间的根目录。
watermarkfalsestring 水印图片的URL,图片格式必须是png格式
luping falseint是否录屏优化。当值为1时,上传的视频不再采取默认的压缩编码机制,视频尺寸不再压缩,保证视频的清晰度。默认值为0
format false string默认返回json格式,如果format=xml返回xml格式
jsonp false string例如,正常情况{error:0,data:””},加 jsonp=a后返回a({error:0,data:””})

5.返回错误列表

返回 说明
0 无错误
1 找不到writetoken关联的user
2 文件为空或者writetoken为空
3 提交的json名字JSONRPC为null
4 提交文件格式不正确
5 readtoken为空
6 分页输入出错
7 vid不能为空
8 找不到方法名

6.返回结果

<xml>
  <error>0</error>
  <data>
  <video>
  <images_b>
    <image>http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_0_b.jpg</image>
    <image>http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_1_b.jpg</image>
    <image>http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_2_b.jpg</image>
    <image>http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_3_b.jpg</image>
    <image>http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_4_b.jpg</image>
    <image>http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_5_b.jpg</image>
    <image>http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_6_b.jpg</image>
    <image>http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_7_b.jpg</image>
  </images_b>
  <tag/>
  <mp4>http://mpv.videocc.net/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_1.mp4</mp4>
  <title>Youtube-Apple - Introducing iPhone 6 and iPhone 6 Plus_720P</title>
  <df>3</df>
  <times>3</times>
  <mp4_1>http://mpv.videocc.net/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_1.mp4</mp4_1>
  <mp4_3>http://mpv.videocc.net/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_3.mp4</mp4_3>
  <vid>d81a899efaf1148b7cb87418cf3cf01a_d</vid>
  <mp4_2>http://mpv.videocc.net/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_2.mp4</mp4_2>
  <cataid>1409192674947</cataid>
  <swf_link>http://player.polyv.net/videos/d81a899efaf1148b7cb87418cf3cf01a_d.swf</swf_link>
  <status>60</status>
  <seed>1</seed>
  <flv2>http://plvod01.videocc.net/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_2.plv</flv2>
  <hls3>http://v.polyv.net/hls/d81a899efaf1148b7cb87418cf3cf01a_d.m3u8?df=3</hls3>
  <flv3>http://plvod01.videocc.net/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_3.plv</flv3>
  <flv1>http://plvod01.videocc.net/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_1.plv</flv1>
  <sourcefile>http://mpv.videocc.net/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a.mp4</sourcefile>
  <playerwidth>600</playerwidth>
  <hlsIndex>http://v.polyv.net/hlsIndex/d81a899efaf1148b7cb87418cf3cf01a_d.m3u8</hlsIndex>
  <hls2>http://v.polyv.net/hls/d81a899efaf1148b7cb87418cf3cf01a_d.m3u8?df=2</hls2>
  <default_video>http://plvod01.videocc.net/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_2.plv</default_video>
  <hls1>http://v.polyv.net/hls/d81a899efaf1148b7cb87418cf3cf01a_d.m3u8?df=1</hls1>
  <duration>00:06:23</duration>
  <first_image>http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_1.jpg</first_image>
  <original_definition>1280x720</original_definition>
  <context/>
  <images>
    <image>http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_0.jpg</image>
    <image>http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_1.jpg</image>
    <image>http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_2.jpg</image>
    <image>http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_3.jpg</image>
    <image>http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_4.jpg</image>
    <image>http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_5.jpg</image>
    <image>http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_6.jpg</image>
    <image>http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_7.jpg</image>
  </images>
  <playerheight>370</playerheight>
  <ptime>2014-09-15 14:26:47</ptime>
  </video>
  </data>
  </xml>

JSON示例

{
  "error":"0",
  "data":[{
    "images_b":"[\"http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_0_b.jpg\",\"http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_1_b.jpg\",\"http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_2_b.jpg\",\"http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_3_b.jpg\",\"http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_4_b.jpg\",\"http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_5_b.jpg\",\"http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_6_b.jpg\",\"http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_7_b.jpg\"]",
    "tag":"",
    "mp4":"http://mpv.videocc.net/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_1.mp4",
    "title":"Youtube-Apple - Introducing iPhone 6 and iPhone 6 Plus_720P",
    "df":3,
    "times":"3",
    "mp4_1":"http://mpv.videocc.net/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_1.mp4",
    "mp4_3":"http://mpv.videocc.net/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_3.mp4",
    "vid":"d81a899efaf1148b7cb87418cf3cf01a_d",
    "mp4_2":"http://mpv.videocc.net/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_2.mp4",
    "cataid":"1409192674947",
    "swf_link":"http://player.polyv.net/videos/d81a899efaf1148b7cb87418cf3cf01a_d.swf",
    "status":"60",
    "seed":1,
    "flv2":"http://plvod01.videocc.net/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_2.plv",
    "hls3":"http://v.polyv.net/hls/d81a899efaf1148b7cb87418cf3cf01a_d.m3u8?df=3",
    "flv3":"http://plvod01.videocc.net/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_3.plv",
    "flv1":"http://plvod01.videocc.net/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_1.plv",
    "sourcefile":"http://mpv.videocc.net/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a.mp4",
    "playerwidth":"600",
    "hlsIndex":"http://v.polyv.net/hlsIndex/d81a899efaf1148b7cb87418cf3cf01a_d.m3u8",
    "hls2":"http://v.polyv.net/hls/d81a899efaf1148b7cb87418cf3cf01a_d.m3u8?df=2",
    "default_video":"http://plvod01.videocc.net/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_2.plv",
    "hls1":"http://v.polyv.net/hls/d81a899efaf1148b7cb87418cf3cf01a_d.m3u8?df=1",
    "duration":"00:06:23",
    "first_image":"http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_1.jpg",
    "original_definition":"1280x720",
    "context":"",
    "images":"[\"http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_0.jpg\",\"http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_1.jpg\",\"http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_2.jpg\",\"http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_3.jpg\",\"http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_4.jpg\",\"http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_5.jpg\",\"http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_6.jpg\",\"http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_7.jpg\"]",
    "playerheight":"370",
    "ptime":"2014-09-15 14:26:47"}]}

字段说明:

字段 说明
swf_link Flash链接地址
tag 标签
mp4 视频地址
playerwidth 视频宽度
title 视频标题
duration 视频时长
first_image 视频截图
times 点击次数
context 视频描述
images 所有截图
playerheight 视频高度
ptime 上传时间
vid 视频id
cataid 分类id, 如1为根目录
default_video 用户默认播放视频
df 视频码率数
flv1 流畅码率flv格式视频地址
flv2 高清码率flv格式视频地址
flv3 超清码率flv格式视频地址
mp4_1 流畅码率mp4格式视频地址
mp4_2 高清码率mp4格式视频地址
mp4_3 超清码率mp4格式视频地址
hls1 流畅码率hls格式视频地址
hls2 高清码率hls格式视频地址
hls3 超清码率hls格式视频地址
hlsIndex 自适应码率hls播放地址
images_b 视频截图大图地址
seed 加密视频为1,非加密为0
status 视频状态
sourcefile 源文件
original_definition 源文件的分辨率

视频状态码说明:

视频状态码 含义
60/61 已发布
10 等待编码
20 正在编码
50 等待审核
51 审核不通过
-1 已删除

如果API想调用签名,可参考http://dev.polyv.net/2014/09/23/jsapi0028/ 按参数签名顺序拼凑字符串为cataid=$(cataid)&JSONRPC=$(JSONRPC)&writetoken=$(writetoken)$(secretkey),并进行sha1计算,得到sign。

上传远程视频

uploadUrlFile

作用:上传远程视频

URL:

http://v.polyv.net/uc/services/rest?method=uploadUrlFile

1.支持格式

JSON

2.HTTP请求方式

POST,GET

3.请求数限制

TRUE

4.请求参数

参数名 必选 类型及范围 说明
writetoken true string 用户的上传钥匙
fileUrl true file远程文件的http连接
title false string 标题
tag false string 标签
desc false string 描述
cataid false long 设定上传视频的分类,分类的id可以在“视频管理”——“内容分类”中获取,如下图所示。cataid为catatree的最后一个long型的整数,catatree由cataid组成。当cataid值为1时,表示用户上传空间的根目录。

5.返回错误列表

返回 说明
0 无错误
1 找不到writetoken关联的user
2 文件为空或者writetoken为空
3 提交的json名字JSONRPC为null
4 提交文件格式不正确
5 readtoken为空
6 分页输入出错
7 vid不能为空
8 找不到方法名

6.返回结果

JSON示例

{"error":"0",
 "data":
  [{"vid":"********"}]
 }

字段说明:

#vid: 视频ID

如果API想调用签名,可参考http://dev.polyv.net/2014/09/23/jsapi0028/ 按参数签名顺序拼凑字符串为desc=$(desc)&fileUrl=$(fileUrl)&tag=$(tag)&title=$(title)&writetoken=$(writetoken)$(secretkey),并进行sha1计算,得到sign。

断点续传

作用:上传远程视频

原理

通过偏移量来实现断点续传

偏移量Offset

Offset头部变量标志当前上传文件完成的偏移量,Offset为0或者大于0的整型。

请求类型

HEAD

每一次HEAD类型请求,服务器总是会返回offset头部变量,标志当前上传完成的字节数。

PATCH

服务器通过PATCH类型请求接收文件上传的数据。所有PATCH请求必须使用

Content-Type: application/offset+octet-stream.

上传节点

上传接口地址统一为

http://v.polyv.net:1080/files/

例子

创建文件

提交空的 POST 请求让服务器端创建一个待上传的文件. 需要在请求的Header增加两个变量:Final-Length和writeToken. 其中Final-Length为文件大小,writeToken是polyv后台的上传授权码。 Request:

POST /files HTTP/1.1
Host: v.polyv.net
Final-Length: 100
writeToken: Y07Q4yopIVXN83n-MPoIlirBKmrMPJu0

Response:

HTTP/1.1 201 Created
Location: http://v.polyv.net:1080/files/sl8da4jjbx28aac52069409bc8f6bf6e_s

Response会返回一个新的上传地址Location附带到Header里面,其中files后面的(sl8da4jjbx28aac52069409bc8f6bf6e_s)则为视频vid。 上传需要附带POST的参数:

标题 title 默认为notitle
描述 desc 默认为空
扩展名 ext:(mp4,mov,avi等) 默认为bin

续传

利用 HEAD request 取得Offset变量,决定从哪个地方恢复上传。下面例子演示从100字节的文件,从第70个字节中断后,继续上传。 Request:

HEAD /files/sl8da4jjbx28aac52069409bc8f6bf6e_s
HTTP/1.1
Host: v.polyv.net

Response:

HTTP/1.1 200 Ok
Offset: 70

返回offset为70, 客户端开始用PATCH请求恢复上传剩余的30字节。

Request:

PATCH /files/sl8da4jjbx28aac52069409bc8f6bf6e_s
HTTP/1.1
Host: v.polyv.net
Content-Type: application/offset+octet-stream
Content-Length: 30
Offset: 70

Response:

HTTP/1.1 200 Ok

示例源码

IOS上传源码

jquery上传源码

Java上传源码

点击在线演示

Web版上传插件

使用Web上传插件,首先在页面上做一个上传按钮。

<input type="button" id="upload" value="上传"></input>

接下来,引用Web上传插件的js,初始化上传参数并新建一个上传示例。

<script type="text/javascript">
    var obj = {
            uploadButtton: "upload",   //打开上传控件按钮id
            writeToken: "Y07Q4yopIVXN83n-MPoIlirBKmrMPJu0",
            userid : "sl8da4jjbx",
            ts : "1451380573",
            hash : "72e07af71c1b18f4abcbeed89c676537",
            readToken: "nsJ7ZgQMN0-QsVkscukWt-qLfodxoDFm",
   }
    var upload = new PolyvUpload(obj);
</script>

hash的值,是根据将时间戳和writeToken按照顺序拼凑起来的字符串进行MD5计算得到的值,如: 提供一个可测试上传视频的DEMO 地址:http://demo.polyv.net/demo/upload.php

<?php
$ts = time();
$writeToken = "Y07Q4yopIVXN83n-MPoIlirBKmrMPJu0";
$plain = $ts.$writeToken;
$hash = md5($plain);
?>

如果需要在前端页面中直接拿到服务器返回的响应信息,可以在初始化上传参数中加上response事件参数,并在页面中加上对应的文本框元素。如果还需要自动关闭弹窗,可以加上upload.closeWrap()方法。

var obj = {
    response: function(json) { 
        var scriptdata = "<script>" +
        "var player = polyvObject('#plv_" + json.vid + "').videoPlayer({\n" +
                                    "'width':'690',\n"+
                                    "'height':'385',\n"+
                                    "'vid' : '" + json.vid + "'"+
                                "});<\/script>";
                                 
        document.getElementById("textbody").value = document.getElementById("textbody").value + scriptdata;
         
        //如果需要关闭窗口
        upload.closeWrap();
         
    }
}

点击”上传”——“视频列表”——“返回视频信息”,可以在文本框看到云平台返回的response事件函数中的data数据。

示例可点击参考:Web上传插件

获取最新视频/全部视频列表

getNewList

作用:获取用户最新上传视频的列表

URL:

http://v.polyv.net/uc/services/rest?method=getNewList

1.支持格式

XML/JSON

2.HTTP请求方式

POST,GET

3.请求数限制

TRUE

4.请求参数

参数名 必选 类型及范围 说明
readtoken true string 用户的读取钥匙
pageNum true int 取第几页
numPerPage false int 平均每页多少条数据
catatree false string 视频所在分类
format false string 默认返回json格式,如果format=xml返回xml格式
jsonp false string 例如,正常情况{error:0,data:””},加 jsonp=a后返回a({error:0,data:””})

5.返回错误列表

返回 说明
0 无错误
1 找不到writetoken关联的user
2 文件为空或者writetoken为空
3 提交的json名字JSONRPC为null
4 提交文件格式不正确
5 readtoken为空
6 分页输入出错
7 vid不能为空
8 找不到方法名

6.返回结果

XML示例

<xml>
<error>0</error>
<total>1214</total>
<data>
<video>
<swf_link>
 
http://player.polyv.net/videos/e2e84a73834420049e9227c4bd1ddbc5_e.swf
 
</swf_link>
<status>60</status>
<tag>心灵鸡汤</tag>
<seed>1</seed>
<playerwidth>400</playerwidth>
<title>Wildlife</title>
<duration>00:00:30</duration>
<df>3</df>
<first_image>
 
http://img.videocc.net/uimage/e/e2e84a7383/5/e2e84a73834420049e9227c4bd1ddbc5_0.jpg
 
</first_image>
<times>1</times>
<context>动物</context>
<original_definition>1280x720</original_definition>
<playerheight>300</playerheight>
<vid>e2e84a73834420049e9227c4bd1ddbc5_e</vid>
<ptime>2014-09-09 09:44:07</ptime>
<cataid>1410230776538</cataid>
</video>
<video>
<swf_link>
 
http://player.polyv.net/videos/e2e84a7383a3276af77d75de601b492f_e.swf
 
</swf_link>
<status>60</status>
<tag>心,灵,鸡,汤</tag>
<seed>1</seed>
<playerwidth>600</playerwidth>
<title>58同城新版广告</title>
<duration>00:00:15</duration>
<df>1</df>
<first_image>
 
http://img.videocc.net/uimage/e/e2e84a7383/f/e2e84a7383a3276af77d75de601b492f_0.jpg
 
</first_image>
<times>1</times>
<context/>
<original_definition>448x336</original_definition>
<playerheight>466</playerheight>
<vid>e2e84a7383a3276af77d75de601b492f_e</vid>
<ptime>2014-09-09 09:43:47</ptime>
<cataid>1</cataid>
</video>
<video>
<swf_link>
 
http://player.polyv.net/videos/e2e84a73839658998dc52f06ee0c3ca0_e.swf
 
</swf_link>
<status>60</status>
<tag/>
<seed>1</seed>
<playerwidth>600</playerwidth>
<title>心态的能量</title>
<duration>00:21:42</duration>
<df>1</df>
<first_image>
 
http://img.videocc.net/uimage/e/e2e84a7383/0/e2e84a73839658998dc52f06ee0c3ca0_6.jpg
 
</first_image>
<times>1</times>
<context/>
<original_definition>1364x768</original_definition>
<playerheight>353</playerheight>
<vid>e2e84a73839658998dc52f06ee0c3ca0_e</vid>
<ptime>2014-09-09 09:24:27</ptime>
<cataid>1410230787507</cataid>
</video>
</data>
</xml>

JSON示例

{"total":"1214","error": "0","data": [
{"swf_link":"http://player.polyv.net/videos/e2e84a73834420049e9227c4bd1ddbc5_e.swf",
"status": "60",
"tag": "心灵鸡汤",
"seed": 1,
"playerwidth": "400",
"title": "Wildlife",
"duration": "00:00:30",
"df": 3,
"first_image":"http://img.videocc.net/uimage/e/e2e84a7383/5/e2e84a73834420049e9227c4bd1ddbc5_0.jpg",
"times": "1",
"context": "动物",
"original_definition": "1280x720",
"playerheight": "300",
"vid": "e2e84a73834420049e9227c4bd1ddbc5_e",
"ptime": "2014-09-09 09:44:07",
"cataid": "1410230776538"
},{
"swf_link":"http://player.polyv.net/videos/e2e84a7383a3276af77d75de601b492f_e.swf",
"status": "60",
"tag": "心,灵,鸡,汤",
"seed": 1,
"playerwidth": "600",
"title": "58同城新版广告",
"duration": "00:00:15",
"df": 1,
"first_image":"http://img.videocc.net/uimage/e/e2e84a7383/f/e2e84a7383a3276af77d75de601b492f_0.jpg",
"times": "1",
"context": "",
"original_definition": "448x336",
"playerheight": "466",
"vid": "e2e84a7383a3276af77d75de601b492f_e",
"ptime": "2014-09-09 09:43:47",
"cataid": "1"
},{
"swf_link":"http://player.polyv.net/videos/e2e84a73839658998dc52f06ee0c3ca0_e.swf",
"status": "60",
"tag": "",
"seed": 1,
"playerwidth": "600",
"title": "心态的能量",
"duration": "00:21:42",
"df": 1,
"first_image":"http://img.videocc.net/uimage/e/e2e84a7383/0/e2e84a73839658998dc52f06ee0c3ca0_6.jpg",
"times": "1",
"context": "",
"original_definition": "1364x768",
"playerheight": "353",
"vid": "e2e84a73839658998dc52f06ee0c3ca0_e",
"ptime": "2014-09-09 09:24:27",
"cataid": "1410230787507"
}]
}

字段说明:

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

如果想获取全部视频的信息,可以这样使用该接口:http://v.polyv.net/uc/services/rest?method=getNewList&readtoken=029rgH9Jv1-K3dXIp08aa-OBvewWUcbb&pageNum=1&numPerPage=10000其中&pageNum=1&numPerPage=10000表示把所有视频弄到一页来获取,这一页的集合里面的视频数有10000个。 如果API想调用签名,可参考http://dev.polyv.net/2014/09/23/jsapi0028/ 按参数签名顺序拼凑字符串为catatree=$(catatree)&numPerPage=$(numPerPage)&pageNum=$(pageNum)&readtoken=$(readtoken)$(secretkey),并进行sha1计算,得到sign。

获取单个视频的信息

getById

作用:获取用户单个视频的信息

URL:

http://v.polyv.net/uc/services/rest?method=getById

1.支持格式

XML/JSON

2.HTTP请求方式

POST,GET

3.请求数限制

TRUE

4.请求参数

参数名 必选 类型及范围 说明
readtoken true string 用户的读取钥匙
vid true string 视频ID
format false string 默认返回json格式,如果format=xml返回xml格式
jsonp false string 例如,正常情况{error:0,data:””},加jsonp=a后返回a({error:0,data:””})

5.返回错误列表

返回 说明
0 无错误
1 找不到writetoken关联的user
2 文件为空或者writetoken为空
3 提交的json名字JSONRPC为null
4 提交文件格式不正确
5 readtoken为空
6 分页输入出错
7 vid不能为空
8 找不到方法名

6.返回结果

XML示例

<xml>
<error>0</error>
<data>
<video>
<images_b>
  <image>http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_0_b.jpg</image>
  <image>http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_1_b.jpg</image>
  <image>http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_2_b.jpg</image>
  <image>http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_3_b.jpg</image>
  <image>http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_4_b.jpg</image>
  <image>http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_5_b.jpg</image>
  <image>http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_6_b.jpg</image>
  <image>http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_7_b.jpg</image>
</images_b>
<tag/>
<mp4>http://mpv.videocc.net/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_1.mp4</mp4>
<title>Youtube-Apple - Introducing iPhone 6 and iPhone 6 Plus_720P</title>
<df>3</df>
<times>3</times>
<mp4_1>http://mpv.videocc.net/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_1.mp4</mp4_1>
<mp4_3>http://mpv.videocc.net/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_3.mp4</mp4_3>
<vid>d81a899efaf1148b7cb87418cf3cf01a_d</vid>
<mp4_2>http://mpv.videocc.net/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_2.mp4</mp4_2>
<cataid>1409192674947</cataid>
<swf_link>http://player.polyv.net/videos/d81a899efaf1148b7cb87418cf3cf01a_d.swf</swf_link>
<status>60</status>
<seed>1</seed>
<flv2>http://plvod01.videocc.net/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_2.plv</flv2>
<hls3>http://v.polyv.net/hls/d81a899efaf1148b7cb87418cf3cf01a_d.m3u8?df=3</hls3>
<flv3>http://plvod01.videocc.net/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_3.plv</flv3>
<flv1>http://plvod01.videocc.net/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_1.plv</flv1>
<sourcefile>http://mpv.videocc.net/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a.mp4</sourcefile>
<playerwidth>600</playerwidth>
<hlsIndex>http://v.polyv.net/hlsIndex/d81a899efaf1148b7cb87418cf3cf01a_d.m3u8</hlsIndex>
<hls2>http://v.polyv.net/hls/d81a899efaf1148b7cb87418cf3cf01a_d.m3u8?df=2</hls2>
<default_video>http://plvod01.videocc.net/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_2.plv</default_video>
<hls1>http://v.polyv.net/hls/d81a899efaf1148b7cb87418cf3cf01a_d.m3u8?df=1</hls1>
<duration>00:06:23</duration>
<first_image>http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_1.jpg</first_image>
<original_definition>1280x720</original_definition>
<context/>
<images>
  <image>http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_0.jpg</image>
  <image>http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_1.jpg</image>
  <image>http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_2.jpg</image>
  <image>http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_3.jpg</image>
  <image>http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_4.jpg</image>
  <image>http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_5.jpg</image>
  <image>http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_6.jpg</image>
  <image>http://img.videocc.net/uimage/d/d81a899efa/a/d81a899efaf1148b7cb87418cf3cf01a_7.jpg</image>
</images>
<playerheight>370</playerheight>
<ptime>2014-09-15 14:26:47</ptime>
</video>
</data>
</xml>

JSON示例

{
error: "0",
data: [
{
images_b: [
"http://img.videocc.net/uimage/e/e2e84a7383/1/e2e84a7383f78f21025d3a814fb9bdc1_0_b.jpg",
"http://img.videocc.net/uimage/e/e2e84a7383/1/e2e84a7383f78f21025d3a814fb9bdc1_1_b.jpg",
"http://img.videocc.net/uimage/e/e2e84a7383/1/e2e84a7383f78f21025d3a814fb9bdc1_2_b.jpg",
"http://img.videocc.net/uimage/e/e2e84a7383/1/e2e84a7383f78f21025d3a814fb9bdc1_3_b.jpg",
"http://img.videocc.net/uimage/e/e2e84a7383/1/e2e84a7383f78f21025d3a814fb9bdc1_4_b.jpg",
"http://img.videocc.net/uimage/e/e2e84a7383/1/e2e84a7383f78f21025d3a814fb9bdc1_5_b.jpg",
"http://img.videocc.net/uimage/e/e2e84a7383/1/e2e84a7383f78f21025d3a814fb9bdc1_6_b.jpg",
"http://img.videocc.net/uimage/e/e2e84a7383/1/e2e84a7383f78f21025d3a814fb9bdc1_7_b.jpg"
],
tag: "",
mp4: "http://mpv.videocc.net/e2e84a7383/1/e2e84a7383f78f21025d3a814fb9bdc1_1.mp4",
title: "3",
df: 1,
times: "0",
mp4_1: "http://mpv.videocc.net/e2e84a7383/1/e2e84a7383f78f21025d3a814fb9bdc1_1.mp4",
vid: "e2e84a7383f78f21025d3a814fb9bdc1_e",
cataid: "1",
swf_link: "http://player.polyv.net/videos/e2e84a7383f78f21025d3a814fb9bdc1_e.swf",
source_filesize: 51628904,
status: "60",
seed: 1,
flv1: "http://plvod01.videocc.net/e2e84a7383/1/e2e84a7383f78f21025d3a814fb9bdc1_1.plv",
sourcefile: "http://mpv.videocc.net/e2e84a7383/1/e2e84a7383f78f21025d3a814fb9bdc1.mp4",
playerwidth: "600",
hlsIndex: "http://v.polyv.net/hlsIndex/e2e84a7383f78f21025d3a814fb9bdc1_e.m3u8",
hls1: "http://v.polyv.net/hls/e2e84a7383f78f21025d3a814fb9bdc1_e.m3u8?df=1",
default_video: "http://plvod01.videocc.net/e2e84a7383/1/e2e84a7383f78f21025d3a814fb9bdc1_1.plv",
duration: "00:21:42",
first_image: "http://img.videocc.net/uimage/e/e2e84a7383/1/e2e84a7383f78f21025d3a814fb9bdc1_0.jpg",
original_definition: "1364x768",
context: "",
images: [
"http://img.videocc.net/uimage/e/e2e84a7383/1/e2e84a7383f78f21025d3a814fb9bdc1_0.jpg",
"http://img.videocc.net/uimage/e/e2e84a7383/1/e2e84a7383f78f21025d3a814fb9bdc1_1.jpg",
"http://img.videocc.net/uimage/e/e2e84a7383/1/e2e84a7383f78f21025d3a814fb9bdc1_2.jpg",
"http://img.videocc.net/uimage/e/e2e84a7383/1/e2e84a7383f78f21025d3a814fb9bdc1_3.jpg",
"http://img.videocc.net/uimage/e/e2e84a7383/1/e2e84a7383f78f21025d3a814fb9bdc1_4.jpg",
"http://img.videocc.net/uimage/e/e2e84a7383/1/e2e84a7383f78f21025d3a814fb9bdc1_5.jpg",
"http://img.videocc.net/uimage/e/e2e84a7383/1/e2e84a7383f78f21025d3a814fb9bdc1_6.jpg",
"http://img.videocc.net/uimage/e/e2e84a7383/1/e2e84a7383f78f21025d3a814fb9bdc1_7.jpg"
],
playerheight: "490",
ptime: "2015-05-07 17:58:46"
}
]
}

字段说明:

字段 说明
error 错误提示
swf_link 返回flash连接
tag 视频标签
mp4 MP4源文件
playerwidth 视频宽度
title 标题
duration 时长
filesize 编码后各个清晰度视频的文件大小,类型为array
first_image 视频首图
times 播放次数
context 视频描述
original_definition 最佳分辨率
images 视频截图
playerheight 视频高度
ptime 视频上传日期
context 内容
ptime 上传时间
vid 视频id
cataid 分类id, 如1为根目录
default_video 用户默认播放视频
df 视频码率数
flv1 流畅码率flv格式视频地址
flv2 高清码率flv格式视频地址
flv3 超清码率flv格式视频地址
mp4_1 流畅码率mp4格式视频地址
mp4_2 高清码率mp4格式视频地址
mp4_3 超清码率mp4格式视频地址
hls1 流畅码率hls格式视频地址
hls2 高清码率hls格式视频地址
hls3 超清码率hls格式视频地址
hlsIndex 自适应码率hls播放地址
images_b 视频截图大图地址
seed
status 视频状态
视频状态码 含义
60/61 已发布
10 等待编码
20 正在编码
50 等待审核
51 审核不通过
-1 已删除

如果API想调用签名,可参考http://dev.polyv.net/2014/09/23/jsapi0028/ 按参数签名顺序拼凑字符串为readtoken=$(readtoken)&vid=$(vid)$(secretkey),并进行sha1计算,得到sign。

编辑单个视频的信息

editById

作用:编辑用户的某个视频的信息

URL:

http://v.polyv.net/uc/services/rest?method=editById

1.支持格式

XML/JSON

2.HTTP请求方式

POST,GET

3.请求数限制

TRUE

4.请求参数

参数名 必选 类型及范围 说明
writetoken true string 用户的上传钥匙
vid true string 视频ID
title false string 视频标题
tag false string 标签,tag标签如果有多个的话请用,分割开
context false string 详细介绍
publish_url false string 视频首发外链地址
format false string 默认返回json格式,如果format=xml返回xml格式
jsonp false string 例如,正常情况{error:0,data:””},加 jsonp=a后返回a({error:0,data:””})

5.返回错误列表

返回 说明
0 无错误
1 找不到writetoken关联的user
2 文件为空或者writetoken为空
3 提交的json名字JSONRPC为null
4 提交文件格式不正确
5 readtoken为空
6 分页输入出错
7 vid不能为空
8 找不到方法名

6.返回结果

XML示例

<xml>
<error>0</error>
<data>
<video>
<swf_link>http://v.polyv.net/player/Player.swf?vid=3a23e8721a5da8823e53128abca5764c_3</swf_link>
<duration>00:01:46.32</duration>
<title>13993026</title>
<first_image>http://v.polyv.net/uimage/3/3BGEYCaPIV/c/3a23e8721a5da8823e53128abca5764c_0.jpg</first_image>
<times>4</times>
<tag/>
<context/>
<ptime>2011-08-30 13:21:50</ptime>
<vid>3a23e8721a5da8823e53128abca5764c_3</vid>
</video>
</data>
</xml>

JSON示例

{"error":"0","data":
       [{"swf_link":"http://v.polyv.net/player/Player.swf?vid=3a23e8721a5da8823e53128abca5764c_3",
     "duration":"00:01:46.32",
     "title":"13993026",
      "first_image":"http://v.polyv.net/uimage/3/3BGEYCaPIV/c/3a23e8721a5da8823e53128abca5764c_0.jpg",
     "times":"3",
     "tag":"",
     "context":"",
     "ptime":"2011-08-30 13:21:50",
     "vid":"3a23e8721a5da8823e53128abca5764c_3"
    }]}

字段说明:

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

如果API想调用签名,可参考http://dev.polyv.net/2014/09/23/jsapi0028/ 按参数签名顺序拼凑字符串为context=$(context)&tag=$(tag)&title=$(title)&vid=$(vid)&writetoken=$(writetoken)$(secretkey),并进行sha1计算,得到sign。

按标题查找视频

searchByTitle

作用:按视频标题查询视频列表

URL:

http://v.polyv.net/uc/services/rest?method=searchByTitle

1.支持格式

XML/JSON

2.HTTP请求方式

POST,GET

3.请求数限制

TRUE

4.请求参数

参数名 必选 类型及范围 说明
readtoken true string 用户的读取钥匙
keyword true string 视频标题
numPerPage false int 页数
pageNum false int 页码
format false string 默认返回json格式,如果format=xml返回xml格式
jsonp false string 例如,正常情况{error:0,data:””},加 jsonp=a后返回a({error:0,data:””})

5.返回错误列表

返回 说明
0 无错误
1 找不到writetoken关联的user
2 文件为空或者writetoken为空
3 提交的json名字JSONRPC为null
4 提交文件格式不正确
5 readtoken为空
6 分页输入出错
7 vid不能为空
8 找不到方法名

6.返回结果

XML示例

<xml>
<error>0</error>
<data>
<video>
<swf_link>"http://v.polyv.net/player/Player.swf?vid=24181d5fd6e44561af9f2062862d5f7f_3"</swf_link>
<duration>""</duration>
<title>"110826每日猛料 实拍最牛国电领导咆哮记者 反对我就是反对党 "</title>
<first_image>"http://v.polyv.net/uimage/3/3BGEYCaPIV/f/24181d5fd6e44561af9f2062862d5f7f_0.jpg"</first_image>
<times>"0"</times>
<tag>"[]"</tag>
<context>""</context>
<ptime>"2011-08-26 17:06:33"</ptime>
<vid>"24181d5fd6e44561af9f2062862d5f7f_3"</vid>
</video>
<video>
<swf_link>"http://v.polyv.net/player/Player.swf?vid=bfbe364c71f63c7069520a827ef3af59_3"</swf_link>
<duration>""</duration>
<title>"实拍车祸现场村民不救人疯狂抢油 1"</title>
<first_image>"http://v.polyv.net/uimage/3/3BGEYCaPIV/9/bfbe364c71f63c7069520a827ef3af59_0.jpg"</first_image>
<times>"0"</times>
<tag>"[]"</tag>
<context>""</context>
<ptime>"2011-08-26 13:03:06"</ptime>
<vid>"bfbe364c71f63c7069520a827ef3af59_3"</vid>
</video>
</data>
</xml>

JSON示例

{"error":"0", "data":
[{
"swf_link":"http://v.polyv.net/player/Player.swf?vid=24181d5fd6e44561af9f2062862d5f7f_3",
"duration":"",
"title":"110826每日猛料 实拍最牛国电领导咆哮记者 反对我就是反对党 - 高清在线观看 - 腾讯视频",
"first_image":"http://v.polyv.net/uimage/3/3BGEYCaPIV/f/24181d5fd6e44561af9f2062862d5f7f_0.jpg",
"times":"0",
"tag":"[]",
"context":"",
"ptime":"2011-08-26 17:06:33",
"vid":"24181d5fd6e44561af9f2062862d5f7f_3"
 },{
"swf_link":"http://v.polyv.net/player/Player.swf?vid=bfbe364c71f63c7069520a827ef3af59_3",
"duration":"",
"title":"实拍车祸现场村民不救人疯狂抢油 - 网易视频 1",
"first_image":"http://v.polyv.net/uimage/3/3BGEYCaPIV/9/bfbe364c71f63c7069520a827ef3af59_0.jpg",
"times":"0",
"tag":"[]",
"context":"",
"ptime":"2011-08-26 13:03:06",
"vid":"bfbe364c71f63c7069520a827ef3af59_3"
}]
}

字段说明:

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