查询视频终端环境统计数据

接口URL

https://api.polyv.net/v2/device/{userid}

接口说明

查询视频终端环境统计数据,包括浏览器环境,操作系统环境,终端环境

支持格式

JSON

请求方式

GET

请求参数

参数名 必选 类型及范围 说明
userid true string 用户id,路径参数
ptime true string 当前13位毫秒级时间戳,3分钟内有效
sign true string 签名,40位大写的sha1值
dr false string 时间段,具体值为以下几个:today(今天),yesterday(昨天),this_week(本周),last_week(上周),7days(最近7天),this_month(本月),last_month(上个月),this_year(今年),last_year(去年),默认值为7days
start false string 开始日期,格式为yyyy-MM-dd
end false string 结束日期,格式为yyyy-MM-dd

返回结果

{
  "code": 200, 
  "status": "success", 
  "message": "success", 
  "data": {
    "device": [
      {
        "deviceName": "PC端", 
        "videoView": 52, 
        "formatPlayDuration": "00:28:18", 
        "playDuration": 1698, 
        "uniqueViewer": 20, 
        "percentage": "89.66"
      }, 
      {
        "deviceName": "移动端", 
        "videoView": 6, 
        "formatPlayDuration": "00:03:25", 
        "playDuration": 205, 
        "uniqueViewer": 5, 
        "percentage": "10.34"
      }
    ], 
    "operatingSystem": [
      {
        "operateSystemName": "Windows", 
        "videoView": 40, 
        "formatPlayDuration": "00:23:58", 
        "playDuration": 1438, 
        "uniqueViewer": 18, 
        "percentage": "68.97"
      }, 
      {
        "operateSystemName": "Linux", 
        "videoView": 12, 
        "formatPlayDuration": "00:04:20", 
        "playDuration": 260, 
        "uniqueViewer": 2, 
        "percentage": "20.69"
      }, 
      {
        "operateSystemName": "Android Mobile", 
        "videoView": 6, 
        "formatPlayDuration": "00:03:25", 
        "playDuration": 205, 
        "uniqueViewer": 5, 
        "percentage": "10.34"
      }
    ], 
    "browser": [
      {
        "browserName": "Chrome", 
        "formatPcPlayDuration": "00:28:18", 
        "pcPlayDuration": 1698, 
        "pcVideoView": 52, 
        "pcUniqueViewer": 20, 
        "formatMobilePlayDuration": "00:00:00", 
        "mobilePlayDuration": 0, 
        "mobileVideoView": 0, 
        "mobileUniqueViewer": 0, 
        "pcPercentage": "100.00", 
        "mobilePercentage": "0.00"
      }, 
      {
        "browserName": "微信", 
        "formatPcPlayDuration": "00:00:00", 
        "pcPlayDuration": 0, 
        "pcVideoView": 0, 
        "pcUniqueViewer": 0, 
        "formatMobilePlayDuration": "00:03:25", 
        "mobilePlayDuration": 205, 
        "mobileVideoView": 6, 
        "mobileUniqueViewer": 5, 
        "pcPercentage": "0.00", 
        "mobilePercentage": "100.00"
      }
    ]
  }
}

失败返回json(不带jsonp)

{
  "code": 400,
  "status": "error",
  "message": "ptime is too old.",
  "data": ""
}

字段描述

字段名称 描述
device 终端环境统计数据
operatingSystem 操作系统环境统计数据
browser 浏览器环境统计数据
deviceName 终端环境名称,PC端或移动端
operateSystemName 操作系统环境名称
browserName 浏览器环境名称
percentage 总占比
videoView 视频总播放量
uniqueViewer 视频总观众数
playDuration 视频总播放时长
pcPlayDuration PC端播放时长,单位秒formatP
formatPcPlayDuration 格式化的PC播放时长,00:00:00
pcVideoView PC端播放量
pcUniqueViewer PC端唯一观众数
pcPercentage PC端数据占比
mobilePlayDuration 移动端播放时长,单位秒
formatMobilePlayDuration 格式化的移动端播放时长,00:00:00
mobileVideoView 移动端播放量
mobileUniqueViewer 移动端播放量
mobilePercentage 移动端数据占比

响应说明

错误代码 message 说明
400 sign can not be empty. 加密串为空
400 ptime is too old. 时间戳过期
400 ptime is illegal. 时间戳参数格式不对或者超过当前时间3分钟
400 Could not find user by userid. userid不存在
400 the sign is not right. 加密串不正确
401 start and end illegal. start日期大于end日期
500 query failed. 后台程序抛异常
200 success 提交成功

PHP请求示例

<?php
header("Content-type: text/html; charset=utf-8");
$userid="用户id";
$start="2018-01-01";
$end="2018-07-06";
$ptime=time()*1000;//13位
$secretkey="secretKey";
$str="end=".$end."&ptime=".$ptime."&start=".$start.$secretkey;

