public static ValueTuple <bool, string> Add115MagTask(string cookieStr, string mag, string uid, string sign, string host = "115.com", string reffer = "https://115.com/?cid=1835025974666577373&offset=0&tab=download&mode=wangpan", string ua = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36 115Browser/12.0.0") { bool ret = false; string msg = ""; CookieContainer cc = Get115Cookie(); Dictionary <string, string> param = new Dictionary <string, string>(); param.Add("url", mag); param.Add("sign", sign); param.Add("uid", uid); param.Add("time", DateTime.Now.ToFileTimeUtc() + ""); var returnStr = HtmlManager.Post("https://115.com/web/lixian/?ct=lixian&ac=add_task_url", param, cc); if (!string.IsNullOrEmpty(returnStr)) { var data = Newtonsoft.Json.Linq.JObject.Parse(returnStr); bool.TryParse(data.Property("state").Value.ToString(), out ret); if (ret == false) { msg = data.Property("error_msg").Value.ToString(); } } return(new ValueTuple <bool, string>(ret, msg)); }
public static string DeleteList(List <FileItemModel> files, string pid) { var cc = Get115Cookie(); var url = @"https://webapi.115.com/rb/delete"; Dictionary <string, string> param = new Dictionary <string, string>(); int index = 0; long deleteSize = 0; param.Add("pid", pid); foreach (var file in files) { param.Add($"fid[{index++}]", file.fid); deleteSize += file.s; } try { HtmlManager.Post(url, param, cc); } catch (Exception) { } return(FileSize.GetAutoSizeString(deleteSize, 1)); }
public static void Rename(string fid, string newName, CookieContainer cc) { var url = @"https://webapi.115.com/files/batch_rename"; Dictionary <string, string> param = new Dictionary <string, string>(); param.Add("files_new_name[" + fid + "]", newName); HtmlManager.Post(url, param, cc); }
public static void Move(string fid, string folder, CookieContainer cc) { var url = @"https://webapi.115.com/files/move"; Dictionary <string, string> param = new Dictionary <string, string>(); param.Add("pid", folder); param.Add("fid[0]", fid); HtmlManager.Post(url, param, cc); }
public static void Delete(string fid, CookieContainer cc) { var url = @"https://webapi.115.com/rb/delete"; Dictionary <string, string> param = new Dictionary <string, string>(); param.Add("pid", "0"); param.Add("fid[0]", fid); HtmlManager.Post(url, param, cc); }
public static bool Copy(string fid, string folder, CookieContainer cc) { var url = @"https://webapi.115.com/files/copy"; Dictionary <string, string> param = new Dictionary <string, string>(); param.Add("pid", folder); param.Add("fid[0]", fid); var ret = HtmlManager.Post(url, param, cc); return(JsonConvert.DeserializeObject <OneOneFiveResult>(ret).state); }
public JsonResult Add115Task(string mag) { CookieContainer cc = new CookieContainer(); bool ret = false; string msg = ""; foreach (var t in JsonConvert.DeserializeObject <List <CookieItem> >(ScanDataBaseManager.GetOneOneFiveCookie().OneOneFiveCookie)) { Cookie c = new Cookie(t.Name, t.Value, "/", "115.com"); cc.Add(c); } var split = mag.Split(new string[] { "magnet:?" }, StringSplitOptions.None).Where(x => !string.IsNullOrEmpty(x)); Dictionary <string, string> param = new Dictionary <string, string>(); if (split.Count() <= 1) { param.Add("url", mag); } else { int index = 0; foreach (var s in split) { param.Add(string.Format("url[{0}]", index), "magnet:?" + s); index++; } } param.Add("sign", ""); param.Add("uid", "340200422"); param.Add("time", DateTime.Now.ToFileTimeUtc() + ""); var returnStr = ""; if (split.Count() <= 1) { returnStr = HtmlManager.Post("https://115.com/web/lixian/?ct=lixian&ac=add_task_url", param, cc); } else { returnStr = HtmlManager.Post("https://115.com/web/lixian/?ct=lixian&ac=add_task_urls", param, cc); } if (!string.IsNullOrEmpty(returnStr)) { var data = Newtonsoft.Json.Linq.JObject.Parse(returnStr); bool.TryParse(data.Property("state").Value.ToString(), out ret); if (ret == false) { msg = data.Property("error_msg").Value.ToString(); } } if (string.IsNullOrEmpty(msg)) { msg = "下载成功"; } return(Json(new { status = ret, msg = msg }, JsonRequestBehavior.AllowGet)); }