Esempio n. 1
0
 /// <summary>
 /// 获取音乐详细信息
 /// </summary>
 /// <param name="id">音乐ID</param>
 /// <returns></returns>
 public dynamic GetMusicDetail(int id)
 {
     try
     {
         var csrf = this.webClient.GetCookie(new Uri("http://music.163.com")).OfType <Cookie>().Where(c => c.Name == "__csrf").FirstOrDefault();
         var text = new
         {
             csrf_token = csrf,
             ids        = new int[] { id },
             br         = 320000
         };
         var jsonStr = JSONConverter.ConvertToJSONString(text);
         var x       = EncryptRequest(jsonStr);
         var result  = webClient.Post($"http://music.163.com/weapi/song/enhance/player/url?csrf_token={csrf}", x.ConvertToBytes(Encoding.UTF8), "application/x-www-form-urlencoded", this.header).ConvertFromBytes(Encoding.UTF8);
         return(JSONParser.Parse(result));
     }
     catch
     {
         return(null);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 保存所有歌单信息到json文件
        /// </summary>
        public static void SaveData()
        {
            string text = JSONConverter.ConvertToJSONString(MusicLists);

            Save(ref text, @"data\MusicListView.json");
        }
Esempio n. 3
0
        /// <summary>
        /// 左边导航栏歌单名字列表保存
        /// </summary>
        public static void SaveName()
        {
            string text = JSONConverter.ConvertToJSONString(MusicListName);

            Data.Save(ref text, @"data\LeftList.json");
        }