$hash=strtoupper(sha1($str));
$url="http://api.polyv.net/v2/device/$userid?ptime=$ptime&sign=$hash&start=$start&end=$end";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$output = curl_exec($ch);
curl_close($ch);
//打印获得的数据
print_r($output);
?>

签名规则:

将非空的请求参数按照参数名字典顺序排列,连接参数名与参数值,并在尾部加上secretkey,生成40位大写SHA1值,作为sign。 以下是示例过程:

1、请求参数为

ptime = "1492591990000"
vid = "382839019131be68715e9455f8d0971a_3"
format = "json"

2、将请求参数按照参数名字典顺序排列

format = "json"
ptime = "1492591990000"
vid = "382839019131be68715e9455f8d0971a_3"

3、连接字符串
连接参数名与参数值,并在尾部加上secretkey(secretkey的值为tIQp4ATe9Z),如下:

format=json&ptime=1492591990000&vid=382839019131be68715e9455f8d0971a_3tIQp4ATe9Z

4、生成签名sign

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

查询视频播放时段统计数据

接口URL

https://api.polyv.net/v2/hourly/{userid}

接口说明

查询视频播放时段统计数据

支持格式

JSON

请求方式

GET

请求参数

参数名 必选 类型及范围 说明
userid true string 用户id,路径参数
ptime true string 当前13位毫秒级时间戳,3分钟内有效
sign true string 签名,40位大写的sha1值
dr false string 时间段,具体值为以下几个:today(今天),yesterday(昨天),this_week(本周),last_week(上周),7days(最近7天),this_month(本月),last_month(上个月),this_year(今年),last_year(去年),默认值为7days
start false string 开始日期,格式为yyyy-MM-dd
end false string 结束日期,格式为yyyy-MM-dd

返回结果

