【问题标题】:Spotify get other user's currently playing trackSpotify 获取其他用户当前播放的曲目
【发布时间】:2020-05-08 17:32:01
【问题描述】:

我想获取其他用户当前播放曲目的数据。可能吗 ?我可以自己带。

  using (var hc = new HttpClient())

        {

            hc.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "my token");





            using (var music = await hc.GetAsync($"https://api.spotify.com/v1/me/player/currently-playing"))
            {
                music.EnsureSuccessStatusCode(); 

                string jsonString = await music.Content.ReadAsStringAsync();
                // TODO: parse json and return true, if the returned array contains the stream
                JObject o = JObject.Parse(jsonString);

            }
        } 

【问题讨论】:

    标签: c# spotify


    【解决方案1】:

    基于documentation,您无法获取任何用户当前播放的曲目,您只能访问已授权的用户。

    但是,如果您能够让用户使用以下访问范围 user-read-currently-playing 授权您的应用程序,那么该应用程序可以代表您调用相同的端点 /me/player/currently-playing 并传递当前正在播放的曲目给你。

    【讨论】:

      猜你喜欢
      • 2016-02-26
      • 1970-01-01
      • 2015-05-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多