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

Spotify Stopped because of rate limiting. #1814

Closed
T-vK opened this issue Oct 4, 2022 · 33 comments
Closed

Spotify Stopped because of rate limiting. #1814

T-vK opened this issue Oct 4, 2022 · 33 comments
Labels
bug Something isn't working

Comments

@T-vK
Copy link

T-vK commented Oct 4, 2022

Describe the bug:
Opening a playlist results in this error:

Client request(https://api.spotify.com/v1/playlists/{PLAYLIST_ID} invalid: 429 . Text: "Too many requests"

I got this after downloading roughly 20 songs earlier that day. In the past I was able to download hundreds of songs without any issues.

Media Links Used:
Not specific to one link. This happens with every playlist link.

Expected behavior
Shows list of songs of a playlist

Screenshots:
image

StackTrace:
No errors in Logcat...

Device Info (please complete the following information):

  • Device: OnePlus 7 Pro
  • OS: Android 11
  • Version: 3.6.1 (latest from F-Droid)
  • Country: Germany
@T-vK T-vK added the bug Something isn't working label Oct 4, 2022
@Lykantac
Copy link

Lykantac commented Oct 5, 2022

Yeah same here I was able to download a lot of my spotify playlist then all of the sudden this morning it gave me that error. And I am running samsung galaxy note 10 5g USA latest Android software.

@Daviddiala
Copy link

Screenshot_20221005-043906

This bug is quite frustrating

@Lykantac
Copy link

Lykantac commented Oct 5, 2022

Yes it is.

@T-vK
Copy link
Author

T-vK commented Oct 5, 2022

I just dug a bit through the source code wondering if all SpotiFlyer users share the same authentication token. Because even after changing my IP address, I am still getting rate-limited.

From what I can tell, a unique token is retrieved for each user. But every token is retrieved through the same client ID and client secret:

val clientId = "694d8bf4f6ec420fa66ea7fb4c68f89d"
val clientSecret = "02ca2d4021a7452dae2328b47a6e8fe8"

We might be able to bypass the rate-limiting by using our own client ID and client secret which can be created here.

This would however require rebuilding the app. Adding an option to SpotiFlyer to allow using our own id/secret would be neat.
Other than that, there might be a way to overwrite the stored token, but that probably requires a rooted phone and manually retrieving a token from the https://accounts.spotify.com/api/token API.

Edit:
I managed to manipulate the token which can be found in: /data/data/com.sharebinder.spotiflyer/databases/Database.db in the table Token. I used my own client ID + client secret to generate a new auth token and replaced the existing one with my newly generated one. I can now open playlists and download songs again.
In one hour my token will have have expired though and I'll have to repeat the procedure, so this is not a proper fix. It's just to prove that the rate-limiting is down to spotify limiting requests on a client ID level.

@Lykantac
Copy link

Lykantac commented Oct 5, 2022

Screenshot_20221005_085931

@T-vK
Copy link
Author

T-vK commented Oct 5, 2022

I'm not sure, but my guess is that SpotiFlyer is registered as a development app and applying for extended quota has a high chance of getting declined since downloading songs from Spotify outside of their ecosystem is probably against the ToS.
It's also unclear to me if "extended quota" would even solve the issue, considering that it merely increases the limit. It might make for a temporary workaround though.
I vote for making the clientId and clientSecret user-configurable.

@Shabinder
Copy link
Owner

will update the clientId and secret and make them configurable and do a release in coming day.

@Shabinder Shabinder pinned this issue Oct 5, 2022
@Shabinder Shabinder changed the title [BUG] : Client request(...) invalid: 429 . Text: "Too many requests" when opening any playlist Spotify Stopped because of rate limiting. Oct 5, 2022
@ghost
Copy link

ghost commented Oct 7, 2022

Please fix this issue cause i can't download a single song because of it

@ZazoVa
Copy link

ZazoVa commented Oct 9, 2022

I just dug a bit through the source code wondering if all SpotiFlyer users share the same authentication token. Because even after changing my IP address, I am still getting rate-limited.

From what I can tell, a unique token is retrieved for each user. But every token is retrieved through the same client ID and client secret:

val clientId = "694d8bf4f6ec420fa66ea7fb4c68f89d"
val clientSecret = "02ca2d4021a7452dae2328b47a6e8fe8"

We might be able to bypass the rate-limiting by using our own client ID and client secret which can be created here.

This would however require rebuilding the app. Adding an option to SpotiFlyer to allow using our own id/secret would be neat. Other than that, there might be a way to overwrite the stored token, but that probably requires a rooted phone and manually retrieving a token from the https://accounts.spotify.com/api/token API.

Edit: I managed to manipulate the token which can be found in: /data/data/com.sharebinder.spotiflyer/databases/Database.db in the table Token. I used my own client ID + client secret to generate a new auth token and replaced the existing one with my newly generated one. I can now open playlists and download songs again. In one hour my token will have have expired though and I'll have to repeat the procedure, so this is not a proper fix. It's just to prove that the rate-limiting is down to spotify limiting requests on a client ID level.

Do u know where can i find that section in the Windows version?

@savagemz
Copy link

savagemz commented Oct 9, 2022

hopefully he'll fix it soon

@DivineSapt
Copy link

will update the clientId and secret and make them configurable and do a release in coming day.

when will it be released cuz I am still getting that problem

@T-vK
Copy link
Author

T-vK commented Oct 10, 2022

Do u know where can i find that section in the Windows version?

I'd say it uses the same source file for all operating systems.

The Database.db file is probably in %APPDATA%\Spotiflyer\Database\Database.db or something like that on Windows. On Linux it is in ~/Spotiflyer/Database/Database.db.

On Linux you can overwrite the access token by running this form the terminal:
(You need to insert your CLIENT_ID and CLIENT_SECRET of course. You can get it here.)

SPOTIFY_CLIENT_ID=*********************
SPOTIFY_CLIENT_SECRET=*******************

SPOTIFY_ENCODED_CREDENTIALS="$(echo -n "${SPOTIFY_CLIENT_ID}:${SPOTIFY_CLIENT_SECRET}" | base64 | tr -d "\n")"

res="$(curl -s -X "POST" -H "Authorization: Basic ${SPOTIFY_ENCODED_CREDENTIALS}" -d grant_type=client_credentials https://accounts.spotify.com/api/token)"

SPOTIFY_AUTH_TOKEN="$(echo "$res" | grep -oP '\"access_token\":\"\K[\w-:]+')"
SPOTIFY_AUTH_TOKEN_EXPIRES_IN="$(echo "$res" | grep -oP '\"expires_in\":\K\d+')"
UNIX_TIME_NOW="$(date +%s)"
SPOTIFY_AUTH_TOKEN_EXPIRY="$((UNIX_TIME_NOW+SPOTIFY_AUTH_TOKEN_EXPIRES_IN))"

echo "UPDATE token SET accessToken = '${SPOTIFY_AUTH_TOKEN}', expiry = ${SPOTIFY_AUTH_TOKEN_EXPIRY} WHERE tokenIndex = 0;" | sqlite3 ~/SpotiFlyer/Database/Database.db

@Saransh719
Copy link

Saransh719 commented Oct 10, 2022

I just dug a bit through the source code wondering if all SpotiFlyer users share the same authentication token. Because even after changing my IP address, I am still getting rate-limited.

From what I can tell, a unique token is retrieved for each user. But every token is retrieved through the same client ID and client secret:

val clientId = "694d8bf4f6ec420fa66ea7fb4c68f89d"
val clientSecret = "02ca2d4021a7452dae2328b47a6e8fe8"

We might be able to bypass the rate-limiting by using our own client ID and client secret which can be created here.

This would however require rebuilding the app. Adding an option to SpotiFlyer to allow using our own id/secret would be neat. Other than that, there might be a way to overwrite the stored token, but that probably requires a rooted phone and manually retrieving a token from the https://accounts.spotify.com/api/token API.

Edit: I managed to manipulate the token which can be found in: /data/data/com.sharebinder.spotiflyer/databases/Database.db in the table Token. I used my own client ID + client secret to generate a new auth token and replaced the existing one with my newly generated one. I can now open playlists and download songs again. In one hour my token will have have expired though and I'll have to repeat the procedure, so this is not a proper fix. It's just to prove that the rate-limiting is down to spotify limiting requests on a client ID level.

I have managed to get the client id and edit the code. Can you please tell me how to build the project as there is no .sln file.

@T-vK
Copy link
Author

T-vK commented Oct 10, 2022

I have managed to get the client id and edit the code. Can you please tell me how to build the project as there is no .sln file.

No, I couldn't. I've never looked into how to build it. Maybe start by looking at the gradlew.bat file.

@ZazoVa
Copy link

ZazoVa commented Oct 10, 2022

Do u know where can i find that section in the Windows version?

I'd say it uses the same source file for all operating systems.

The Database.db file is probably in %APPDATA%\Spotiflyer\Database\Database.db or something like that on Windows. On Linux it is in ~/Spotiflyer/Database/Database.db.

On Linux you can overwrite the access token by running this form the terminal: (You need to insert your CLIENT_ID and CLIENT_SECRET of course. You can get it here.)

SPOTIFY_CLIENT_ID=*********************
SPOTIFY_CLIENT_SECRET=*******************

SPOTIFY_ENCODED_CREDENTIALS="$(echo -n "${SPOTIFY_CLIENT_ID}:${SPOTIFY_CLIENT_SECRET}" | base64 | tr -d "\n")"

res="$(curl -s -X "POST" -H "Authorization: Basic ${SPOTIFY_ENCODED_CREDENTIALS}" -d grant_type=client_credentials https://accounts.spotify.com/api/token)"

SPOTIFY_AUTH_TOKEN="$(echo "$res" | grep -oP '\"access_token\":\"\K[\w-:]+')"
SPOTIFY_AUTH_TOKEN_EXPIRES_IN="$(echo "$res" | grep -oP '\"expires_in\":\K\d+')"
UNIX_TIME_NOW="$(date +%s)"
SPOTIFY_AUTH_TOKEN_EXPIRY="$((UNIX_TIME_NOW+SPOTIFY_AUTH_TOKEN_EXPIRES_IN))"

echo "UPDATE token SET accessToken = '${SPOTIFY_AUTH_TOKEN}', expiry = ${SPOTIFY_AUTH_TOKEN_EXPIRY} WHERE tokenIndex = 0;" | sqlite3 ~/SpotiFlyer/Database/Database.db

Ended up finding it on "CD:\Users\username\SpotiFlyer\Database\Database.db"

@Saransh719
Copy link

I have managed to get the client id and edit the code. Can you please tell me how to build the project as there is no .sln file.

No, I couldn't. I've never looked into how to build it. Maybe start by looking at the gradlew.bat file.

Well finally got it done using android studio. Thanks for the tip tho

@chacha121
Copy link

anything for noobs??

@ZazoVa
Copy link

ZazoVa commented Oct 10, 2022

anything for noobs??

noob here. I'm still looking for a way to modify the file on Windows and they already gave a somewhat simple tutorial for Android. if you need more help just reply to my comment.

@chacha121
Copy link

anything for noobs??

noob here. I'm still looking for a way to modify the file on Windows and they already gave a somewhat simple tutorial for Android. if you need more help just reply to my comment.

it seems all the fixes will work for an hour only...
so for me, it's not worth doing this...(also I used soundloader)

@Shabinder
Copy link
Owner

anything for noobs??

noob here. I'm still looking for a way to modify the file on Windows and they already gave a somewhat simple tutorial for Android. if you need more help just reply to my comment.

it seems all the fixes will work for an hour only... so for me, it's not worth doing this...(also I used soundloader)

If you build using ur own personal key, It will work fine as it did earlier. nothing like an hour or so limit.

@T-vK
Copy link
Author

T-vK commented Oct 10, 2022

it seems all the fixes will work for an hour only... so for me, it's not worth doing this...(also I used soundloader)

This is only true for my workarounds regarding the database manipulations. Manipulating the auth key in the database has to be redone once an hour. If you rebuild the project using your own client id and secret id in the source code, it will automatically refresh your auth token. But admittedly, none of these methods are noob-friendly. For now the only noob-friendly solution is to patiently wait for Shabinder's update. :)

@ZazoVa
Copy link

ZazoVa commented Oct 10, 2022

anything for noobs??

noob here. I'm still looking for a way to modify the file on Windows and they already gave a somewhat simple tutorial for Android. if you need more help just reply to my comment.

it seems all the fixes will work for an hour only... so for me, it's not worth doing this...(also I used soundloader)

If you build using ur own personal key, It will work fine as it did earlier. nothing like an hour or so limit.

I know this is too noob to ask but what can I use to modify the database file?1

@T-vK
Copy link
Author

T-vK commented Oct 11, 2022

I know this is too noob to ask but what can I use to modify the database file?1

I used sqlite3, but it's a CLI application. You cold also use sqliteman, if you want a GUI.
For Android I used aSQLiteManager (and a root file explorer to copy the Database.db into my Downloads directory which was required to open it with aSQLiteManager and after modifying it, you have to copy it back to /data/data/com.sharebinder.spotiflyer/databases of course).

@Anakulasmos
Copy link

Hey, can someone write a summary on the android tutorial to solve the error? I cant seem to understand what to do

@chacha121
Copy link

chacha121 commented Oct 11, 2022

Hey, can someone write a summary on the android tutorial to solve the error? I cant seem to understand what to do

for a while use> https://www.soundloaders.com/spotify-downloader/
(quality-320kbps)

@Anakulasmos
Copy link

Hey, can someone write a summary on the android tutorial to solve the error? I cant seem to understand what to do

for a while use> https://www.soundloaders.com/spotify-downloader/ (quality-320kbps)

Thx a lot

@Anakulasmos
Copy link

will update the clientId and secret and make them configurable and do a release in coming day.

Keep up the work, THANK YOU FOR THE APP!!!!!!

@Shabinder
Copy link
Owner

Here we go guys: v3.6.2 is released 🚀 fixing this issue.
https://github.com/Shabinder/SpotiFlyer/releases/tag/v3.6.2

A rewrite of the whole app is also in progress, its still in early stages but Stay Tuned to see what it brings when it lands 👀 .

@FullThortlePenguin
Copy link

will update the clientId and secret and make them configurable and do a release in coming day.

Is it out yet?

@FullThortlePenguin
Copy link

:(

@kcryptonian
Copy link

will update the clientId and secret and make them configurable and do a release in coming day.

Is it out yet?

Yes it is, you'll find it in settings.

@Kulin-Soni
Copy link

I just dug a bit through the source code wondering if all SpotiFlyer users share the same authentication token. Because even after changing my IP address, I am still getting rate-limited.

From what I can tell, a unique token is retrieved for each user. But every token is retrieved through the same client ID and client secret:

val clientId = "694d8bf4f6ec420fa66ea7fb4c68f89d"
val clientSecret = "02ca2d4021a7452dae2328b47a6e8fe8"

We might be able to bypass the rate-limiting by using our own client ID and client secret which can be created here.

This would however require rebuilding the app. Adding an option to SpotiFlyer to allow using our own id/secret would be neat. Other than that, there might be a way to overwrite the stored token, but that probably requires a rooted phone and manually retrieving a token from the https://accounts.spotify.com/api/token API.

Edit: I managed to manipulate the token which can be found in: /data/data/com.sharebinder.spotiflyer/databases/Database.db in the table Token. I used my own client ID + client secret to generate a new auth token and replaced the existing one with my newly generated one. I can now open playlists and download songs again. In one hour my token will have have expired though and I'll have to repeat the procedure, so this is not a proper fix. It's just to prove that the rate-limiting is down to spotify limiting requests on a client ID level.

Hello If Anyone Want To Change The Following Things Then You Must Download Apktool_M on Android and then decompile the app. Then you have to search for the same token above here by copy paste. It will show you option for SpotifyAuth.kl file. Click and change it with your own id and token and then save it. Afte it complie the project(there is option for that). That's it. (Sorry for bad English)

@bluemadeliefje
Copy link

Is there a solution already? I'm sorry, also technical noob here.
I read things about a new update/release? Can anything tell me where I can download that? If it helps to solve this problem, otherwise another solution is more then welcome.

@Shabinder Shabinder unpinned this issue May 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests