Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Spotify support #6

Open
denysvitali opened this issue Aug 20, 2016 · 9 comments
Open

Add Spotify support #6

denysvitali opened this issue Aug 20, 2016 · 9 comments

Comments

@denysvitali
Copy link
Owner

denysvitali commented Aug 20, 2016

No description provided.

@Vilasamuni
Copy link

Vilasamuni commented Nov 29, 2016

+1 :-)

@Vilasamuni
Copy link

Vilasamuni commented Nov 29, 2016

You mentioned that the Spotify library for NodeJS was no longer being maintained but I've found another one that looks promising - https://github.com/FrontierPsychiatrist/node-spotify
On further reading - node-spotify is a NodeJS wrapper for libspotify which has been deprecated.

Maybe the best way to go would be making requests directly to the Spotify Web API?

@denysvitali
Copy link
Owner Author

The problem with Spotify is that you can't get a stream URL without using their services. The Spotify Web API uses in fact (IIRC) their web player, and only provides track information / details

@Vilasamuni
Copy link

Dang, looks like you're right. Reading around on Stack Overflow and similar it looks like it's possible to access a 30 second preview of each treack with the Spotify Web API, but not full tracks.

@denysvitali
Copy link
Owner Author

You're right, but the seconds aren't 30: they are about 7.
The unencrypted version (called head) is available via http://heads-akp.spotify.com/head/TRACK_KEY, while the encrypted is available at a similar url with /audio/ instead.
The decryption method is available in the Spotify's player .swf file, but it's kind of tricky since it uses both swf and js to retrieve the key.
I'll post here my notes when I return home / have some spare time

@alexkreidler
Copy link

I think Spotify has recently moved away from Flash, as it will be discontinued in 2020. I think they now use the Content Decryption Module built into most browsers.

I wonder how Sonos does its integration with Spotify.

@denysvitali
Copy link
Owner Author

Last time I checked they were decrypting some MP3 from Spotify's CDN. They may have changed their library though.

If I have time (unlikely this month or the next one) I'll check and report back

@gieljnssns
Copy link

any updates on spotify?

@denysvitali
Copy link
Owner Author

Unfortunately their encryption is kinda hard, I stopped looking into this issue a lot of months ago. I don't think it is possible to add support for Spotify for non-premium users. The thing we can do though is to support Spotify for premium users by using SONOS' URIs (I guess they've implemented an x-sonos-spotify:// protocol or something).

Unfortunately I'm in the process of moving to a new apartment and I don't have nor won't have access to my SONOS Play:3 speaker for the next weeks. I'll probably start re-maintaining this project (or start from scratch with sonos-web-rs) as soon as I get my speaker back and I settle down with this moving of mine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants