查詢時間範圍內頻道直播觀看詳細資料
更新時間:2025-07-30 10:13:32
介面描述
1、通过频道号获取该频道某段时间的直播观看的统计数据
2、接口支持https协议
介面URL
http://api.polyv.net/live/v3/channel/statistics/daily/summary
請求方式
GET
介面限制
1、介面同時支援HTTP、HTTPS,建議使用HTTPS以確保介面安全,介面呼叫有頻率限制,詳細請查看
2、開始日期與結束日期的時間跨度不得超過60天
請求參數描述
| 參數名 | 必選 | 類型 | 說明 |
|---|---|---|---|
| appId | true | String | 帳號appId【詳見取得金鑰】 |
| timestamp | true | Long | 目前13位毫秒級時間戳,3分鐘內有效 |
| sign | true | String | 簽名,為32位大寫的MD5值,產生簽名的appSecret金鑰作為通訊資料安全的關鍵資訊,嚴禁儲存在用戶端直接使用,所有API都必須透過客戶自己的伺服器中轉呼叫POLYV伺服器取得回應資料【詳見簽名產生規則】 |
| channelId | true | String | 頻道號 |
| startDay | true | String | 開始日期,格式:yyyy-MM-dd |
| endDay | true | String | 結束日期,格式:yyyy-MM-dd |
範例
http://api.polyv.net/live/v3/channel/statistics/daily/summary?startDay=2021-6-1&appId=frlr1zazn3&endDay=2021-7-11&sign=3A891F01997FC54E486A1807C6E6DBF6&channelId=1965681×tamp=1652410270091
回應參數描述
| 欄位 | 類型 | 說明 |
|---|---|---|
| status | String | 狀態值 |
| result | Array | 相應的結果 【詳見Result參數描述】 |
Result參數描述
| 參數名 | 類型 | 說明 |
|---|---|---|
| currentDay | String | 查詢日期,格式:yyyy-MM-dd |
| channelId | String | 頻道號 |
| userId | String | 直播帳號ID |
| pcPlayDuration | Integer | PC端播放時長,單位:分鐘 |
| pcVideoView | Integer | PC端總播放量,類似PV |
| pcUniqueViewer | Integer | PC端唯一觀眾數,類似UV |
| mobilePlayDuration | Integer | 行動端播放時長,單位:分鐘 |
| mobileVideoView | Integer | 行動端總播放量,類似PV |
| mobileUniqueViewer | Integer | 行動端唯一觀眾數,類似UV |
| createdTime | Long | 記錄新增的時間,13位毫秒級時間戳 |
| lastModified | Long | 記錄修改的時間,13位毫秒級時間戳 |
| creatorId | String | 建立帳號的子帳號使用者ID(為空則為主帳號建立) |
| creatorName | String | 建立頻道的子帳號名稱(主帳號建立的則顯示"主帳號") |
Java請求範例
快速接入基礎程式碼請下載相關依賴原始碼, 點擊下載原始碼 ,下載後加入到自己的原始碼工程中即可。測試案例中的HttpUtil.java 和 LiveSignUtil.java 都包含在下載檔案中。
強烈建議您使用直播Java SDK完成API的功能對接,直播Java SDK 對API呼叫邏輯、例外處理、資料簽名、HTTP請求執行緒池進行了統一封裝和最佳化。
private static final Logger log = LoggerFactory.getLogger(ChannelViewDataTest.class);
/**
* 查询频道某段时间的直播观看详情数据
* @throws IOException
*/
@Test
public void testSummary() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId = super.appId;
String appSecret = super.appSecret;
String userId = super.userId;
String timestamp = String.valueOf(System.currentTimeMillis());
//业务参数
String url = "http://api.polyv.net/live/v3/channel/statistics/daily/summary";
String channelId = "1965681";
String startDay = "2021-6-1";
String endDay = "2021-7-11";
//http 调用逻辑
Map<String,String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp",timestamp);
requestMap.put("channelId",channelId);
requestMap.put("startDay",startDay);
requestMap.put("endDay",endDay);
requestMap.put("sign",LiveSignUtil.getSign(requestMap, appSecret));
String response = HttpUtil.get(url, requestMap);
log.info("测试查询频道某段时间的直播观看详情数据,返回值:{}",response);
//do somethings
}
回應範例
系統全域錯誤說明詳見全域錯誤說明
成功範例
{
"status":"success",
"result":[
{
"currentDay":"2020-10-20",
"channelId":1965681,
"userId":"1b448be323",
"pcPlayDuration":7,
"pcVideoView":7,
"pcUniqueViewer":1,
"mobilePlayDuration":0,
"mobileVideoView":0,
"mobileUniqueViewer":0,
"createdTime":1603218100000,
"lastModified":1603218100000,
"creatorId":"1b448be323",
"creatorName":"主账号"
},
{
"currentDay":"2020-10-26",
"channelId":1965681,
"userId":"1b448be323",
"pcPlayDuration":17,
"pcVideoView":12,
"pcUniqueViewer":1,
"mobilePlayDuration":2,
"mobileVideoView":1,
"mobileUniqueViewer":1,
"createdTime":1603736505000,
"lastModified":1603736505000,
"creatorId":"1b448be323",
"creatorName":"主账号"
},
{
"currentDay":"2020-11-12",
"channelId":1965681,
"userId":"1b448be323",
"pcPlayDuration":1,
"pcVideoView":1,
"pcUniqueViewer":1,
"mobilePlayDuration":0,
"mobileVideoView":0,
"mobileUniqueViewer":0,
"createdTime":1605205271000,
"lastModified":1605205271000,
"creatorId":"1b448be323",
"creatorName":"主账号"
},
{
"currentDay":"2020-12-03",
"channelId":1965681,
"userId":"1b448be323",
"pcPlayDuration":1,
"pcVideoView":1,
"pcUniqueViewer":1,
"mobilePlayDuration":0,
"mobileVideoView":0,
"mobileUniqueViewer":0,
"createdTime":1607019680000,
"lastModified":1607019680000,
"creatorId":"1b448be323",
"creatorName":"主账号"
}
]
}
異常範例
{
"code": 400,
"status": "error",
"message": "invalid signature.",
"data": ""
}
