Detect a user's current song in Spotify api

◇◆丶佛笑我妖孽 提交于 2019-12-13 00:39:00

问题


I was wondering if it was possible to detect what song a user is listening to from his/her current active device via the spotify web api.

Thanks.


回答1:


I know this is an old question, but there is a new beta API endpoint available that supplies this information. It does have some bugs that I've noticed though.

  • Stations only: If you change stations, you have to restart Spotify to get the API endpoint to update and continue updating.
  • According to bug reports, it lags behind 20 to 30 minutes at random. I haven't had that problem, so it may be fixed.

GET https://api.spotify.com/v1/me/player/currently-playing

Docs: https://developer.spotify.com/web-api/get-the-users-currently-playing-track/




回答2:


This is not possible using the web API. If you're writing a Mac app, you can use the Spotify Desktop Client's AppleScript API to access the current track. If the user is scribbling to Last.fm, you can use Last.fm's APIs. Otherwise, this data is not accessible.



来源:https://stackoverflow.com/questions/25722194/detect-a-users-current-song-in-spotify-api

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!