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

Cloudflare captcha work around #32

Open
exadeci opened this issue Nov 26, 2024 · 4 comments
Open

Cloudflare captcha work around #32

exadeci opened this issue Nov 26, 2024 · 4 comments

Comments

@exadeci
Copy link

exadeci commented Nov 26, 2024

As you might have seen they've added a cloudflare captcha which breaks spdl.

I don't know if there's some way around it but in the meantime I've found that if you go on spotifydown and do all the process to the download, the download will have a token at the end I was able to successfully add it to the url and re-use it to sync all my playlist

def  get_track_info(link):
    track_id = link.split("/")[-1].split("?")[0]
    token = "long_token_string"
    response = requests.get(f"https://api.spotifydown.com/download/{track_id}?token={token}", headers=CUSTOM_HEADER)
    response = response.json()

    return response

It's not the ideal solution but it's still much better than doing everything by hand

@pranjalagg
Copy link
Owner

I am guessing that the token would expire after some time. Were you able to test how long the token works? @exadeci

@exadeci
Copy link
Author

exadeci commented Nov 27, 2024

@pranjalagg It seems to refresh every 10 minutes. My workaround is really not a fix just a way to still sync a bunch of playlists without the website which forces you to either download the entire playlist or having to figure out 1 by 1 the ones that are missing on your device.

Maybe there's some way to get the token using playwright. Get the python script to open a browser with it, catch the responses, get the cloudflare token and return it to the python.

@Notava1ble
Copy link
Contributor

Your solution seems to work. For downloading long playlists, the time that the token expires is to short for all the songs to download, so here's the workaround I found:

I created another script to get the links from all songs and made it output a txt file with the links formatted properly. Then I just passed the links as a cla and downloaded all of them. Whenever the toked expired I stopped the execution of the code, and restarted it with the new token.

I'm thinking of making a better script to make this process easier, making it automatically stop whenever the key expires and prompt the user for the new one, before picking where it left off.

@afkarxyz
Copy link

afkarxyz commented Dec 25, 2024

@pranjalagg It seems to refresh every 10 minutes. My workaround is really not a fix just a way to still sync a bunch of playlists without the website which forces you to either download the entire playlist or having to figure out 1 by 1 the ones that are missing on your device.

Maybe there's some way to get the token using playwright. Get the python script to open a browser with it, catch the responses, get the cloudflare token and return it to the python.

Hi, I created a tool to obtain tokens from SpotifyDown. Feel free to check it out. TokenGrabber

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

No branches or pull requests

4 participants