Skip to content

Instantly share code, notes, and snippets.

@riad-uk
Created January 4, 2018 11:28
Show Gist options
  • Save riad-uk/3003fa0183b464a0b0d2ca2e77afe477 to your computer and use it in GitHub Desktop.
Save riad-uk/3003fa0183b464a0b0d2ca2e77afe477 to your computer and use it in GitHub Desktop.
Tidal Dev tokens for 3rd Party apps
browser = 'wdgaB1CilGA-S_s2' # Streams HIGH/LOW Quality over RTMP, FLAC and Videos over HTTP, but many Lossless Streams are encrypted.
android = 'kgsOOmYk3zShYrNP' # All Streams are HTTP Streams. Correct numberOfVideos in Playlists (best Token to use)
ios = '_DSTon1kC8pABnTw' # Same as Android Token, but uses ALAC instead of FLAC
native = '4zx46pyr9o8qZNRw' # Same as Android Token, but FLAC streams are encrypted
audirvana = 'BI218mwp9ERZ3PFI' # Like Android Token, supports MQA, but returns 'numberOfVideos = 0' in Playlists
amarra = 'wc8j_yBJd20zOmx0' # Like Android Token, but returns 'numberOfVideos = 0' in Playlists
# Unkown working Tokens
token1 = 'P5Xbeo5LFvESeDy6' # Like Android Token, but returns 'numberOfVideos = 0' in Playlists
token2 = 'oIaGpqT_vQPnTr0Q' # Like token1, but uses RTMP for HIGH/LOW Quality
token3 = '_KM2HixcUBZtmktH' # Same as token1
@flying-sausages
Copy link

Either update or some steps how to generate these? ty

@melgu
Copy link

melgu commented Jul 7, 2020

At least the iOS one still works.
You can probably also sniff your own keys from the network or via your browser‘s developer tools.

@flying-sausages
Copy link

@melgu they all seem to somewhat work to generate alac URLs, I was specifically looking for a flac one. I'll give this a shot whenever I manage to emulate Android on my setup. There are some leads for those here, if anyone finds this later. 1 - You'll need to install the android app, if you don't have an android phone , maybe you can use an emulator or one of the options for running android apps in a computer.

https://forum.strawberrymusicplayer.org/topic/23/tidal-account/3

1 - You'll need to install the android app, if you don't have an android phone , maybe you can use an emulator or one of the options for running android apps in a computer.

2 - After you login in the android app, you'll have to navigate to the folder where the app stores the files with the token which are in: /Android/data/com.aspiro.tidal/cache/okhttp
Copy all of the files to your computer.

3 - In a Linux terminal, cd to the folder where those files are in your computer and execute this command: grep -r "X-Tidal-Token"
Your token will be revealed

4 - Go to the Tidal settings in Strawberry, check the option 'Use OAuth' and copy the token in the ClientID. Click login and you will be >redirected to the browser where you can accept the access to your account and that's it!

@riad-uk
Copy link
Author

riad-uk commented Jul 7, 2020

Well these aren't mine. and I doubt u can download flac format (High Res)

@melgu
Copy link

melgu commented Jul 7, 2020

They changed the official login mechanism resulting in most of these (as well as new keys) returning a 401 message when trying to login. The iOS one still works, for some reason.
Just get the ALACs and convert them to FLAC.

@riad-uk
Copy link
Author

riad-uk commented Jul 7, 2020

@melgu that’s correct, the change happened recently but some of the keys are still working.

Have you managed to download any file in ALAC format?

I haven’t, I’m on iOS and OSX

@melgu
Copy link

melgu commented Jul 7, 2020

For me, it still works. I logged in using the iOS token.

Then:
curl -X GET "https://api.tidal.com/v1/tracks/77156874/offlineUrl?limit=999&sessionId=<SessionID>&countryCode=DE&soundQuality=LOSSLESS"
(Replace <SessionID> with the ID you received from the Login call)

@riad-uk
Copy link
Author

riad-uk commented Jul 7, 2020

@melgu that wasn’t really my question, I’ve asked you if you successfully downloaded any lossless track.

@melgu
Copy link

melgu commented Jul 7, 2020

Yes. Just download the file via the URL you receive from above query.

@riad-uk
Copy link
Author

riad-uk commented Jul 7, 2020

