public async Task <string> GetPlayUrl() { try { var results = await PlayerAPI.VideoPlayUrl(VideoInfo.aid, VideoInfo.pages[0].cid, 80, false).Request(); if (results.status) { var data = await results.GetJson <ApiDataModel <JObject> >(); if (data.success) { return(data.data["durl"][0]["url"].ToString()); } else { Utils.ShowMessageToast(data.message); return(""); } } else { Utils.ShowMessageToast(results.message); return(""); } } catch (Exception ex) { var handel = HandelError <string>(ex); Utils.ShowMessageToast(handel.message); return(""); } }
private async Task <ApiDataModel <FlvModel> > GetBiliBiliFlv(PlayInfo playInfo, int qn) { try { var api = PlayerAPI.VideoPlayUrl(aid: playInfo.avid, cid: playInfo.cid, qn: qn, false); if (playInfo.play_mode == VideoPlayType.Season) { api = PlayerAPI.SeasonPlayUrl(aid: playInfo.avid, cid: playInfo.cid, qn: qn, season_type: playInfo.season_type, false); } var result = await api.Request(); if (result.status) { var obj = result.GetJObject(); FlvModel flvData = null; if (obj["code"].ToInt32() != 0 || result.results.Contains("8986943")) { var bp = await GetBiliPlusFlv(playInfo, qn); return(new ApiDataModel <FlvModel>() { code = bp.code, message = bp.message, data = bp.data }); } if (obj["data"] != null) { flvData = JsonConvert.DeserializeObject <FlvModel>(obj["data"].ToString()); } if (obj["result"] != null && obj["result"].ToString() != "suee") { flvData = JsonConvert.DeserializeObject <FlvModel>(obj["result"].ToString()); } if (obj["durl"] != null) { flvData = JsonConvert.DeserializeObject <FlvModel>(obj.ToString()); } return(new ApiDataModel <FlvModel>() { code = 0, message = "", data = flvData }); //var data = await result.GetJson<ApiDataModel<FlvModel>>(); //if (data.code != 0|| result.results.Contains("8986943")) //{ // //return await GetBiliPlusFlv(playInfo, qn); //} //if (data.data == null) //{ // data.data = await result.GetJson<FlvModel>(); //} //return data; } else { if (playInfo.play_mode == VideoPlayType.Season) { var bp = await GetBiliPlusFlv(playInfo, qn); return(new ApiDataModel <FlvModel>() { code = bp.code, message = bp.message, data = bp.data }); } return(new ApiDataModel <FlvModel>() { code = -998, message = result.message }); } } catch (Exception ex) { var data = HandelError <object>(ex); return(new ApiDataModel <FlvModel>() { code = -999, message = data.message }); } }