Get Single Video Information
Updated: 2023-11-14 14:07:19
Interface Description
1、获取用户单条视频记录
2、接口支持https协议
Interface URL
http://api.polyv.net/v2/video/{userid}/get-video-msg
Request Method
POST, GET
API Description
Supported Formats
XML/JSON
Request Limit
TRUE
Request Parameters
| Parameter Name | Required | Type and Range | Description |
|---|---|---|---|
| vid | true | string | Video ID |
| userid | true | string | User ID (used in the URL, no need to submit in the request) |
| ptime | true | string | Current 13-digit millisecond timestamp, valid for 3 minutes |
| sign | true | string | Signature, 40-character uppercase SHA1 value |
| format | false | string | Default returns JSON format. If format=xml, returns XML format |
| jsonp | false | string | For example, normally returns {error:0,data:””}. Adding jsonp=a returns a({error:0,data:””}) |
Return Result
<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.Youku.com - [Classic Review] Hotel California 2004 Version Chinese & English Subtitles Eagles [HD Version]-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>Uploader</role>
</uploader>
<keepsource>0<keepsource/>
<hlsLevel>open</hlsLevel>
<cataname>New Category Test</cataname>
</videoDetail>
</data>
</xml>
JSON Example
{
"code": 200,
"status": "success",
"message": "success",
"data": [
{
"images_b": [
"36e77ba39c/a/36e77ba39cfe07c3a3812ed7735c71ea_0_b.jpg",
"36e77ba39c/a/36e77ba39cfe07c3a3812ed7735c71ea_1_b.jpg",
"36e77ba39c/a/36e77ba39cfe07c3a3812ed7735c71ea_2_b.jpg",
"36e77ba39c/a/36e77ba39cfe07c3a3812ed7735c71ea_3_b.jpg",
"36e77ba39c/a/36e77ba39cfe07c3a3812ed7735c71ea_4_b.jpg",
"36e77ba39c/a/36e77ba39cfe07c3a3812ed7735c71ea_5_b.jpg"
],
"images": [
"36e77ba39c/a/36e77ba39cfe07c3a3812ed7735c71ea_0.jpg",
"36e77ba39c/a/36e77ba39cfe07c3a3812ed7735c71ea_1.jpg",
"36e77ba39c/a/36e77ba39cfe07c3a3812ed7735c71ea_2.jpg",
"36e77ba39c/a/36e77ba39cfe07c3a3812ed7735c71ea_3.jpg",
"36e77ba39c/a/36e77ba39cfe07c3a3812ed7735c71ea_4.jpg",
"36e77ba39c/a/36e77ba39cfe07c3a3812ed7735c71ea_5.jpg"
],
"imageUrls": [
"http://img.videocc.net/uimage/3/36e77ba39c/a/36e77ba39cfe07c3a3812ed7735c71ea_0.jpg",
"http://img.videocc.net/uimage/3/36e77ba39c/a/36e77ba39cfe07c3a3812ed7735c71ea_1.jpg",
"http://img.videocc.net/uimage/3/36e77ba39c/a/36e77ba39cfe07c3a3812ed7735c71ea_2.jpg",
"http://img.videocc.net/uimage/3/36e77ba39c/a/36e77ba39cfe07c3a3812ed7735c71ea_3.jpg",
"http://img.videocc.net/uimage/3/36e77ba39c/a/36e77ba39cfe07c3a3812ed7735c71ea_4.jpg",
"http://img.videocc.net/uimage/3/36e77ba39c/a/36e77ba39cfe07c3a3812ed7735c71ea_5.jpg"
],
"tag": "tag",
"mp4": "http://mpv.videocc.net/36e77ba39c/a/36e77ba39cfe07c3a3812ed7735c71ea_1.mp4",
"title": "upload video",
"df": 2,
"times": "0",
"vid": "36e77ba39cfe07c3a3812ed7735c71ea_3",
"mp4_1": "http://mpv.videocc.net/36e77ba39c/a/36e77ba39cfe07c3a3812ed7735c71ea_1.mp4",
"mp4_2": "http://mpv.videocc.net/36e77ba39c/a/36e77ba39cfe07c3a3812ed7735c71ea_2.mp4",
"cataid": "1",
"swf_link": "http://player.polyv.net/videos/36e77ba39cfe07c3a3812ed7735c71ea_3.swf",
"status": "61",
"seed": 1,
"flv1": "http://plvod01.videocc.net/36e77ba39c/a/36e77ba39cfe07c3a3812ed7735c71ea_1.plv",
"flv2": "http://plvod01.videocc.net/36e77ba39c/a/36e77ba39cfe07c3a3812ed7735c71ea_2.plv",
"sourcefile": "",
"playerwidth": "600",
"default_video": "http://plvod01.videocc.net/36e77ba39c/a/36e77ba39cfe07c3a3812ed7735c71ea_1.plv",
"duration": "00:00:33",
"first_image": "http://img.videocc.net/uimage/3/36e77ba39c/a/36e77ba39cfe07c3a3812ed7735c71ea_0.jpg",
"original_definition": "672x378",
"context": "Video document description",
"playerheight": "490",
"ptime": "2017-12-04 09:41:10",
"source_filesize": 2295887,
"filesize": [
1273674,
2262596
],
"md5checksum": "44b145c6bea7dd826191990dfb38d1fd",
"hls": [
"http://hls.videocc.net/36e77ba39c/3/36e77ba39cfe07c3a3812ed7735c71ea_1.m3u8",
"http://hls.videocc.net/36e77ba39c/3/36e77ba39cfe07c3a3812ed7735c71ea_2.m3u8"
],
"aac_link": "http://mpv.videocc.net/28ac0f40b7/8/28ac0f40b7880cca2b03ea7a8f0a8723_7.mp3",
"tsfilesize1": "1459696",
"tsfilesize2": "2528832",
"tsfilesize3": "0",
"previewVid": "263c44pl69mnc04m6l6512ck4468m41cl_6",
"uploader": {
"email": "test2@zzs.com",
"name": "test2",
"role": "uploader"
},
"keepsource": "0",
"hlsLevel": "open",
"cataname": "New category test"
}
]
}
Failure Response JSON (without JSONP)
{
code: 400,
status: "error",
message: "ptime is too old.",
data: ""
}
Field Description
| Field | Description |
|---|---|
| error | Error message |
| swf_link | Flash link returned |
| tag | Video tag |
| mp4 | MP4 source file |
| playerwidth | Video width |
| title | Title |
| duration | Duration |
| filesize | File size of each encoded video quality (unit: bytes), type is array |
| first_image | Video thumbnail |
| times | Play count |
| context | Video description |
| original_definition | Best resolution |
| images | Video screenshots |
| playerheight | Video height |
| ptime | Video upload date |
| ptime | Upload time |
| vid | Video ID |
| previewVid | Preview video ID |
| cataid | Category ID, e.g., 1 for root directory |
| default_video | User default playback video |
| df | Video bitrate count |
| flv1 | FLV video URL for smooth bitrate |
| flv2 | FLV video URL for high bitrate |
| flv3 | FLV video URL for ultra-high bitrate |
| mp4_1 | MP4 video URL for smooth bitrate |
| mp4_2 | MP4 video URL for high bitrate |
| mp4_3 | MP4 video URL for ultra-high bitrate |
| hls_1 | M3U8 for smooth quality |
| hls_2 | M3U8 for high quality |
| hls_3 | M3U8 for ultra-high quality |
| images_b | Large video screenshot URL |
| imageUrls | Small video screenshot URLs |
| seed | Encrypted video: 1, non-encrypted: 0 |
| status | Video status |
| keepsource | Whether it is the source file: 0 for no, 1 for yes |
| uploader.email | Uploader email |
| uploader.name | Uploader name |
| uploader.role | Uploader role, e.g., admin, uploader, primary account |
| hlsLevel | Encryption level: open (unauthorized), web (web authorization), app (app authorization), wxa_app (mini program authorization) |
| cataname | Category name |
| source_filesize | Source video file size, unit: bytes |
| aac_link | Audio URL, returned only if audio switching is enabled |
| md5checksum | MD5 checksum of the source video file uploaded to the POLYV cloud platform, used to verify upload correctness or completeness |
| sourcefile | No current meaning |
| Video Status Code | Meaning |
|---|---|
| 60/61 | Published |
| 10 | Waiting for encoding |
| 20 | Encoding in progress |
| 40 | Encoding failed |
| 50 | Waiting for review |
| 51 | Review not approved |
| -1 | Deleted |
<?php
header("Content-type: text/html; charset=utf-8");
$userid="3828390191";
$format="json";
$jsonp="";//(Note: if there is no jsonp here, there is no need to concatenate the &jsonp= parameter)
$ptime=time()*1000;//13 digits
$vid="382839019131be68715e9455f8d0971a_3";
$secretkey="tIQp4ATe9Z";
if (empty($jsonp)) {
$str="format=".$format."&ptime=".$ptime."&vid=".$vid.$secretkey;
}else{
$str="format=".$format."&jsonp=".$jsonp."&ptime=".$ptime."&vid=".$vid.$secretkey;
}
//echo $str.'';
$hash=strtoupper(sha1($str));
//echo $hash.'';
$url="http://api.polyv.net/v2/video/{$userid}/get-video-msg";
$post_data = array (
"format" => $format,
"jsonp" => $jsonp,
"ptime" => $ptime,
"vid" => $vid,
"sign" => $hash,
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// post data
curl_setopt($ch, CURLOPT_POST, 1);
// post variables
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
$output = curl_exec($ch);
curl_close($ch);
// print the obtained data
print_r($output);
?>
Signature Rules:
Sort non-empty request parameters in dictionary order by parameter name, concatenate each parameter name with its value, append the secretkey at the end, and generate a 40-character uppercase SHA1 value as the sign. Below is an example process:
1. Request parameters are
ptime = "1492591990000"
vid = "382839019131be68715e9455f8d0971a_3"
format = "json"
2. Arrange the request parameters in dictionary order by parameter name
format = "json"
ptime = "1492591990000"
vid = "382839019131be68715e9455f8d0971a_3"
3. Connection String Concatenate the parameter name and parameter value, and append the secret key at the end (obtained from the VOD backend, assuming the secret key value is tIQp4ATe9Z), as follows:
format=json&ptime=1492591990000&vid=382839019131be68715e9455f8d0971a_3tIQp4ATe9Z
4. Generate Signature sign
50BF9B165630A8047EB1D17D95A469CC51FF754E
