tamland / python-tidal

Python API for TIDAL music streaming service
GNU Lesser General Public License v3.0
417 stars 111 forks source link

HI_RES_LOSSLESS stream is available even when using Oauth authentication #277

Open tehkillerbee opened 2 months ago

tehkillerbee commented 2 months ago

It appears that Oauth authentication is enough for getting access to HI_RES_LOSSLESS audio. Perhaps this occurred after the recent tidal subscription changes.

If this is indeed the case, documentation should be updated accordingly, as PKCE login does not appear to be necessary anymore to get full HI_RES_LOSSLESS quality.

GioF71 commented 2 months ago

Hello, I just tried HI_RES_LOSSLESS and HI_RES over an existing oauth2 authentication token, but it does not work for me. The media_url apparently is not avaialable. Only "LOSSLESS" (and possibly mp3 I suppose) works with oauth2. Maybe the library needs to reflect the changes you have discovered? Apparently, I cannot get new pkce token anymore as I get an error when I try to enter my username, but my existing pkce token is currently working in HI_RES_LOSSLESS more. Fortunately I have two instances of upmpdcli running the tidal plugin in oauth2 and pkce respectively, but of course if would be great if we can have oauth2 working in HI_RES_LOSSLESS mode as you are saying. Thank you for the great work!

tehkillerbee commented 2 months ago

@GioF71 Have you tried re-authentication with Oauth?

I am definitely using Oauth right now (I just reauthenticated) and I am presented with a HI_RES_LOSSLESS file. I have only tested it with python-tidal directly. Saving the .MPD file and playing it with ffplay gives me a 192000 Hz, stereo, s32 (24 bit), file

You can try verifying this with the example/pkce_example.py and reauthenticating with do_pkce=False

EDIT: Sorry, you need to use the stream() not the direct URL for this to work.

GioF71 commented 2 months ago

Hello, I will definitely try. Does this work in the current release 0.7.6 or in the current master branch?

tehkillerbee commented 2 months ago

I've been using the current master branch but I do not see why it shouldn't work for 0.7.6

GioF71 commented 2 months ago

I've been using the current master branch but I do not see why it shouldn't work for 0.7.6

perfect! will try asap, thank you

GioF71 commented 2 months ago

Hello, it worked perfectly. It has been the occasion for removing old code that was loading the tokens from env variables. It was a mess and had become completely useless. May I ask you, as you seem to be about to publish a release, if the method "login_session_file" can also accept an optional print function? That might help me to allow upmpdcli to almost automatically create a credential file. But without that additional argument, the output of the method would never be routed to the upmpdcli log. Or, of course, if there is an alternative, I might change the code according to your advice. Thank you once again for the great work!

tehkillerbee commented 2 months ago

if the method "login_session_file" can also accept an optional print function?

I've added a separate issue for this. Feel free to add details describing the feature request. PRs are of course always welcome, otherwise I will try to see if I get time to add the feature to v0.7.7 :)

tedinati commented 5 days ago

I used the example code which is examples/simple.py, And when i try to get hi_res_loseless i get requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url issue

tehkillerbee commented 5 days ago

I used the example code which is examples/simple.py, And when i try to get hi_res_loseless i get requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url issue

You need to use the stream() not the direct URL for this to work with hi_res_lossless