{
  "code": 200, 
  "status": "success", 
  "message": "success", 
  "data": [
    {
      "currentHour": 0, 
      "formatPcPlayDuration": "00:00:00", 
      "pcPlayDuration": 0, 
      "pcFlowSize": 0, 
      "pcVideoView": 0, 
      "pcUniqueViewer": 0, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDuration": 0, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 0, 
      "mobileUniqueViewer": 0
    }, 
    {
      "currentHour": 1, 
      "formatPcPlayDuration": "00:00:00", 
      "pcPlayDuration": 0, 
      "pcFlowSize": 0, 
      "pcVideoView": 0, 
      "pcUniqueViewer": 0, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDuration": 0, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 0, 
      "mobileUniqueViewer": 0
    }, 
    {
      "currentHour": 2, 
      "formatPcPlayDuration": "00:00:00", 
      "pcPlayDuration": 0, 
      "pcFlowSize": 0, 
      "pcVideoView": 0, 
      "pcUniqueViewer": 0, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDuration": 0, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 0, 
      "mobileUniqueViewer": 0
    }, 
    {
      "currentHour": 3, 
      "formatPcPlayDuration": "00:00:00", 
      "pcPlayDuration": 0, 
      "pcFlowSize": 0, 
      "pcVideoView": 0, 
      "pcUniqueViewer": 0, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDuration": 0, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 0, 
      "mobileUniqueViewer": 0
    }, 
    {
      "currentHour": 4, 
      "formatPcPlayDuration": "00:00:00", 
      "pcPlayDuration": 0, 
      "pcFlowSize": 0, 
      "pcVideoView": 0, 
      "pcUniqueViewer": 0, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDuration": 0, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 0, 
      "mobileUniqueViewer": 0
    }, 
    {
      "currentHour": 5, 
      "formatPcPlayDuration": "00:00:00", 
      "pcPlayDuration": 0, 
      "pcFlowSize": 0, 
      "pcVideoView": 0, 
      "pcUniqueViewer": 0, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDuration": 0, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 0, 
      "mobileUniqueViewer": 0
    }, 
    {
      "currentHour": 6, 
      "formatPcPlayDuration": "00:00:00", 
      "pcPlayDuration": 0, 
      "pcFlowSize": 0, 
      "pcVideoView": 0, 
      "pcUniqueViewer": 0, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDuration": 0, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 0, 
      "mobileUniqueViewer": 0
    }, 
    {
      "currentHour": 7, 
      "formatPcPlayDuration": "00:00:00", 
      "pcPlayDuration": 0, 
      "pcFlowSize": 0, 
      "pcVideoView": 0, 
      "pcUniqueViewer": 0, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDuration": 0, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 0, 
      "mobileUniqueViewer": 0
    }, 
    {
      "currentHour": 8, 
      "formatPcPlayDuration": "00:00:00", 
      "pcPlayDuration": 0, 
      "pcFlowSize": 0, 
      "pcVideoView": 0, 
      "pcUniqueViewer": 0, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDuration": 0, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 0, 
      "mobileUniqueViewer": 0
    }, 
    {
      "currentHour": 9, 
      "formatPcPlayDuration": "00:12:11", 
      "pcPlayDuration": 731, 
      "pcFlowSize": 1503824, 
      "pcVideoView": 9, 
      "pcUniqueViewer": 5, 
      "formatMobilePlayDuration": "00:02:28", 
      "mobilePlayDuration": 148, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 2, 
      "mobileUniqueViewer": 2
    }, 
    {
      "currentHour": 10, 
      "formatPcPlayDuration": "00:00:25", 
      "pcPlayDuration": 25, 
      "pcFlowSize": 7048405, 
      "pcVideoView": 5, 
      "pcUniqueViewer": 5, 
      "formatMobilePlayDuration": "00:00:29", 
      "mobilePlayDuration": 29, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 2, 
      "mobileUniqueViewer": 2
    }, 
    {
      "currentHour": 11, 
      "formatPcPlayDuration": "00:02:08", 
      "pcPlayDuration": 128, 
      "pcFlowSize": 5549169, 
      "pcVideoView": 7, 
      "pcUniqueViewer": 6, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDuration": 0, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 0, 
      "mobileUniqueViewer": 0
    }, 
    {
      "currentHour": 12, 
      "formatPcPlayDuration": "00:00:00", 
      "pcPlayDuration": 0, 
      "pcFlowSize": 0, 
      "pcVideoView": 0, 
      "pcUniqueViewer": 0, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDuration": 0, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 0, 
      "mobileUniqueViewer": 0
    }, 
    {
      "currentHour": 13, 
      "formatPcPlayDuration": "00:00:14", 
      "pcPlayDuration": 14, 
      "pcFlowSize": 4640879, 
      "pcVideoView": 3, 
      "pcUniqueViewer": 2, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDuration": 0, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 0, 
      "mobileUniqueViewer": 0
    }, 
    {
      "currentHour": 14, 
      "formatPcPlayDuration": "00:02:53", 
      "pcPlayDuration": 173, 
      "pcFlowSize": 1633231, 
      "pcVideoView": 8, 
      "pcUniqueViewer": 4, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDuration": 0, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 0, 
      "mobileUniqueViewer": 0
    }, 
    {
      "currentHour": 15, 
      "formatPcPlayDuration": "00:01:24", 
      "pcPlayDuration": 84, 
      "pcFlowSize": 0, 
      "pcVideoView": 2, 
      "pcUniqueViewer": 2, 
      "formatMobilePlayDuration": "00:00:09", 
      "mobilePlayDuration": 9, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 1, 
      "mobileUniqueViewer": 1
    }, 
    {
      "currentHour": 16, 
      "formatPcPlayDuration": "00:00:34", 
      "pcPlayDuration": 34, 
      "pcFlowSize": 1461340, 
      "pcVideoView": 7, 
      "pcUniqueViewer": 2, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDuration": 0, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 0, 
      "mobileUniqueViewer": 0
    }, 
    {
      "currentHour": 17, 
      "formatPcPlayDuration": "00:02:12", 
      "pcPlayDuration": 132, 
      "pcFlowSize": 3809560, 
      "pcVideoView": 10, 
      "pcUniqueViewer": 4, 
      "formatMobilePlayDuration": "00:00:19", 
      "mobilePlayDuration": 19, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 1, 
      "mobileUniqueViewer": 1
    }, 
    {
      "currentHour": 18, 
      "formatPcPlayDuration": "00:06:17", 
      "pcPlayDuration": 377, 
      "pcFlowSize": 0, 
      "pcVideoView": 1, 
      "pcUniqueViewer": 1, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDuration": 0, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 0, 
      "mobileUniqueViewer": 0
    }, 
    {
      "currentHour": 19, 
      "formatPcPlayDuration": "00:00:00", 
      "pcPlayDuration": 0, 
      "pcFlowSize": 0, 
      "pcVideoView": 0, 
      "pcUniqueViewer": 0, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDuration": 0, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 0, 
      "mobileUniqueViewer": 0
    }, 
    {
      "currentHour": 20, 
      "formatPcPlayDuration": "00:00:00", 
      "pcPlayDuration": 0, 
      "pcFlowSize": 0, 
      "pcVideoView": 0, 
      "pcUniqueViewer": 0, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDuration": 0, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 0, 
      "mobileUniqueViewer": 0
    }, 
    {
      "currentHour": 21, 
      "formatPcPlayDuration": "00:00:00", 
      "pcPlayDuration": 0, 
      "pcFlowSize": 0, 
      "pcVideoView": 0, 
      "pcUniqueViewer": 0, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDuration": 0, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 0, 
      "mobileUniqueViewer": 0
    }, 
    {
      "currentHour": 22, 
      "formatPcPlayDuration": "00:00:00", 
      "pcPlayDuration": 0, 
      "pcFlowSize": 0, 
      "pcVideoView": 0, 
      "pcUniqueViewer": 0, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDuration": 0, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 0, 
      "mobileUniqueViewer": 0
    }, 
    {
      "currentHour": 23, 
      "formatPcPlayDuration": "00:00:00", 
      "pcPlayDuration": 0, 
      "pcFlowSize": 0, 
      "pcVideoView": 0, 
      "pcUniqueViewer": 0, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDuration": 0, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 0, 
      "mobileUniqueViewer": 0
    }
  ]
}

