tamland / python-tidal

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

How do I add a track to my Favorite playlist? #83

Closed MrHarBear closed 2 years ago

MrHarBear commented 2 years ago

I tried the login_oauth_simple() login method and seemed to have logged on with a session ID. However, my end goal is to try to add a list of track to my Favorite list. But I can't seem to do it.

import tidalapi
session = tidalapi.Session()
session.login_oauth_simple()
session.check_login()
print(session.session_id)
print(session.access_token)
print(session.refresh_token)
print(session.token_type)

userid=tidalapi.Favorites(session = session.session_id, user_id = session.user)
userid.add_track(track_id='1346232')
morguldir commented 2 years ago

Try

favorites = session.user.favorites
favorites.add_track(1346232)

The user id is also at session.user.id, so that's probably why it didn't work, and session should just be session, but yeah just use the convenience variables.