示例#1
0
        /// <summary>
        /// 音乐网络搜索
        /// </summary>
        public override void SearchPress()
        {
            List <MusicSourceInfo> resultList = new List <MusicSourceInfo>();
            string codeName = HttpUtility.UrlEncode(this.KeyWord);
            string url      = string.Format("http://search.kuwo.cn/r.s?all={0}&ft=music&itemset=web_2013&client=kt&pn=0&rn=250&rformat=json&encoding=utf8", codeName);

            try
            {
                string  result = HttpOpera.Get(url);
                JObject json   = JObject.Parse(result);
                if ((int)json["SHOW"] == 0)
                {
                    return;
                }

                JArray list = (JArray)json["abslist"];
                foreach (JObject item in list)
                {
                    MusicSourceInfo info = new MusicSourceInfo();
                    info.SoureName  = "酷我音乐";
                    info.Musicrid   = (string)item["MUSICRID"];
                    info.SongName   = (string)item["SONGNAME"];
                    info.SingerName = (string)item["ARTIST"];

                    info.SongName = info.SongName.Replace("&nbsp;", "");
                    resultList.Add(info);
                }

                this.OnMusicFindedPress(resultList);
            }
            catch (Exception ex)
            {
                this.OnErrorPress(ex.Message);
            }
        }
示例#2
0
        /// <summary>
        /// 获取音乐文件下载信息
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public override MusicDownloadInfo GetDownloadInfo(MusicSourceInfo info)
        {
            string url = "http://ws.stream.qqmusic.qq.com/C100<songmid>.m4a?fromtag=0";

            url = url.Replace("<songmid>", info.QQ_Songmid);
            MusicDownloadInfo downloadInfo = new MusicDownloadInfo();

            try
            {
                string  result = HttpOpera.Get(url);
                JObject json   = JObject.Parse(result);
                if (json["err_code"].ToString() == "0")
                {
                    downloadInfo.audio_name = (string)json["data"]["audio_name"];
                    downloadInfo.play_url   = (string)json["data"]["play_url"];
                    downloadInfo.extname    = "mp3";
                }

                return(downloadInfo);
            }
            catch (Exception ex)
            {
                this.OnErrorPress(ex.Message);
                return(null);
            }
        }
示例#3
0
        /// <summary>
        /// 获取音乐文件下载信息
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public override MusicDownloadInfo GetDownloadInfo(MusicSourceInfo info)
        {
            string url = "http://www.kugou.com/yy/index.php?r=play/getdata&hash=<hash>";

            url = url.Replace("<hash>", info.FileHash);
            MusicDownloadInfo downloadInfo = new MusicDownloadInfo();

            try
            {
                string  result = HttpOpera.Get(url);
                JObject json   = JObject.Parse(result);
                if (json["err_code"].ToString() == "0")
                {
                    downloadInfo.audio_name = (string)json["data"]["audio_name"];
                    downloadInfo.play_url   = (string)json["data"]["play_url"];
                    downloadInfo.extname    = "mp3";
                }

                return(downloadInfo);
            }
            catch (Exception ex)
            {
                this.OnErrorPress(ex.Message);
                return(null);
            }
        }
