保利威文档中心

幫助中心

依標籤查詢影片

更新時間:2022-05-23 19:00:06

介面URL

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

介面說明

依影片標籤查詢影片列表

支援格式

XML/JSON

請求方式

POST,GET

請求次數限制

TRUE

請求參數

參數名 必填 類型及範圍 說明
userid true string POLYV用戶ID,http://api.polyv.net/v2/video/{userid}/search 中的{userid}需替換為POLYV用戶ID的值
format false string 預設回傳json格式,若format=xml則回傳xml格式
jsonp false string 例如,正常情況{error:0,data:""},加上jsonp=a後回傳a({error:0,data:""})
numPerPage false int 頁數
pageNum false int 頁碼
ptime true string 目前時間的毫秒級時間戳記(13位),3分鐘內有效
tag false string 影片標籤
sign true string 簽名,為40位大寫的SHA1值

PHP範例程式碼

<?php
$userid="9f1e0689e1";//必选
$format="";
$jsonp="";
$numPerPage=100;
$pageNum=1;
$ptime=time()*1000;//必选
$tag="刘诗昆";
$secretkey="AkDipaULWw";
$post_data = array (
    "format" => $format,
    "jsonp" => $jsonp,
    "numPerPage" => $numPerPage,
    "pageNum" => $pageNum,
    "ptime" => $ptime,
    "tag" => $tag
);
$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);
?>

回傳結果

<xml>
    <code>200</code>
    <status>success</status>
    <message>success</message>
    <data>
        <tag>刘诗昆,110435</tag>
        <mp4>http://mpv.videocc.net/9f1e0689e1/6/9f1e0689e1a156fc6b373eab9195b0c6_1.mp4</mp4>
        <title>刘诗昆钢琴教程4</title>
        <df>1</df>
        <times>68</times>
        <vid>9f1e0689e1a156fc6b373eab9195b0c6_9</vid>
        <mp4_1>http://mpv.videocc.net/9f1e0689e1/6/9f1e0689e1a156fc6b373eab9195b0c6_1.mp4</mp4_1>
        <cataid>1470122811372</cataid>
        <swf_link>http://player.polyv.net/videos/9f1e0689e1a156fc6b373eab9195b0c6_9.swf</swf_link>
        <status>60</status>
        <seed>0</seed>
        <playerwidth>600</playerwidth>
        <duration>00:35:52</duration>
        <first_image>http://img.videocc.net/uimage/9/9f1e0689e1/6/9f1e0689e1a156fc6b373eab9195b0c6_5.jpg</first_image>
        <original_definition>384x294</original_definition>
        <context></context>
        <playerheight>458</playerheight>
        <ptime>2016-04-28 12:11:10</ptime>
        <source_filesize>65153042</source_filesize>
        <filesize>69789952</filesize>
        <md5checksum>b6dc8cd9ac9f189e5e2efeba8fd62d9b</md5checksum>
        <hls>http://hls.videocc.net/9f1e0689e1/9/9f1e0689e1a156fc6b373eab9195b0c6_1.m3u8</hls>
    </data>
</xml>

JSON範例

{
  "code": 200,
  "status": "success",
  "message": "success",
  "data": [
    {
      "tag": "刘诗昆,110435",
      "mp4": "http://mpv.videocc.net/9f1e0689e1/6/9f1e0689e1a156fc6b373eab9195b0c6_1.mp4",
      "title": "刘诗昆钢琴教程4",
      "df": 1,
      "times": "68",
      "vid": "9f1e0689e1a156fc6b373eab9195b0c6_9",
      "mp4_1": "http://mpv.videocc.net/9f1e0689e1/6/9f1e0689e1a156fc6b373eab9195b0c6_1.mp4",
      "cataid": "1470122811372",
      "swf_link": "http://player.polyv.net/videos/9f1e0689e1a156fc6b373eab9195b0c6_9.swf",
      "status": "60",
      "seed": 0,
      "playerwidth": "600",
      "duration": "00:35:52",
      "first_image": "http://img.videocc.net/uimage/9/9f1e0689e1/6/9f1e0689e1a156fc6b373eab9195b0c6_5.jpg",
      "original_definition": "384x294",
      "context": "",
      "playerheight": "458",
      "ptime": "2016-04-28 12:11:10",
      "source_filesize": 65153042,
      "filesize": [
        69789952
      ],
      "md5checksum": "b6dc8cd9ac9f189e5e2efeba8fd62d9b",
      "hls": [
        "http://hls.videocc.net/9f1e0689e1/9/9f1e0689e1a156fc6b373eab9195b0c6_1.m3u8"
      ]
    }
  ]
}

欄位說明

欄位 說明
code 回傳碼
status 回傳狀態
message 回傳訊息
total 總數
tag 標籤
mp4 mp4格式影片位址
title 標題
df 影片碼率數
times 播放次數
vid 影片id
mp4_1 流暢碼率mp4格式影片位址
cataid 分類id,如1為根目錄
swf_link 回傳flash連結
status 影片狀態
seed 加密影片為1,非加密為0
playerwidth 影片寬度
duration 時長
first_image 影片首圖
original_definition 最佳解析度
context 影片描述
playerheight 影片高度
ptime 影片上傳日期
source_filesize 原始檔案大小
filesize 編碼後各清晰度影片的檔案大小,類型為array
md5checksum md5校驗碼
hls m3u8位址

sign的產生規則

format=參數&jsonp=參數&numPerPage=參數&pageNum=參數&ptime=參數&tag=參數secureKey經過SHA-1加密再經過大寫化 (注意:參數為空時,則在產生sign的時候不需加入此欄位。例如如果這裡沒有t,則不需拼接&t=參數)

联系客服,在线咨询