private bool TryNormalizeYoutubeUrlLocal(string url, out string normalizedUrl)
    {
        url = url.Trim();
        url = url.Replace("youtu.be/", "youtube.com/watch?v=");
        url = url.Replace("www.youtube", "youtube");
        url = url.Replace("youtube.com/embed/", "youtube.com/watch?v=");

        if (url.Contains("/v/"))
        {
            url = "https://youtube.com" + new Uri(url).AbsolutePath.Replace("/v/", "/watch?v=");
        }

        url = url.Replace("/watch#", "/watch?");
        IDictionary <string, string> query = HTTPHelperYoutube.ParseQueryString(url);

        string v;


        if (!query.TryGetValue("v", out v))
        {
            normalizedUrl = null;
            return(false);
        }

        normalizedUrl = "https://youtube.com/watch?v=" + v;

        return(true);
    }
    public void DecryptDownloadUrl(string encryptedUrl, string htmlVersion, bool audioDecryption)
    {
        if (audioDecryption)
        {
            EncryptUrlForAudio = encryptedUrl;
        }
        else
        {
            EncryptUrlForVideo = encryptedUrl;
        }

        IDictionary <string, string> queries = HTTPHelperYoutube.ParseQueryString(encryptedUrl);

        if (queries.ContainsKey(SignatureQuery))
        {
            if (audioDecryption)
            {
                encryptedSignatureAudio = queries[SignatureQuery];
            }
            else
            {
                encryptedSignatureVideo = queries[SignatureQuery];
            }

            //decrypted = GetDecipheredSignature( encryptedSignature);
            //MagicHands.DecipherWithVersion(encryptedSignature, videoInfo.HtmlPlayerVersion);
            //string jsUrl = string.Format("http://s.ytimg.com/yts/jsbin/{0}-{1}.js", videoInfo.HtmlscriptName, videoInfo.HtmlPlayerVersion);
            string jsUrl = string.Format("http://s.ytimg.com/yts/jsbin/player{0}.js", htmlVersion);
            if (audioDecryption)
            {
                StartCoroutine(Downloader(jsUrl, true));
            }
            else
            {
                StartCoroutine(Downloader(jsUrl, false));
            }
        }
    }