-
-
Save nsyntych/eb867b06dd4350e22785223b1af7696c to your computer and use it in GitHub Desktop.
| #!/usr/bin/python3 | |
| import tidalapi | |
| import json | |
| from pathlib import Path | |
| from configparser import ConfigParser | |
| strawberry_conf_file_path = str(Path.home()) + "/.config/strawberry/strawberry.conf" | |
| strawberry_conf_file = ConfigParser() | |
| strawberry_conf_file.read(strawberry_conf_file_path) | |
| session = tidalapi.Session() | |
| session.login_pkce() | |
| creds = { | |
| "token_type": session.token_type, | |
| "session_id": session.session_id, | |
| "access_token": session.access_token, | |
| "refresh_token": session.refresh_token, | |
| } | |
| strawberry_conf_file["Tidal"]["type"] = "2" | |
| strawberry_conf_file["Tidal"]["streamurl"] = "2" | |
| strawberry_conf_file["Tidal"]["oauth"] = "true" | |
| strawberry_conf_file["Tidal"]["enabled"] = "true" | |
| strawberry_conf_file["Tidal"]["client_id"] = session.config.client_id_pkce | |
| strawberry_conf_file["Tidal"]["quality"] = "HI_RES_LOSSLESS" | |
| strawberry_conf_file["Tidal"]["access_token"] = creds["access_token"] | |
| strawberry_conf_file["Tidal"]["refresh_token"] = creds["refresh_token"] | |
| with open(strawberry_conf_file_path, "w") as configfile: | |
| strawberry_conf_file.write(configfile) | |
| print(json.dumps(creds, indent=4)) |
nice!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Wonderful - thanks. For any who want to know how to use this to add the right details to Strawberry, keep OAUTH enabled and look for the client_id row in in the .config/strawberry/strawberry.conf file created in your home folder. It's a 16 character string.
@nsyntych I've just tried your script and had "Tidal not authenticated" error. Managed to solve it by adding two more parameters to the .conf file: token_type=Bearer and then country_code=PL because after adding the first one I get through login but had "Missing countryCode" error. Put PL here because I'm from Poland.
The full script is here: https://gist.github.com/Cajivah/df5bd06448a2f3bf09534b23d0928043
Have something changed using this ?
i have used it before without any problems but on my new arch box it times out every day ?
@nsyntych I've just tried your script and had "Tidal not authenticated" error. Managed to solve it by adding two more parameters to the .conf file:
token_type=Bearerand thencountry_code=PLbecause after adding the first one I get through login but had "Missing countryCode" error. Put PL here because I'm from Poland.The full script is here: https://gist.github.com/Cajivah/df5bd06448a2f3bf09534b23d0928043
Works, nice!
Please use this revision from now on: https://gist.github.com/Cajivah/df5bd06448a2f3bf09534b23d0928043
( and hope they don't change something again soon :) )
@Cajivah thank you for the fix!
Obviously you need to get the deps first:
pip install configparser pathlib tidalapiand then run:
python tidal_login.py