失败返回json(不带jsonp)

{
  "code": 400,
  "status": "error",
  "message": "ptime is too old.",
  "data": ""
}

字段描述

字段名称 描述
currentHour 时段
pcPlayDuration pc播放时长,单位为秒
formatPcPlayDuration pc播放时长,格式为00:00:00
pcFlowSize pc消耗流量,单位为字节
pcVideoView pc端播放量
pcUniqueViewer pc端观众量
mobilePlayDuration 移动端播放时长,单位为秒
formatMobilePlayDuration 移动端播放时长,格式为00:00:00
mobileFlowSize 移动端消耗流量,单位为字节
mobileVideoView 移动端播放量
mobileUniqueViewer 移动端观众量

响应说明

错误代码 message 说明
400 sign can not be empty. 加密串为空
400 ptime is too old. 时间戳过期
400 ptime is illegal. 时间戳参数格式不对或者超过当前时间3分钟
400 Could not find user by userid. userid不存在
400 the sign is not right. 加密串不正确
401 start and end illegal. start日期大于end日期
500 query failed. 后台程序抛异常
200 success 提交成功

PHP请求示例

<?php
header("Content-type: text/html; charset=utf-8");
$userid="用户id";
$dr="this_year";
$start="2018-01-01";
$end="2018-07-06";
$ptime=time()*1000;//13位
$secretkey="填写secretkey";
$str="end=".$end."&ptime=".$ptime."&start=".$start.$secretkey;

$hash=strtoupper(sha1($str));
$url="http://api.polyv.net/v2/hourly/$userid?ptime=$ptime&sign=$hash&start=$start&end=$end";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$output = curl_exec($ch);
curl_close($ch);
//打印获得的数据
print_r($output);
?>

签名规则:

将非空的请求参数按照参数名字典顺序排列,连接参数名与参数值,并在尾部加上secretkey,生成40位大写SHA1值,作为sign。 以下是示例过程:

1、请求参数为

ptime = "1492591990000"
vid = "382839019131be68715e9455f8d0971a_3"
format = "json"

2、将请求参数按照参数名字典顺序排列

format = "json"
ptime = "1492591990000"
vid = "382839019131be68715e9455f8d0971a_3"

3、连接字符串
连接参数名与参数值,并在尾部加上secretkey(secretkey的值为tIQp4ATe9Z),如下:

format=json&ptime=1492591990000&vid=382839019131be68715e9455f8d0971a_3tIQp4ATe9Z

4、生成签名sign

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

批量删除弹幕信息

接口URL

https://api.polyv.net/v2/danmu/{userId}/delete

接口说明

批量删除弹幕信息。

支持格式

JSON

请求方式

POST

请求参数

参数名 必选 类型及范围 说明
userid true string 用户id,路径参数
ptime true string 当前13位毫秒级时间戳,3分钟内有效
sign true string 签名,40位大写的sha1值
danmuIds true string 多个弹幕信息ID,用逗号隔开

返回结果

{
code: 200,
status: "success",
message: "success",
data: "success"
}

失败返回json(不带jsonp)

{
  "code": 400,
  "status": "error",
  "message": "ptime is too old.",
  "data": ""
}

字段描述

响应说明

错误代码 message 说明
400 sign can not be empty. 加密串为空
400 ptime is too old. 时间戳过期
400 ptime is illegal. 时间戳参数格式不对或者超过当前时间3分钟
400 Could not find user by userid. userid不存在
400 the sign is not right. 加密串不正确
500 query failed. 后台程序抛异常
200 success 提交成功

PHP请求示例

<?php
header("Content-type: text/html; charset=utf-8");
$userid="用户id";
$ptime=time()*1000;//13位
$secretkey="填写secretkey";
$danmuIds="9999,333333,444";
$str="danmuIds=".$danmuIds"&ptime=".$ptime.$secretkey;

$hash=strtoupper(sha1($str));
$url="https://api.polyv.net/v2/danmu/$userid/delete?ptime=$ptime&sign=$hash";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$output = curl_exec($ch);
curl_close($ch);
//打印获得的数据
print_r($output);
?>

签名规则:

将非空的请求参数按照参数名字典顺序排列,连接参数名与参数值,并在尾部加上secretkey,生成40位大写SHA1值,作为sign。 以下是示例过程:

1、请求参数为

ptime = "1492591990000"
danmuIds = "333,444,556"
format = "json"

2、将请求参数按照参数名字典顺序排列

danmuIds = "333,444,556"
format = "json"
ptime = "1492591990000"

3、连接字符串
连接参数名与参数值,并在尾部加上secretkey(secretkey的值为tIQp4ATe9Z),如下:

