/// <summary> /// 获得一个资源下面的所有可播放格式的DownloadModel模型 /// </summary> /// <param name="html"></param> /// <param name="httpWeb"></param> /// <param name="taskid"></param> /// <returns></returns> private static DownloadModel[] GetDownloadModelForHtml(string html, Cf_HttpWeb httpWeb, string taskid) { var data = html.LastExtractString("在线播放</a></li>", "<a onclick="); var djangoid = data.Select(o => o.ExtractStringNoQH("djangoid=\"", "\"").FirstOrDefault()).ToArray(); var name = data.Select(o => o.ExtractStringNoQH("filename=\"", "\"").FirstOrDefault()).ToArray(); DownloadModel[] downloadModels = new DownloadModel[djangoid.Length]; // 注意此处要求djangoid和name的数量必须相等,这里不做判断了,默认相等,出异常再说 for (int i = 0; i < djangoid.Length; i++) { var link = $"{_downloadlink}&djangoID={djangoid[i]}&filename={name[i]}&_={Cf_Web.currenttime()}"; httpWeb.Referer = "http://mydiskm.uc.cn/uclxmgr/btDetail?uc_param_str=frpfvesscplaprnisieint&taskId=" + taskid; httpWeb.Accpet = "application/json, text/javascript, */*"; httpWeb.UserAgent = "Mozilla/5.0 (Linux; U; Android 4.3; zh-CN; TianTian Build/tt) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 UCBrowser/10.6.0.620 U3/0.8.0 Mobile Safari/534.30"; httpWeb.EncodingSet = "utf-8"; var jsondata = httpWeb.CPostOrGet(link, HttpMethod.GET).HtmlValue; jsondata = Regex.Unescape(jsondata); DownloadModel dm = new DownloadModel(); dm.Link_low = jsondata.ExtractStringNoQH("low\":\"", "\"").FirstOrDefault(); dm.Link_hi = jsondata.ExtractStringNoQH("hi\":\"", "\"").FirstOrDefault(); dm.Name = name[i]; downloadModels[i] = dm; } return(downloadModels); }
internal static IEnumerable <DownloadModel[]> GetDownloadList(IEnumerable <TaskModel> taskModels) { // 初始化_djangoidlink和_downloadlink参数 GetLinkInfo(); List <DownloadModel[]> downloadModelses = new List <DownloadModel[]>(); Cf_HttpWeb httpWeb = new Cf_HttpWeb(); foreach (TaskModel taskModel in taskModels) { httpWeb.EncodingSet = "utf-8"; httpWeb.HeaderSet = "X-UCBrowser-UA,dv(TianTian);pr(UCBrowser/10.6.0.620);ov(Android 4.3);ss(400*682);pi(600*1024);bt(UC);pm(1);bv(1);nm(0);im(0);sr(0);nt(2);"; httpWeb.UserAgent = "Mozilla/5.0 (Linux; U; Android 4.3; zh-CN; TianTian Build/tt) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 UCBrowser/10.6.0.620 U3/0.8.0 Mobile Safari/534.30"; httpWeb.Referer = "http://mydiskm.uc.cn/uclxmgr/index?uc_param_str=frpfvesscplaprnisieint&fromdirid=1"; httpWeb.Accpet = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8,UC/151,alipay/un"; var html = httpWeb.CPostOrGet(_djangoidlink + taskModel.Task_id, HttpMethod.GET).HtmlValue; downloadModelses.Add(GetDownloadModelForHtml(html, httpWeb, taskModel.Task_id)); } return(downloadModelses); }