michaelherger / Spotty-Plugin

A Spotify plugin for the Lyrion Music Server (fka. Logitech Media Server) and Squeezebox compatible players
123 stars 23 forks source link

Spotify API changes break Spotty plugin #152

Closed rtfmjoey closed 3 days ago

rtfmjoey commented 4 days ago

Hi,

It seems that the newest API changes break the Spotty plugin.

I'm getting the dreaded 'Failed to get access token' and looking at the logs I notice the following:

`[24-11-27 18:55:01.2391] Plugins::Spotty::API::ANON (1361) Trying to read from cache for browse/featured-playlists?country=NL&limit=50&locale=en_US&timestamp=2024-11-27T18%3A50%3A00 [24-11-27 18:55:01.2392] Plugins::Spotty::API::ANON (1370) API call: browse/featured-playlists?country=NL&limit=50&locale=en_US&timestamp=2024-11-27T18%3A50%3A00 [24-11-27 18:55:01.2939] Plugins::Spotty::API::ANON (1467) error: 404 Not Found [24-11-27 18:55:01.2963] Plugins::Spotty::OPML::ANON (189) Failed to get featured playlists and/or token - do not continue

`

get-featured-playlists is removed from the API, see https://developer.spotify.com/blog/2024-11-27-changes-to-the-web-api for details.

cpedrero commented 3 days ago

Same problem 😵‍💫

michaelherger commented 3 days ago

Oh wow... and they don't even inform their developers ahead of time?!? That's really bad. I'll see what I can do.

Could you please confirm what Spotty versions you're using?

rtfmjoey commented 3 days ago

Logitech Media Server Version: 8.5.2 Spotty version: 4.11.3

I've tried with the new test spotty but ran into the same issue so I've reverted and am using Spotify Connect for the time being. Als created a new app in Spotify dev, added users etc and configured the new app in Spotty but this also resulted in the same issue.

michaelherger commented 3 days ago

Well, as the links blog article suggests they simply remove access to some crucial endpoints without notice. One possible workaround is to remove your own client ID. But that will cause other issues in the long run...

oli101010 commented 3 days ago

Thanks for the workaround! Removing the client ID resolved the issue—Spotty can now browse and play again as expected.

fortender commented 3 days ago

We ran into the same issues. The problem arises from OPML.handleFeed relying on a successful call to the /browse/featured-playlists endpoint, as you guys already stated above.

A quick'n'dirty solution was to remove the following lines https://github.com/michaelherger/Spotty-Plugin/blob/8b10ec3804dbc17833a54b1433cf5fe8ab3bff15/OPML.pm#L190-L197

You find the file in %ProgramData%\Squeezebox\Cache\InstalledPlugins\Plugins\Spotty\OPML.pm (Windows). The crucial part is the return here. This stops handleFeed from continuing to build the menu structure and prints the error. It seems like it's also used as an indicator of whether or not our token is valid, but we really should handle that in another way.

I also provided a PR #153 that removes the entire call and the function itself.

michaelherger commented 3 days ago

Please give the latest build a try.

fortender commented 3 days ago

Please give the latest build a try.

Works on my side

michaelherger commented 3 days ago

Let's keep fingers crossed! 🤞🏻

rtfmjoey commented 3 days ago

Works for me :)