damuIds=333,444,556&format=json&ptime=1492591990000tIQp4ATe9Z

4、生成签名sign

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

分页查询用户下所有弹幕信息

接口URL

https://api.polyv.net/v2/danmu/{userId}

接口说明

分页查询用户下所有的弹幕信息。

支持格式

JSON

请求方式

GET

请求参数

参数名 必选 类型及范围 说明
userid true string 用户id,路径参数
ptime true string 当前13位毫秒级时间戳,3分钟内有效
sign true string 签名,40位大写的sha1值
numPerPage false int 单页显示的记录条数
pageNum false int 查询的页数

返回结果

{
code: 200,
status: "success",
message: "success",
data: {
pageNumber: 1,
totalItems: 28,
contents: [
{
id: 43030,
vid: "sl8da4jjbx1c8baed8a48212d735d905_s",
userid: "sl8da4jjbx",
msg: "Iui",
time: "00:00:55",
fontsize: "4294967320",
fontmode: "roll",
fontcolor: "0xFFFFFF",
timestamp: 1529394571000
},
{
id: 37470,
vid: "sl8da4jjbx1c8baed8a48212d735d905_s",
userid: "sl8da4jjbx",
msg: "藏族自治州",
time: "00:00:20",
fontsize: "24",
fontmode: "roll",
fontcolor: "0xFFFFFF",
timestamp: 1528106632000
}
],
startRow: 1,
endRow: 2,
firstPage: true,
lastPage: false,
nextPageNumber: 2,
prePageNumber: 1,
totalPages: 14,
limit: 2,
offset: 0
}
}

失败返回json(不带jsonp)

{
  "code": 400,
  "status": "error",
  "message": "ptime is too old.",
  "data": ""
}

字段描述

字段名称 描述
id 弹幕信息的唯一标识
vid 视频ID
userid 用户ID
msg 弹幕信息内容
time 弹幕出现的时间点
fontsize 弹幕内容的字体大小
fontmode 弹幕内容滚动方式
fontcolor 弹幕内容字体颜色
timestamp 弹幕内容出现的完整时间戳13位毫秒级
pageNumber 当前页
totalItems 总的记录数
totalPages 总的页数

响应说明

错误代码 message 说明
400 sign can not be empty. 加密串为空
400 ptime is too old. 时间戳过期
400 ptime is illegal. 时间戳参数格式不对或者超过当前时间3分钟
400 Could not find user by userid. userid不存在
400 the sign is not right. 加密串不正确
500 query failed. 后台程序抛异常
200 success 提交成功

PHP请求示例

<?php
header("Content-type: text/html; charset=utf-8");
$userid="用户id";
$ptime=time()*1000;//13位
$secretkey="填写secretkey";
$str="ptime=".$ptime.$secretkey;

$hash=strtoupper(sha1($str));
$url="http://api.polyv.net/v2/danmu/$userid?ptime=$ptime&sign=$hash";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$output = curl_exec($ch);
curl_close($ch);
//打印获得的数据
print_r($output);
?>

签名规则:

将非空的请求参数按照参数名字典顺序排列,连接参数名与参数值,并在尾部加上secretkey,生成40位大写SHA1值,作为sign。 以下是示例过程:

1、请求参数为

ptime = "1492591990000"
format = "json"

2、将请求参数按照参数名字典顺序排列

format = "json"
ptime = "1492591990000"
vid = "382839019131be68715e9455f8d0971a_3"

3、连接字符串
连接参数名与参数值,并在尾部加上secretkey(secretkey的值为tIQp4ATe9Z),如下:

format=json&ptime=1492591990000tIQp4ATe9Z

4、生成签名sign

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

查询视频观众量统计数据

接口URL

https://api.polyv.net/v2/data/visitor/{userid}

接口说明

按照日期区间或区段及视频ID查询视频的观众量统计数据,不传vid参数就表示查询用户下所有视频的观众量。

支持格式

JSON

请求方式

GET

请求参数

参数名 必选 类型及范围 说明
userid true string 用户id,路径参数
ptime true string 当前13位毫秒级时间戳,3分钟内有效
sign true string 签名,40位大写的sha1值
dr false string 时间段,具体值为以下几个:today(今天),yesterday(昨天),this_week(本周),last_week(上周),7days(最近7天),this_month(本月),last_month(上个月),this_year(今年),last_year(去年),默认值为7days
start false string 开始日期,格式为yyyy-MM-dd
end false string 结束日期,格式为yyyy-MM-dd
vid false string 单个视频ID

返回结果

{
"code": 200,
"status": "success",
"message": "success",
"data": [
{
"date": "2018-07-09",
"pcUniqueViewer": 0,
"mobileUniqueViewer": 0,
"totalUniqueViewer": 0
}
]
}

失败返回json(不带jsonp)

{
  "code": 400,
  "status": "error",
  "message": "ptime is too old.",
  "data": ""
}

字段描述

字段名称 描述
date 日期
pcUniqueViewer pc端的观看量
mobileUniqueViewer 移动端的观看量
totalUniqueViewer 总的观众量

响应说明

错误代码 message 说明
400 sign can not be empty. 加密串为空
400 ptime is too old. 时间戳过期
400 ptime is illegal. 时间戳参数格式不对或者超过当前时间3分钟
400 Could not find user by userid. userid不存在
400 the sign is not right. 加密串不正确
401 start and end illegal. start日期大于end日期
500 query failed. 后台程序抛异常
200 success 提交成功

PHP请求示例

<?php
header("Content-type: text/html; charset=utf-8");
$userid="用户id";
$dr="this_year";
$ptime=time()*1000;//13位
$secretkey="填写secretkey";
$str="dr=".$dr."&ptime=".$ptime.$secretkey;

$hash=strtoupper(sha1($str));
$url="http://api.polyv.net/v2/data/visitor/$userid?ptime=$ptime&sign=$hash&dr=$dr";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$output = curl_exec($ch);
curl_close($ch);
//打印获得的数据
print_r($output);
?>

签名规则:

将非空的请求参数按照参数名字典顺序排列,连接参数名与参数值,并在尾部加上secretkey,生成40位大写SHA1值,作为sign。 以下是示例过程:

1、请求参数为

ptime = "1492591990000"
vid = "382839019131be68715e9455f8d0971a_3"
format = "json"

2、将请求参数按照参数名字典顺序排列

format = "json"
ptime = "1492591990000"
vid = "382839019131be68715e9455f8d0971a_3"

3、连接字符串
连接参数名与参数值,并在尾部加上secretkey(secretkey的值为tIQp4ATe9Z),如下:

format=json&ptime=1492591990000&vid=382839019131be68715e9455f8d0971a_3tIQp4ATe9Z

4、生成签名sign

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

查询视频播放地理位置统计数据

接口URL

https://api.polyv.net/v2/geo/{userid}

接口说明

按照日期区间或区段查询视频播放地理位置统计数据

支持格式

JSON

请求方式

GET

请求参数

参数名 必选 类型及范围 说明
userid true string 用户id,路径参数
ptime true string 当前13位毫秒级时间戳,3分钟内有效
sign true string 签名,40位大写的sha1值
dr false string 时间段,具体值为以下几个:today(今天),yesterday(昨天),this_week(本周),last_week(上周),7days(最近7天),this_month(本月),last_month(上个月),this_year(今年),last_year(去年),默认值为7days
start false string 开始日期,格式为yyyy-MM-dd
end false string 结束日期,格式为yyyy-MM-dd

返回结果

{
code: 200,
status: "success",
message: "success",
data: [
{
province: "广东",
pcPlayDuration: 1698,
formatPcPlayDuration: "00:28:18",
pcFlowSize: 25646408,
pcVideoView: 52,
pcUniqueViewer: 20,
mobilePlayDuration: 205,
formatMobilePlayDuration: "00:03:25",
mobileFlowSize: 0,
mobileVideoView: 6,
mobileUniqueViewer: 5
}
]
}

失败返回json(不带jsonp)

{
  "code": 400,
  "status": "error",
  "message": "ptime is too old.",
  "data": ""
}

字段描述

字段名称 描述
province 省份
pcPlayDuration pc端播放时长,单位为秒
formatPcPlayDuration 播放时长,格式如00:00:00
pcFlowSize PC端消耗流量,单位字节
pcVideoView PC端播放量
pcUniqueViewer PC端观众量
mobilePlayDuration 移动端播放时长,单位为秒
formatMobilePlayDuration 移动端播放时长,格式如00:00:00
mobileFlowSize 移动端消耗流量,单位字节
mobileVideoView 移动端播放量
mobileUniqueViewer 移动端观众量

响应说明

错误代码 message 说明
400 sign can not be empty. 加密串为空
400 ptime is too old. 时间戳过期
400 ptime is illegal. 时间戳参数格式不对或者超过当前时间3分钟
400 Could not find user by userid. userid不存在
400 the sign is not right. 加密串不正确
401 start and end illegal. start日期大于end日期
500 query failed. 后台程序抛异常
200 success 提交成功

PHP请求示例

<?php
header("Content-type: text/html; charset=utf-8");
$userid="用户id";
$dr="this_year";
$ptime=time()*1000;//13位
$secretkey="填写secretkey";
$str="dr=".$dr."&ptime=".$ptime.$secretkey;

$hash=strtoupper(sha1($str));
$url="http://api.polyv.net/v2/geo/$userid?ptime=$ptime&sign=$hash&dr=$dr";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$output = curl_exec($ch);
curl_close($ch);
//打印获得的数据
print_r($output);
?>

签名规则:

将非空的请求参数按照参数名字典顺序排列,连接参数名与参数值,并在尾部加上secretkey,生成40位大写SHA1值,作为sign。 以下是示例过程:

