dvx / lofi

🎵🔉 A mini Spotify player with WebGL visualizations.
http://lofi.rocks
MIT License
1.2k stars 68 forks source link

API calls constantly throttled #177

Open masonc15 opened 2 years ago

masonc15 commented 2 years ago

Hello,

I'm getting the error "API calls constantly throttled" when using Lofi and I'm not sure why. I made sure to revoke all other apps' access to my Spotify account to make sure it wasn't being caused by any other service. This error is preventing me from controlling my Spotify, whether that be pausing or skipping songs. Here are what the Debug mode console errors look like:

renderer.bundle.js:2 GET https://api.spotify.com/v1/me/tracks/contains?ids=6Q60BmM4JrOliafNK2EtmL 429
renderer.bundle.js:2 429: API rate limit exceeded
renderer.bundle.js:2 GET https://api.spotify.com/v1/me/player?type=episode,track 429
renderer.bundle.js:2 429: API rate limit exceeded
renderer.bundle.js:2 API calls throttled, wait 16s... (/me/player?type=episode,track)
renderer.bundle.js:2 API calls throttled, wait 15s... (/me/player?type=episode,track)
renderer.bundle.js:2 API calls throttled, wait 15s... (/me/tracks/contains?ids=6Q60BmM4JrOliafNK2EtmL)
renderer.bundle.js:2 API calls throttled, wait 14s... (/me/player?type=episode,track)

Any help would be appreciated. Thank you!

MaskedMoon commented 2 years ago

Facing a similar issue. Get this error after every ~5 seconds during which I can't use any function on LoFi. The error then stays for 10 seconds, after which I can use the LoFi functions. The cycle then repeats.

akersg commented 2 years ago

I am also having the same issue. Any fix available?

jkergal commented 2 years ago

same issue here... this is frustrating :/ it's faster to go in spotify to interact with (like, skip, etc...)

found this from spotify : https://developer.spotify.com/documentation/web-api/guides/rate-limits/

the tool is perfect for me without this issue, thank you so much for the great work ! 🥇

akersg commented 2 years ago

Hi, on further investigation, this seems to happen when I am connected to a Sonos speaker.

Don't know if that helps in any way?

jkergal commented 2 years ago

Personally I'm not connected to any bluetooth / wifi device, juste on my Spotify desktop version on my PC 🤷‍♂️

K0FFing commented 2 years ago

Facing a similar issue. Get this error after every ~5 seconds during which I can't use any function on LoFi. The error then stays for 10 seconds, after which I can use the LoFi functions. The cycle then repeats.

Exactly this happen to me. not Bluetooth on wifi connection, Hope find a fix soon its really unusable whit this error image

stamoun commented 2 years ago

This, sadly, is not related to the output hardware, it's 100% an issue with Spotify not being nice with API calls (1 call per second is not unheard of!).

That being said, I think I should try and get some sort of adaptive or configurable polling of the API. Either set it at 2 seconds by default but expect some lag or make it dynamic and poll every 1 second or so (like it's doing currently) but as soon as that 429 error comes up, slow the polling for a while 🤔

Fruit for thought...

bmbkr commented 1 year ago

One possible solution is using Spicetify (a modification for the Spotify client that allows for injecting custom JS) to send information directly to lofi, bypassing the API entirely.