按标题查找视频

点击这里查看旧版

接口URL

http://api.polyv.net/v2/video/{userid}/search

接口说明

按视频标题查询视频列表

支持格式

XML/JSON

请求方式

POST,GET

请求数限制

TRUE

请求参数

参数名 必选 类型及范围 说明
userid true string 用户的id
format false string 默认返回json格式,如果format=xml返回xml格式
jsonp false string 例如,正常情况{error:0,data:””},加 jsonp=a后返回a({error:0,data:””})
keyword false string 视频标题
numPerPage false int 每页显示数量
pageNum false int 页码
ptime true string 13位当前时间的毫秒级时间戳

返回结果

<xml>
    <code>200</code>
    <status>success</status>
    <message>success</message>
    <data>
        <tag></tag>
        <mp4>http://mpv.videocc.net/7d26575efe/f/7d26575efe097ad66523d19b094c8a8f_1.mp4</mp4>
        <title>Wildlife</title>
        <df>3</df>
        <times>30</times>
        <vid>7d26575efe097ad66523d19b094c8a8f_7</vid>
        <mp4_1>http://mpv.videocc.net/7d26575efe/f/7d26575efe097ad66523d19b094c8a8f_1.mp4</mp4_1>
        <mp4_2>http://mpv.videocc.net/7d26575efe/f/7d26575efe097ad66523d19b094c8a8f_2.mp4</mp4_2>
        <mp4_3>http://mpv.videocc.net/7d26575efe/f/7d26575efe097ad66523d19b094c8a8f_3.mp4</mp4_3>
        <cataid>1491449370131</cataid>
        <swf_link>http://player.polyv.net/videos/7d26575efe097ad66523d19b094c8a8f_7.swf</swf_link>
        <status>61</status>
        <seed>1</seed>
        <playerwidth>600</playerwidth>
        <duration>00:00:30</duration>
        <first_image>http://img.videocc.net/uimage/7/7d26575efe/f/7d26575efe097ad66523d19b094c8a8f_5.jpg</first_image>
        <original_definition>1280x720</original_definition>
        <context></context>
        <playerheight>337</playerheight>
        <ptime>2017-04-06 15:23:36</ptime>
        <source_filesize>26246026</source_filesize>
        <filesize>1272725</filesize>
        <filesize>2279413</filesize>
        <filesize>5108761</filesize>
        <md5checksum>d8c2eafd90c266e19ab9dcacc479f8af</md5checksum>
        <hls>http://hls.videocc.net/7d26575efe/7/7d26575efe097ad66523d19b094c8a8f_1.m3u8</hls>
        <hls>http://hls.videocc.net/7d26575efe/7/7d26575efe097ad66523d19b094c8a8f_2.m3u8</hls>
        <hls>http://hls.videocc.net/7d26575efe/7/7d26575efe097ad66523d19b094c8a8f_3.m3u8</hls>
    </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"
        ]
        }]
}

请求失败返回json示例

{
    code: 400,
    status: "error",
    message: "the sign is not right.",
    data: ""
}

PHP请求示例

<?php
header("Content-type: text/html; charset=utf-8");
$userid="efbb4ae8ac";//必选
$format="";
$jsonp="";
$numPerPage=100;
$pageNum=1;
$ptime=time()*1000;//必选
$keyword="测试";
$secretkey="hbjCVBhnth";
$post_data = array (
    "format" => $format,
    "jsonp" => $jsonp,
    "keyword"=>$keyword,
    "numPerPage" => $numPerPage,
    "pageNum" => $pageNum,
    "ptime" => $ptime,
);
$str="";
foreach ($post_data as $key => $value){
    if (!empty($value)) {
        $str.=$key."=".$value."&";
    }else{
        unset($post_data[$key]);
    }
}
$str=substr($str, 0,strlen($str)-1);
$str.=$secretkey;
// echo $str;
// die();
$hash=strtoupper(sha1($str));
$post_data["sign"] = $hash;
// var_dump($post_data);
// exit();
$url="http://api.polyv.net/v2/video/{$userid}/search";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
$output = curl_exec($ch);
curl_close($ch);
print_r($output);
?>

字段说明

字段 说明
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 视频总数

 

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

sign的生成规则

format=参数&jsonp=参数&keyword=参数&numPerPage=参数&pageNum=参数&ptime=参数secureKey经过SHA-1加密再经过大写化
(注意:参数为空时,则在生成sign的时候不需要添加此字段。例如如果这里没有t,则不需要拼接&t=参数)

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