1.1 获取点播信息接口App.md
3.37 KB
/* Title: 1.1 获取点播信息接口 */
接口描述
接口地址
http://api.cnlive.com/open/api2/vod_epg/getVodInfo4App
接口协议
HTTP GET
接口请求参数
| 参数名 | 参数类型 | 必选 | 参数说明 |
|---|---|---|---|
| appId | string | true | 应用ID |
| vId | string | true | 点播节目标识 |
| platform_id | string | true | APP bundleID 或者是包名,平台鉴权使用 |
| timestamp | int | true | 精确到秒,当前Unix时间戳,请保证请求服务器时间正确 |
| sign | String | true | 签名规则见 签名详情 |
返回值
| 参数名 | 参数类型 | 必选 | 参数说明 |
|---|---|---|---|
| errorCode | int | true | 错误类型号 |
| errorMessage | string | true | 错误类型 |
| title | string | true | 节目标题 |
| subTitle | string | false | 节目副标题 |
| description | string | false | 节目描述 |
| createTime | string | true | 创建时间,格式:yyyyMMddHHmmss |
| publishTime | string | true | 发布时间,格式:yyyyMMddHHmmss |
| status | string | true | 节目状态,0:待发布,1:已发布,2:下线 |
| vId | string | true | 节目的唯一标识 |
| rates | string | ture | 清晰度标识,多个用逗号隔开: 流畅版=1,清晰版=2,高清版=3,超高清=4 |
返回JSON格式的节目元数据信息,json示例如下:
{
"errorMessage":"请求成功",
"data":{
"createTime":"20160808125905",
"publishTime":"20160808131657",
"status":"1",
"vId":"174e6c5f3d9e4ddeb739feed1906fa11",
"vipFlag":"0",
"packagePomID":"3_ent/xingwenrebao/yuleqianxian/",
"subTitle":"BTOB对粉丝甜喊:我想你们了",
"rates":"1,2,4",
"title":"BTOB甜喊:我想你们了",
"description":"@TV娱乐前线:韩国男团BTOB近日在台北国际会议中心举行演唱会。",
},
"errorCode":"0"
}
java 示例
public Object getVodUrl() {
String result = "";
Map params = new HashMap<>();
params.put("appId", "60_iqj730vn11");
params.put("vId", "174e6c5f3d9e4ddeb739feed1906fa11");
params.put("timestamp", System.currentTimeMillis()/1000+"");
String url = OpenUtil.buildURL("http://api.cnlive.com/open/api/dianbo/getVodInfo4App", params, "appId对应key值");
HttpURLConnection connection;
try {
URL requestUrl = new URL(url);
connection = (HttpURLConnection)requestUrl.openConnection();
connection.setRequestMethod("GET");
connection.setDoInput(true);
connection.setDoOutput(true);
connection.connect();//连接
//获得返回值
if(connection.getResponseCode() == HttpURLConnection.HTTP_OK){
InputStream in = connection.getInputStream();
String currentLine = "";
if(in != null){
BufferedReader br = new BufferedReader(new InputStreamReader(in,"utf-8"));
while((currentLine = br.readLine()) != null){
result += currentLine;
}
br.close();
}
}
}catch (Exception e) {
e.printStackTrace();
}
if(BaseUtil.notBlank(result)) {
JSONObject resultJson = JSONObject.parseObject(result);
return resultJson
}
return "";
}