SHARE
TWEET

Untitled

a guest Aug 20th, 2019 103 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public static async Task SpotifyGET()
  2.         {
  3.             using (var httpClient = new HttpClient())
  4.             {
  5.                 using (var request = new HttpRequestMessage(new HttpMethod("GET"), "https://api.spotify.com/v1/me/player/currently-playing"))
  6.                 {
  7.                     request.Headers.TryAddWithoutValidation("Accept", "application/json");
  8.                     request.Headers.TryAddWithoutValidation("Authorization", "Bearer BQAUwi23miZpzFs6_UBnh6udilYvrYtraFADI_KovMFjZllIwKgZkOA9sH9cSusWWSbyLU09rpbskpYT6wKXPVLRDLYA1HmyQJo0QHKzVlHPwnnNat-V47yNBG0U1XQMogsQKvPQZd2Rs88_NXNwdRsvGzW-ehOqIh9zCTJbf7cCBXygjynBXRZm0YfFyPvx-1lhE4kPkSMeLS3ZaW4CT9MlSrIzLu1qWkxa84dfRQ5MrIQ-4-qZ5d8gwGM7YS9G4OB10yk36DYV846YCZLDOfnKxbb9avErhZSA");
  9.                     var response = await httpClient.SendAsync(request);
  10.  
  11.                     string result = response.Content.ReadAsStringAsync().Result;
  12.                     string data = result;
  13.  
  14.                     MainWindow mainWindow = new MainWindow();
  15.  
  16.                     JObject jObj = JObject.Parse(data);
  17.                     mainWindow.artist_txt.Content = ("Artist:" + jObj["item"]["artists"][0]["name"]);
  18.                     mainWindow.track_txt.Content = ("Track:" + jObj["item"]["name"]);
  19.  
  20.                 }
  21.             }
  22.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top