1、请求参数为

ptime = "1492591990000"
vid = "382839019131be68715e9455f8d0971a_3"
format = "json"

2、将请求参数按照参数名字典顺序排列

format = "json"
ptime = "1492591990000"
vid = "382839019131be68715e9455f8d0971a_3"

3、连接字符串
连接参数名与参数值,并在尾部加上secretkey(secretkey的值为tIQp4ATe9Z),如下:

format=json&ptime=1492591990000&vid=382839019131be68715e9455f8d0971a_3tIQp4ATe9Z

4、生成签名sign

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

删除抓取视频任务

接口URL

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

接口说明

删除抓取视频任务

支持格式

JSON

请求方式

POST

请求数限制

TRUE

请求参数

参数名 必选 类型及范围 说明
ptime true string 当前13位毫秒级时间戳,3分钟内有效
sign true string 签名,40位大写的sha1值
taskId true string 抓取任务ID

JSON示例

{
    code: 200,
    status: "success",
    message: "success",
    data: true
}

返回错误json

{
  "code":400,
  "status":"error",
  "message":"TaskId is null!",
  "data":""
}

PHP示例代码

<?php
  $userid="8205ac89d3";
  $secretkey = "kXmHMLeX6M";
  $ptime=time()*1000;
  $taskId="o0IdvYDm4S";
  $str="ptime=$ptime&taskId=$taskId".$secretkey;
  $sign=strtoupper(sha1($str));
  $url="http://api.polyv.net/v2/video/grab/$userid/delete?ptime=$ptime&sign=$sign&taskId=$taskId";
  $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_CUSTOMREQUEST, "POST");
  $output = curl_exec($ch);
  curl_close($ch);
  print_r($output);
?>

签名规则:

将非空的请求参数按照参数名字典顺序排列,连接参数名与参数值,并在尾部加上secretkey,生成40位大写SHA1值,作为sign。 以下是示例过程:

1、请求参数为

  "ptime"=1527228607000;
  "taskId"="o0IdvYDm4S";

2、将请求参数按照参数名字典顺序排列

  "ptime"=1527228607000;
  "taskId"="o0IdvYDm4S";

3、连接字符串
连接参数名与参数值,并在尾部加上secretkey(此处secretkey的值为kXmHMLeX6M),如下:

ptime=1527228607000&taskId=o0IdvYDm4SkXmHMLeX6M

4、生成签名sign
生成40位大写SHA1值

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

导出视频同步任务

接口URL

http://api.polyv.net/v2/video/grab/{userid}/listVideos/export

接口说明

导出抓取任务列表的csv文件

请求方式

GET

请求数限制

TRUE

请求参数

参数名 必选 类型及范围 说明
ptime true string 当前13位毫秒级时间戳,3分钟内有效
sign true string 签名,40位大写的sha1值
taskId true string 抓取任务ID

返回说明

错误返回json信息 contentType="application/json;charset=UTF-8"

成功返回csv文件
contentType="text/csv;charset=UTF-8"

返回错误json

{
  "code":400,
  "status":"error",
  "message":"TaskId is null!",
  "data":""
}

PHP示例代码

<?php
  $userid="8205ac89d3";
  $secretkey = "kXmHMLeX6M";
  $ptime=time()*1000;
  $taskId="hHepZ2SjlE";
  $str = "ptime=$ptime&taskId=$taskId".$secretkey;
  $sign=strtoupper(sha1($str));
  $url="http://api.polyv.net/v2/video/grab/$userid/listVideos/export?ptime=$ptime&sign=$sign&taskId=$taskId";
  echo "<script>location.href='$url'</script>";
?>

签名规则:

将非空的请求参数按照参数名字典顺序排列,连接参数名与参数值,并在尾部加上secretkey,生成40位大写SHA1值,作为sign。 以下是示例过程:

1、请求参数为

  "ptime"=1527228607000;
  "taskId"="o0IdvYDm4S";

2、将请求参数按照参数名字典顺序排列

  "ptime"=1527228607000;
  "taskId"="o0IdvYDm4S";

3、连接字符串
连接参数名与参数值,并在尾部加上secretkey(此处secretkey的值为kXmHMLeX6M),如下:

ptime=1527228607000&taskId=o0IdvYDm4SkXmHMLeX6M

4、生成签名sign
生成40位大写SHA1值

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

设置分类属性

接口URL

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

接口说明

设置某一级分类的分类属性

支持格式

JSON

请求方式

GET,POST

请求数限制

TRUE

请求参数

