Commit 6b93251532963153897456f4eb5073b2b37dd22d

Authored by 刘炯
1 parent 529c732c

点播列表接口

01.点播云/1.11 获取点播列表接口App.md 0 → 100644
  1 +/*
  2 +Title: 1.1 获取点播信息接口
  3 +*/
  4 +
  5 +### 接口描述 ###
  6 +
  7 +
  8 +### 接口地址 ###
  9 +http://api.cnlive.com/open/api2/vod_epg/getVodInfo4App
  10 +
  11 +### 接口协议 ###
  12 +HTTP GET
  13 +
  14 +### 接口请求参数 ###
  15 +|参数名| 参数类型 | 必选 | 参数说明 |
  16 +|:----- | :------: | :------: | :------: |
  17 +|appId| string | true | 应用ID |
  18 +|vId| string | true | 点播节目标识 |
  19 +|platform_id| string | true | APP bundleID 或者是包名,平台鉴权使用 |
  20 +|timestamp| int | true | 精确到秒,当前Unix时间戳,请保证请求服务器时间正确 |
  21 +|sign| String | true | 签名规则见 [签名详情] (http://help.open.cnlive.com/common.html) |
  22 +
  23 +### 返回值 ###
  24 +
  25 +| 参数名 | 参数类型 | 必选 | 参数说明 |
  26 +| :-----------| :------: | :------: | :------: |
  27 +| errorCode| int | true | 错误类型号 |
  28 +| errorMessage| string | true | 错误类型 |
  29 +| title| string | true | 节目标题 |
  30 +| subTitle| string | false | 节目副标题 |
  31 +| description| string | false | 节目描述 |
  32 +| createTime| string | true | 创建时间,格式:yyyyMMddHHmmss |
  33 +| publishTime| string | true | 发布时间,格式:yyyyMMddHHmmss |
  34 +| status| string | true | 节目状态,0:待发布,1:已发布,2:下线 |
  35 +| vId| string | true | 节目的唯一标识 |
  36 +| rates | string | ture |清晰度标识,多个用逗号隔开: 流畅版=1,清晰版=2,高清版=3,超高清=4 |
  37 +
  38 +返回JSON格式的节目元数据信息,json示例如下:
  39 +
  40 +``` json
  41 +{
  42 + "errorMessage":"请求成功",
  43 + "data":{
  44 + "createTime":"20160808125905",
  45 + "publishTime":"20160808131657",
  46 + "status":"1",
  47 + "vId":"174e6c5f3d9e4ddeb739feed1906fa11",
  48 + "vipFlag":"0",
  49 + "packagePomID":"3_ent/xingwenrebao/yuleqianxian/",
  50 + "subTitle":"BTOB对粉丝甜喊:我想你们了",
  51 + "rates":"1,2,4",
  52 + "title":"BTOB甜喊:我想你们了",
  53 + "description":"@TV娱乐前线:韩国男团BTOB近日在台北国际会议中心举行演唱会。",
  54 + },
  55 + "errorCode":"0"
  56 +}
  57 +```
  58 +#### java 示例
  59 +
  60 +```java
  61 +public Object getVodUrl() {
  62 + String result = "";
  63 + Map params = new HashMap<>();
  64 + params.put("appId", "60_iqj730vn11");
  65 + params.put("vId", "174e6c5f3d9e4ddeb739feed1906fa11");
  66 + params.put("timestamp", System.currentTimeMillis()/1000+"");
  67 + String url = OpenUtil.buildURL("http://api.cnlive.com/open/api/dianbo/getVodInfo4App", params, "appId对应key值");
  68 + HttpURLConnection connection;
  69 + try {
  70 + URL requestUrl = new URL(url);
  71 + connection = (HttpURLConnection)requestUrl.openConnection();
  72 + connection.setRequestMethod("GET");
  73 + connection.setDoInput(true);
  74 + connection.setDoOutput(true);
  75 + connection.connect();//连接
  76 +
  77 + //获得返回值
  78 + if(connection.getResponseCode() == HttpURLConnection.HTTP_OK){
  79 + InputStream in = connection.getInputStream();
  80 + String currentLine = "";
  81 + if(in != null){
  82 + BufferedReader br = new BufferedReader(new InputStreamReader(in,"utf-8"));
  83 + while((currentLine = br.readLine()) != null){
  84 + result += currentLine;
  85 + }
  86 + br.close();
  87 + }
  88 + }
  89 + }catch (Exception e) {
  90 + e.printStackTrace();
  91 + }
  92 +
  93 + if(BaseUtil.notBlank(result)) {
  94 + JSONObject resultJson = JSONObject.parseObject(result);
  95 + return resultJson
  96 + }
  97 +
  98 + return "";
  99 + }
  100 +```
0 \ No newline at end of file 101 \ No newline at end of file