Thanks @melgu I’ll give it a try because so far I only managed to download lossy format :(

@melgu
Copy link

melgu commented Jul 7, 2020

As you are on macOS, may I recommend my app TidalSwift: https://github.com/melgu/TidalSwift
You can download songs in there (or use it as a full replacement for the official app).

@riad-uk
Copy link
Author

riad-uk commented Jul 7, 2020

Amazing let’s give it a try... I so don’t like the official tidal app (although I love tidal) which has the best sound quality

@melgu
Copy link

melgu commented Jul 7, 2020

I so don’t like the official tidal app

I feel you, which is why I developed this app.
It still has some rough edges and performance with very long lists is still suboptimal, but it will improve as SwiftUI improves.
Also, downloading works perfectly. Offline management (just like in the iOS app) is still buggy at times. The Offline Mode (if you try to use it without internet) is also really slow right now, but generally works.

@melgu
Copy link

melgu commented Jul 7, 2020

Oh, and I should thank you, as I use the iOS token you provided in the gist inside TidalSwift 😃

@riad-uk
Copy link
Author

riad-uk commented Jul 7, 2020

Dont thank me it’s not as if it’s mine ;)

Also, does your app download provide full access to downloaded files? Eg... play the downloaded files with different player.

@melgu
Copy link

melgu commented Jul 7, 2020

You made those available, so that's enough for me 😄

Yes, when you Right Click -> Download a track, album or playlist, the files will be saved to the Downloads folder with the correct Metadata embedded.

@riad-uk
Copy link
Author

riad-uk commented Jul 7, 2020

Amazing. Will give it a try later today.

@flying-sausages
Copy link

The python package tidalapi generates ALAC links successfully too. Just chasing the dream of getting a token that generates FLACs like before...

@melgu
Copy link

melgu commented Jul 7, 2020

That tidalapi package was the inspiration for TidalSwift, as it was missing many features.

@flying-sausages Conversion isn't an option?

@flying-sausages
Copy link

flying-sausages commented Jul 7, 2020 via email

@melgu
Copy link

melgu commented Jul 7, 2020

As far as I know, there currently isn't a FLAC token that works with the old system. I tried some things and some more tokens, but even the new iOS token, I sniffed from my phone, doesn't work anymore with the old API.

@brodel77
Copy link

brodel77 commented Aug 9, 2020

Thank you for sharing this, was very helpful!

For me, it still works. I logged in using the iOS token.

Then:
curl -X GET "https://api.tidal.com/v1/tracks/77156874/offlineUrl?limit=999&sessionId=<SessionID>&countryCode=DE&soundQuality=LOSSLESS"
(Replace with the ID you received from the Login call)

@Coder84619
Copy link

As you are on macOS, may I recommend my app TidalSwift: https://github.com/melgu/TidalSwift
You can download songs in there (or use it as a full replacement for the official app).

Sorry for the dumb question, but how do I actually install TidalSwift from the Github site? And can I download unencrypted FLAC files for use with other players?

@melgu
Copy link

melgu commented Aug 19, 2020

Sorry for the dumb question, but how do I actually install TidalSwift from the Github site? And can I download unencrypted FLAC files for use with other players?

No problem. Go to the Releases section and download the latest version of TidalSwift.zip (in the assets section).
Unzip the file (probably happens automatically after download) and put the app into your Applications folder.
From there right click the App, hit Open and confirm that you want to open the app. This only needs to be done on first launch. After that you can open the app using Spotlight, Double clicking it or any other common method.

To download a song, you log-in with HiFi quality selected. Search for the song / album / playlist you want to download. Right click on it an hit Download. The downloaded file is in ALAC format (AAC when selecting low or high quality at log-in). ALAC files are lossless (just like FLACs) but play a little nicer with Apple devices. You can easily convert Apple Lossless files to FLAC though afterwards.

@hmelder
Copy link

hmelder commented Oct 17, 2020

I have completely reverse engineered the TIDALAPI and currently working on a TIDAL C Library. This is the documentation repository. Here are some API-Keys that are DRM-Free. I still have at least 10 DRM-Free client_ids in a private repo.
https://github.com/openTIDAL/docTIDAL/wiki/API-Keys
https://github.com/openTIDAL/docTIDAL/wiki/

@melgu
Copy link

melgu commented Oct 17, 2020

Where did you find more API keys? I couldn’t find any that still work fine with the older API.

Nice work in anyway!

@hmelder
Copy link

hmelder commented Oct 17, 2020

I won't disclose the exact way because TIDAL could change it at anytime. But it was a lot of work :)

@brodel77
Copy link

_DSTon1kC8pABnTw still works as an API key in Strawberry music player in Linux. Thank you!

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