Exemple #1
0
        public API()
        {
            client = new GoogleHTTP();
            // JSON is parsed into the tracksReceived class

            allSongs     = new List <GMusicSong>();
            allPlaylists = new List <GMusicPlaylist>();

            log = Logger.Instance;
        }
Exemple #2
0
        public virtual HttpWebRequest SetupRequest(Uri address)
        {
            if (address == null)
            {
                throw new ArgumentNullException("address");
            }

            if (address.ToString().StartsWith("https://play.google.com/music/services/"))
            {
                address = new Uri(address.OriginalString + String.Format("?u=0&xt={0}", GoogleHTTP.GetCookieValue("xt")));
            }

            HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(address);


            request.CookieContainer = AuthorizationCookieCont;

            if (AuthorizationToken != null)
            {
                request.Headers[HttpRequestHeader.Authorization] = String.Format("GoogleLogin auth={0}", AuthorizationToken);
                request.ContentType = "application/json";
            }
            else
            {
                request.ContentType = "application/x-www-form-urlencoded";
            }

            return(request);
        }