http://v.polyv.net/uc/services/rest?method=uploadfile
上传视频接口POST不能携带cookie
上传的视频不能大于 2G
返回错误列表
<xml>
<error>0</error>
<total/>
<data>
<video>
<md5checksum>
<![CDATA[ 44b145c6bea7dd826191990dfb38d1fd ]]>
</md5checksum>
<tag>
<![CDATA[ 标签 ]]>
</tag>
<mp4>
<![CDATA[http://mpv.videocc.net/36e77ba39c/0/36e77ba39cc4768ab541cb6bf4f775a0_1.mp4]]>
</mp4>
<title>
<![CDATA[ upload上传视频 ]]>
</title>
<df>2</df>
<times>
<![CDATA[ 0 ]]>
</times>
<mp4_1>
<![CDATA[http://mpv.videocc.net/36e77ba39c/0/36e77ba39cc4768ab541cb6bf4f775a0_1.mp4]]>
</mp4_1>
<vid>
<![CDATA[ 36e77ba39cc4768ab541cb6bf4f775a0_3 ]]>
</vid>
<mp4_2>
<![CDATA[http://mpv.videocc.net/36e77ba39c/0/36e77ba39cc4768ab541cb6bf4f775a0_2.mp4]]>
</mp4_2>
<cataid>
<![CDATA[ 1 ]]>
</cataid>
<swf_link>
<![CDATA[http://player.polyv.net/videos/36e77ba39cc4768ab541cb6bf4f775a0_3.swf]]>
</swf_link>
<status>
<![CDATA[ 10 ]]>
</status>
<seed>1</seed>
<flv2>
<![CDATA[http://plvod01.videocc.net/36e77ba39c/0/36e77ba39cc4768ab541cb6bf4f775a0_2.flv]]>
</flv2>
<flv1>
<![CDATA[http://plvod01.videocc.net/36e77ba39c/0/36e77ba39cc4768ab541cb6bf4f775a0_1.flv]]>
</flv1>
<sourcefile>
<![CDATA[ ]]>
</sourcefile>
<playerwidth>
<![CDATA[ 600 ]]>
</playerwidth>
<hls/>
<default_video>
<![CDATA[http://plvod01.videocc.net/36e77ba39c/0/36e77ba39cc4768ab541cb6bf4f775a0_1.flv]]>
</default_video>
<duration>
<![CDATA[ 00:00:33 ]]>
</duration>
<filesize/>
<first_image>
<![CDATA[http://img.videocc.net/uimage/3/36e77ba39c/0/36e77ba39cc4768ab541cb6bf4f775a0_0.jpg]]>
</first_image>
<original_definition>
<![CDATA[ 672x378 ]]>
</original_definition>
<context>
<![CDATA[ 视频文档描述 ]]>
</context>
<previewVid>
<![CDATA[ m63c44pl69mm7435lp871mp3pn7n448l0_6 ]]>
</previewVid>
<playerheight>
<![CDATA[ 490 ]]>
</playerheight>
<ptime>
<![CDATA[ 2017-12-04 10:36:18 ]]>
</ptime>
</video>
</data>
</xml>
强烈建议您使用点播Java SDK完成API的功能对接,点播Java SDK 对API调用逻辑、异常处理、数据签名、HTTP请求线程池进行了统一封装和优化。
private static final Logger log = LoggerFactory.getLogger(VodVideoUploadTest.class);
/**
* 上传点播视频
*/
@Test
public void testUpload() throws Exception, NoSuchAlgorithmException {
//业务参数
String url = "http://v.polyv.net/uc/services/rest?method=uploadfile";
String writeToken = super.writeToken;
Map<String, String> requestMap = new HashMap<>();
requestMap.put("writetoken", writeToken);
requestMap.put("JSONRPC", "{\"title\": \"标题\", \"tag\":\"标签\",\"desc\":\"描述\"}");
Map<String, File> fileMap = new HashMap<>();
fileMap.put("Filedata",new File("E:\\polyv\\polyv.mp4"));
String response = HttpUtil.postFile(url,requestMap,fileMap,null);
log.debug("测试上传点播视频,{}", response);
//do somethings
}
{
error: "0",
data: [
{
images_b: [
"http://img.videocc.net/uimage/3/36e77ba39c/d/36e77ba39c0e5dac84dba418d81a793d_0_b.jpg",
"http://img.videocc.net/uimage/3/36e77ba39c/d/36e77ba39c0e5dac84dba418d81a793d_1_b.jpg",
"http://img.videocc.net/uimage/3/36e77ba39c/d/36e77ba39c0e5dac84dba418d81a793d_2_b.jpg",
"http://img.videocc.net/uimage/3/36e77ba39c/d/36e77ba39c0e5dac84dba418d81a793d_3_b.jpg",
"http://img.videocc.net/uimage/3/36e77ba39c/d/36e77ba39c0e5dac84dba418d81a793d_4_b.jpg",
"http://img.videocc.net/uimage/3/36e77ba39c/d/36e77ba39c0e5dac84dba418d81a793d_5_b.jpg"
],
md5checksum: "44b145c6bea7dd826191990dfb38d1fd",
tag: "标签",
mp4: "http://mpv.videocc.net/36e77ba39c/d/36e77ba39c0e5dac84dba418d81a793d_1.mp4",
title: "标题",
df: 2,
times: "0",
mp4_1: "http://mpv.videocc.net/36e77ba39c/d/36e77ba39c0e5dac84dba418d81a793d_1.mp4",
vid: "36e77ba39c0e5dac84dba418d81a793d_3",
mp4_2: "http://mpv.videocc.net/36e77ba39c/d/36e77ba39c0e5dac84dba418d81a793d_2.mp4",
cataid: "1",
swf_link: "http://player.polyv.net/videos/36e77ba39c0e5dac84dba418d81a793d_3.swf",
source_filesize: 2295887,
status: "10",
seed: 1,
flv2: "http://plvod01.videocc.net/36e77ba39c/d/36e77ba39c0e5dac84dba418d81a793d_2.flv",
flv1: "http://plvod01.videocc.net/36e77ba39c/d/36e77ba39c0e5dac84dba418d81a793d_1.flv",
sourcefile: "",
playerwidth: "600",
hls: [
"http://hls.videocc.net/36e77ba39c/3/36e77ba39c0e5dac84dba418d81a793d_1.m3u8",
"http://hls.videocc.net/36e77ba39c/3/36e77ba39c0e5dac84dba418d81a793d_2.m3u8"
],
default_video: "http://plvod01.videocc.net/36e77ba39c/d/36e77ba39c0e5dac84dba418d81a793d_1.flv",
duration: "00:00:33",
filesize: [
0,
0
],
first_image: "http://img.videocc.net/uimage/3/36e77ba39c/d/36e77ba39c0e5dac84dba418d81a793d_0.jpg",
original_definition: "672x378",
context: "描述",
images: [
"http://img.videocc.net/uimage/3/36e77ba39c/d/36e77ba39c0e5dac84dba418d81a793d_0.jpg",
"http://img.videocc.net/uimage/3/36e77ba39c/d/36e77ba39c0e5dac84dba418d81a793d_1.jpg",
"http://img.videocc.net/uimage/3/36e77ba39c/d/36e77ba39c0e5dac84dba418d81a793d_2.jpg",
"http://img.videocc.net/uimage/3/36e77ba39c/d/36e77ba39c0e5dac84dba418d81a793d_3.jpg",
"http://img.videocc.net/uimage/3/36e77ba39c/d/36e77ba39c0e5dac84dba418d81a793d_4.jpg",
"http://img.videocc.net/uimage/3/36e77ba39c/d/36e77ba39c0e5dac84dba418d81a793d_5.jpg"
],
previewVid: "363c44pl69m0c8klm57kpl715k51l496k_6",
playerheight: "490",
ptime: "2017-12-04 11:12:50"
}
]
}