23

I would like to know if it's possible to play songs from Spotify with Python (version 2.7 if possible) and how.

0

2 Answers 2

20

There are several ways to interact with Spotify, where the post popular right now is the Web API. The Web API offers a lot of features, but not playback of full tracks.

Therefore, it doesn't matter if you're using Python, Java, C#, or whatever language. You'll still not be able to play music using the Web API. There are, however, mobile SDKs that support playback, available for both Android and iOS.

You can however play preview tracks (30 seconds) using the Web API. Check out spotipy. It's one of the better Python clients, if not the best.

There are other ways to interact directly with the Spotify desktop application, but none that are supported officially by Spotify, and I can't recommend them since they may stop working at any point in time.

As another answer correctly states, Libspotify could solve this problem for you. The reason I didn't mention it is that it's deprecated. We're aiming to have a replacement for it by the end of 2015.

2
4

With pyspotify you get access to all of the (old, but still working) libspotify API and you can play full tracks. It works on Python 2.7 as well as Python 3.2+ and PyPy.

1
  • Doesn’t work anymore :( Aug 10, 2022 at 20:11

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.