参数名 必选 类型及范围 说明
ptime true string 当前13位毫秒级时间戳,3分钟内有效
sign true string 签名,40位大写的sha1值
cataid true string 分类ID,仅能设置一级分类的属性
isSettings false string 是否启用设置,Y为开启,N为关闭
keepSource false string 源文件播放,1为开启,0为关闭;开启时不对视频进行转码(仅对新上传视频有效)
adownload false string 视频加密设置(仅对新上传视频有效)
hlslevel false string 移动端加密设置,有效取值为 open: 非加密授权;web: WEB授权;app: APP授权;wxa_app:小程序授权
isEdu false string 视频优化,1为开启,0为关闭(仅对新上传视频生效)
encode_aac false string 生成音频文件,1为开启,0为关闭(该功能只对部分有权限用户开放,且只对新上传视频生效)

JSON示例

{
    code: 200,
    status: "success",
    message: "success",
    data: true
}

返回错误json

{
  "code":400,
  "status":"error",
  "message":"sign can not be empty.",
  "data":""
}

PHP示例代码

<?php
  $userid="efbb4ae8ac";
  $secretkey= "hbjCVBhnth";
  $cataid="1524732771473";
  $ptime=time()*1000;
  $isSettings="Y";
  $adownload="0";
  $keepSource="1";
  $hlslevel="open";
  $isEdu="1";
  $encode_aac="1";
  $str="adownload=$adownload&cataid=$cataid&encode_aac=$encode_aac&hlslevel=$hlslevel&isEdu=$isEdu&isSettings=$isSettings&keepSource=$keepSource&ptime=$ptime".$secretkey;
  $url="http://api.polyv.net/v2/video/$userid/updateCataProfile?ptime=$ptime&sign=$sign&adownload=$adownload&cataid=$cataid&encode_aac=$encode_aac&hlslevel=$hlslevel&isEdu=$isEdu&isSettings=$isSettings&keepSource=$keepSource";
  $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);
?>

签名规则:

将非空的请求参数按照参数名字典顺序排列,连接参数名与参数值,并在尾部加上secretkey,生成40位大写SHA1值,作为sign。 以下是示例过程:

1、请求参数为

  "cataid"="1458806129324";
  "ptime"=time()*1000;
  "adownload"="0";
  "keepSource"="1";

2、将请求参数按照参数名字典顺序排列

"adownload"="0";
"cataid"="1458806129324";
"keepSource"="1";
"ptime"=time()*1000;

3、连接字符串
连接参数名与参数值,并在尾部加上secretkey(secretkey的值为3OmoLbTlHu),如下:

adownload=0&cataid=1458806129324&keepSource=1&ptime=15271306190003OmoLbTlHu

4、生成签名sign

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

上传某一级分类的视频水印

接口URL

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

接口说明

上传某一级分类的视频水印

支持格式

JSON

请求方式

POST

请求数限制

TRUE

请求参数

参数名 必选 类型及范围 说明
image true File 上传的图片
cataid true string 分类ID,仅一级分类能设置水印
watermarkLocation false string 水印显示的位置:1:左上角;2:右上角;3:左下角;4:右下角;0:不显示水印
sign true string 签名,40位大写的sha1值
ptime true string 当前13位毫秒级时间戳,3分钟内有效

JSON示例

{
    code: 200,
    status: "success",
    message: "success",
    data: true
}

返回错误json

{
    "code":400,
    "status":"error",
    "message":"sign can not be empty.",
    "data":""
}

PHP示例代码

<?php
$userid="2d939377c2";
$cataid="1458806129324";
$watermarkLocation="1";
$ptime=time()*1000;
$secretkey="3OmoLbTlHu";
$str="cataid=$cataid&ptime=$ptime&watermarkLocation=$watermarkLocation".$secretkey;
echo $str;
$sign=strtoupper(sha1($str));
?>
<!DOCTYPE html>
<html>
<head>
   <meta charset="utf-8">
   <title>上传PPT</title>
</head>
<body>
   <form action="http://api.polyv.net/v2/video/<?php echo $userid; ?>/watermarkSetting" method="post" enctype='multipart/form-data'>
     <input type="hidden" name="ptime" value="<?php echo $ptime; ?>">
     <input type="hidden" name="vid" value="<?php echo $vid; ?>">
     <input type="hidden" name="sign" value="<?php echo $sign; ?>">
     ppt:<input type="file" name="image" id="fileupload1" /><br>
   <input type="submit" value="点击上传"/>
 </form>
</body>
</html>

签名规则

将非空的请求参数按照参数名字典顺序排列,连接参数名与参数值,并在尾部加上secretkey,生成40位大写SHA1值,作为sign。 以下是示例过程:

1、请求参数为

"ptime" = "1493188350000"
"cataid" = "3828390191de2b3fd3467c36187aac08_3"
"watermarkLocation"="1"

2、将请求参数按照参数名字典顺序排列

"cataid" = "3828390191de2b3fd3467c36187aac08_3"
"ptime" = "1493188350000"
"watermarkLocation"="1"

3、连接字符串
连接参数名与参数值,并在尾部加上secretkey(secretkey的值为3OmoLbTlHu),如下:

cataid=1458806129324&ptime=1527144074000&watermarkLocation=13OmoLbTlHu

4、生成签名sign

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