Exemplo n.º 1
0
        /// <summary>
        /// Hack the result of player getting song URL and redirects it to the new URL.
        /// </summary>
        /// <param name="originalContent">The original API result.</param>
        /// <returns>The modified API result.</returns>
        private static string ModifyPlayerApi(string originalContent)
        {
            Console.WriteLine("Hack player API");

            JObject root   = JObject.Parse(originalContent);
            string  songId = root["data"][0]["id"].Value <string>();
            string  newUrl = NeteaseIdProcess.GetUrl(songId, Configuration.PlaybackQuality);

            root["data"][0]["url"]  = newUrl;
            root["data"][0]["br"]   = Configuration.PlaybackBitrate;
            root["data"][0]["code"] = "200";

            return(root.ToString(Formatting.None));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Hack the result of download API and redirects it to the new URL.
        /// </summary>
        /// <param name="originalContent">The original API result.</param>
        /// <returns>The modified API result.</returns>
        private static string ModifyDownloadApi(string originalContent)
        {
            Console.WriteLine("Hack download API");

            string  modified = originalContent;
            JObject root     = JObject.Parse(modified);
            string  songId   = root["data"]["id"].Value <string>();
            string  newUrl   = NeteaseIdProcess.GetUrl(songId, Configuration.DownloadQuality);

            root["data"]["url"]  = newUrl;
            root["data"]["br"]   = Configuration.DownloadBitrate;
            root["data"]["code"] = "200";

            return(root.ToString(Formatting.None));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Hack the result of player getting song URL and redirects it to the new URL.
        /// </summary>
        /// <param name="originalContent">The original API result.</param>
        /// <param name="targetBitrate">Target bitrate.</param>
        /// <param name="targetQuality">Target quality.</param>
        /// <returns>The modified API result.</returns>
        private static string ModifyPlayerApi(string originalContent, string targetBitrate, string targetQuality)
        {
            Console.WriteLine("Hack API player/url");

            string  modified = originalContent;
            JObject root     = JObject.Parse(modified);
            string  songId   = root["data"][0]["id"].Value <string>();
            string  newUrl   = NeteaseIdProcess.GetUrl(songId, targetQuality);

            root["data"][0]["url"]  = newUrl;
            root["data"][0]["br"]   = targetBitrate;
            root["data"][0]["code"] = "200";

            return(root.ToString(Formatting.None));
        }