示例#4
0
        public override void SearchPress()
        {
            string searchUrl = "https://c.y.qq.com/soso/fcgi-bin/client_search_cp?aggr=1&cr=1&flag_qc=0&p=1&n=100&w=<name>";
            List <MusicSourceInfo> resultList = new List <MusicSourceInfo>();
            string codeName = HttpUtility.UrlEncode(this.KeyWord);
            string url      = searchUrl.Replace("<name>", codeName);

            try
            {
                string result = HttpOpera.Get(url);
                result = result.Substring(9);
                int len = result.Length - 1;
                result = result.Substring(0, len);

                JObject json = JObject.Parse(result);
                if (json["code"].ToString() == "0")
                {
                    JArray list = (JArray)json["data"]["song"]["list"];
                    foreach (JObject item in list)
                    {
                        MusicSourceInfo info = new MusicSourceInfo();
                        info.SoureName  = "QQ音乐";
                        info.SongName   = (string)item["songname"];
                        info.Albumname  = (string)item["albumname"];
                        info.QQ_Songmid = (string)item["songmid"];
                        info.QQ_Songid  = (string)item["songid"];
                        JArray singerlist = (JArray)item["singer"];
                        info.SingerName = (string)item["name"];

                        //info.ExtName = (string)item["ExtName"];
                        //info.FileHash = (string)item["FileHash"];
                        //info.SongName = (string)item["SongName"];
                        //info.SQFileHash = (string)item["SQFileHash"];
                        //info.HQFileHash = (string)item["HQFileHash"];
                        //info.HiFiQuality = (int)item["HiFiQuality"];
                        //info.OwnerCount = (int)item["OwnerCount"];
                        resultList.Add(info);
                    }
                }

                this.OnMusicFindedPress(resultList);
            }
            catch (Exception ex)
            {
                this.OnErrorPress(ex.Message);
            }
        }
示例#5
0
        /// <summary>
        /// 音乐网络搜索
        /// </summary>
        public override void SearchPress()
        {
            string searchUrl = "http://songsearch.kugou.com/song_search_v2?keyword=<name>&page=1&pagesize=100";
            List <MusicSourceInfo> resultList = new List <MusicSourceInfo>();
            string codeName = HttpUtility.UrlEncode(this.KeyWord);
            string url      = searchUrl.Replace("<name>", codeName);

            try
            {
                string  result = HttpOpera.Get(url);
                JObject json   = JObject.Parse(result);
                if ((int)json["data"]["total"] == 0)
                {
                    return;
                }

                if (json["error_code"].ToString() == "0")
                {
                    JArray list = (JArray)json["data"]["lists"];
                    foreach (JObject item in list)
                    {
                        MusicSourceInfo info = new MusicSourceInfo();
                        info.SoureName    = "酷狗音乐";
                        info.SongName     = (string)item["SongName"];
                        info.SingerName   = (string)item["SingerName"];
                        info.FileName     = (string)item["FileName"];
                        info.ExtName      = (string)item["ExtName"];
                        info.SongName     = (string)item["SongName"];
                        info.QualityLevel = (string)item["QualityLevel"];
                        info.FileHash     = (string)item["FileHash"];
                        info.SQFileHash   = (string)item["SQFileHash"];
                        info.HQFileHash   = (string)item["HQFileHash"];
                        info.HiFiQuality  = (int)item["HiFiQuality"];
                        info.OwnerCount   = (int)item["OwnerCount"];
                        resultList.Add(info);
                    }
                }

                this.OnMusicFindedPress(resultList);
            }
            catch (Exception ex)
            {
                this.OnErrorPress(ex.Message);
            }
        }
示例#6
0
        /// <summary>
        /// 获取音乐文件下载信息
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public override MusicDownloadInfo GetDownloadInfo(MusicSourceInfo info)
        {
            string            url          = string.Format("http://antiserver.kuwo.cn/anti.s?type=convert_url&rid={0}&format=aac|mp3&response=url", info.Musicrid);
            MusicDownloadInfo downloadInfo = new MusicDownloadInfo();

            try
            {
                string result = HttpOpera.Get(url);
                //JObject json = JObject.Parse(result);
                //if (json["err_code"].ToString() == "0")
                //{
                downloadInfo.audio_name = info.SongName;
                downloadInfo.play_url   = result;
                downloadInfo.extname    = result.Substring(result.Length - 3);
                //}

                return(downloadInfo);
            }
            catch (Exception ex)
            {
                this.OnErrorPress(ex.Message);
                return(null);
            }
        }
示例#7
0
 public Music_Source_Base()
 {
     this.HttpOpera    = new HttpOpera();
     this.FileDownload = new FileDownload();
 }