コード例 #1
0
ファイル: XLLXBiz.java プロジェクト: alexliyu/VSTV
  public static ArrayList<VideoPlayUrl> getLXPlayUrl_2(Context context, XLLXFileInfo info) {
    ArrayList<VideoPlayUrl> urls = new ArrayList<VideoPlayUrl>();
    try {
      // BT文件夹转码没有完成或失败
      if (info.isDir || info.file_name == null || info.src_url == null) {
        return urls;
      }
      String CookieUID =
          "userid=" + XLLXBiz.getUID(context) + "; sessionid=" + XLLXBiz.getSessionid(context);
      for (int i = 2; i > 0; i--) {
        String json =
            HttpUtils.getContent(
                GET_PLAY_URL_2,
                new Header[] {
                  new BasicHeader(XLLXBiz.COOKIE, CookieUID), new BasicHeader("Referer", REFERER)
                },
                new NameValuePair[] {
                  new BasicNameValuePair("url", URLEncoder.encode(info.src_url)),
                  new BasicNameValuePair("video_name", URLEncoder.encode(info.file_name)),
                  new BasicNameValuePair("platform", i + ""),
                  new BasicNameValuePair("userid", XLLXBiz.getUID(context)),
                  new BasicNameValuePair("vip", "1"),
                  new BasicNameValuePair("sessionid", XLLXBiz.getSessionid(context)),
                  new BasicNameValuePair("cache", System.currentTimeMillis() + ""),
                  new BasicNameValuePair("from", "vlist")
                });

        Log.d(TAG, "play url 2 : json =" + json);
        JSONTokener jsonParser = new JSONTokener(json);
        JSONObject object = (JSONObject) jsonParser.nextValue();
        JSONObject resp = object.getJSONObject("resp");
        if (resp.has("src_info")) {

          JSONArray array = resp.getJSONArray("vodinfo_list");
          Log.d("", "" + array.length());
          for (int j = 0; j < array.length(); j++) {
            VideoPlayUrl playurl = new VideoPlayUrl();
            JSONObject urlobject = array.getJSONObject(j);
            playurl.playurl = urlobject.getString("vod_url");
            playurl.sharp = SharpnessEnum.getSharp(j);
            urls.add(playurl);
          }
        }
        if (urls.size() > 0) {
          return urls;
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
    return urls;
  }
コード例 #2
0
ファイル: XLLXBiz.java プロジェクト: alexliyu/VSTV
  public static ArrayList<VideoPlayUrl> getLXPlayUrl_1(Context context, XLLXFileInfo info) {
    ArrayList<VideoPlayUrl> urls = new ArrayList<VideoPlayUrl>();
    try {
      if (info.isDir) { // 文件夹 没有解析播放地址
        return urls;
      }
      String CookieUID =
          "userid=" + XLLXBiz.getUID(context) + "; sessionid=" + XLLXBiz.getSessionid(context);
      String list_json =
          HttpUtils.getContent(
              GET_PLAY_URL_1,
              new Header[] {new BasicHeader(XLLXBiz.COOKIE, CookieUID)},
              new NameValuePair[] {
                new BasicNameValuePair("userid", info.userid),
                new BasicNameValuePair("gcid", info.gcid),
                new BasicNameValuePair("filename", URLEncoder.encode(info.src_url))
              });
      JSONTokener jsonParser = new JSONTokener(list_json);
      JSONObject object = (JSONObject) jsonParser.nextValue();
      JSONObject full_HD_Object = object.getJSONObject("Full_HD");
      Log.d(TAG, full_HD_Object + "");
      if (full_HD_Object.has("url") && !full_HD_Object.isNull("url")) {
        VideoPlayUrl playurl = new VideoPlayUrl();
        playurl.playurl = full_HD_Object.getString("url");
        playurl.sharp = SharpnessEnum.getSharp(3);
        urls.add(playurl);
      }

      JSONObject HD_Object = object.getJSONObject("HD");
      if (HD_Object.has("url") && !HD_Object.isNull("url")) {
        VideoPlayUrl playurl = new VideoPlayUrl();
        playurl.playurl = HD_Object.getString("url");
        playurl.sharp = SharpnessEnum.getSharp(2);
        urls.add(playurl);
      }
      JSONObject SD_Object = object.getJSONObject("SD");
      if (SD_Object.has("url") && !SD_Object.isNull("url")) {
        VideoPlayUrl playurl = new VideoPlayUrl();
        playurl.playurl = SD_Object.getString("url");
        playurl.sharp = SharpnessEnum.getSharp(0);
        urls.add(playurl);
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
    return urls;
  }
コード例 #3
0
ファイル: XLLXBiz.java プロジェクト: alexliyu/VSTV
  public static XLLXFileInfo[] getSubFile(Context context, XLLXFileInfo btdir) {
    String CookieUID = XLLXBiz.getUserUID(context);
    if (isNumeric(CookieUID) && CookieUID != "-") {
      CookieUID = "userid=" + CookieUID + ";";
    } else {
      CookieUID =
          "userid=" + XLLXBiz.getUID(context) + "; sessionid=" + XLLXBiz.getSessionid(context);
    }
    Log.d(TAG, "CookieUID= " + CookieUID);
    Header cookie = new BasicHeader(XLLXBiz.COOKIE, CookieUID);
    try {
      String suburl =
          "http://i.vod.xunlei.com/req_subBT/info_hash/"
              + btdir.src_url.substring(5)
              + "/req_num/30/req_offset/0";
      String btjson = HttpUtils.getContent(suburl, new Header[] {cookie}, null);
      btjson = URLDecoder.decode(btjson);
      JSONTokener btjsonParser = new JSONTokener(btjson);
      JSONObject btobject = (JSONObject) btjsonParser.nextValue();
      JSONObject btresp = btobject.getJSONObject("resp");
      JSONArray btsubfile_list = btresp.getJSONArray("subfile_list");
      XLLXFileInfo[] btFiles = new XLLXFileInfo[btsubfile_list.length()];
      for (int j = 0; j < btsubfile_list.length(); j++) {
        JSONObject btsubfile = btsubfile_list.getJSONObject(j);
        Log.d(TAG, "btsubfile = " + btsubfile);
        btFiles[j] = new XLLXFileInfo();
        btFiles[j].file_name = btsubfile.getString("name");
        btFiles[j].src_url = btdir.src_url + "/" + btsubfile.getString("index");
        btFiles[j].createTime = btdir.createTime;
        btFiles[j].duration = btsubfile.getString("duration");
        btFiles[j].filesize = btsubfile.getString("file_size");
        btFiles[j].gcid = btsubfile.getString("gcid");
        btFiles[j].userid = btdir.userid;
      }
      btdir.btFiles = btFiles;
      return btFiles;
    } catch (Exception e) {
      e.printStackTrace();
    }

    return null;
  }
コード例 #4
0
ファイル: XLLXBiz.java プロジェクト: alexliyu/VSTV
  /**
   * 获取 XL 云播的 视频列表
   *
   * @param context
   * @param per 一页的个数 >=1
   * @param page 页码 从第一页开始
   * @return
   */
  public static ArrayList<XLLXFileInfo> getVideoList(Context context, int per, int page) {
    try {
      String CookieUID = XLLXBiz.getUserUID(context);
      if (isNumeric(CookieUID) && CookieUID != "-") {
        CookieUID = "userid=" + CookieUID + ";";
      } else {
        CookieUID =
            "userid=" + XLLXBiz.getUID(context) + "; sessionid=" + XLLXBiz.getSessionid(context);
      }
      Log.d(TAG, "CookieUID= " + CookieUID);
      Header cookie = new BasicHeader(XLLXBiz.COOKIE, CookieUID);
      String url =
          "http://i.vod.xunlei.com/req_history_play_list/req_num/"
              + per
              + "/req_offset/"
              + per * (page - 1);

      String json =
          HttpUtils.getContent(
              url,
              new Header[] {cookie},
              new NameValuePair[] {
                new BasicNameValuePair("type", "all"),
                new BasicNameValuePair("order", "create"),
                new BasicNameValuePair("t", String.valueOf(System.currentTimeMillis()))
              });
      if (json == null) {
        return null;
      }
      json = URLDecoder.decode(json);
      Log.d(TAG, "getVideoList  json= " + json);
      JSONTokener jsonParser = new JSONTokener(json);
      JSONObject object = (JSONObject) jsonParser.nextValue();
      JSONObject resp = object.getJSONObject("resp");
      int recodenum = resp.getInt("record_num");
      Log.d(TAG, "getVideoList  record_num= " + recodenum);
      JSONArray history_play_list = resp.getJSONArray("history_play_list");
      ArrayList<XLLXFileInfo> list = new ArrayList<XLLXFileInfo>();
      for (int i = 0; i < history_play_list.length(); i++) {
        XLLXFileInfo info = new XLLXFileInfo();
        JSONObject historyPlay = history_play_list.getJSONObject(i);
        info.file_name = (historyPlay.getString("file_name"));
        info.src_url = (historyPlay.getString("src_url"));
        info.createTime = historyPlay.getString("createtime");
        info.duration = historyPlay.getString("duration");
        info.filesize = historyPlay.getString("file_size");
        info.userid = historyPlay.getString("userid");
        info.urlhash = historyPlay.getString("url_hash");
        info.gcid = historyPlay.getString("gcid");
        info.cid = historyPlay.getString("cid");
        info.recodenum = recodenum;
        if (info.src_url.contains("bt://")) {
          info.isDir = true;
        }
        list.add(info);
      }
      return list;

    } catch (Exception e) {
      e.printStackTrace();
    }
    return null;
  }