Skip to content

Instantly share code, notes, and snippets.

@stefanhayden
Created April 9, 2023 04:46
Show Gist options
  • Save stefanhayden/a8154d3cef72c891ee5f238ed5c386a1 to your computer and use it in GitHub Desktop.
Save stefanhayden/a8154d3cef72c891ee5f238ed5c386a1 to your computer and use it in GitHub Desktop.
Python Script to export a CSV of all your favoriet tracks
# You need to install tidalapi using pip install tidalapi (more can be found here https://github.com/tamland/python-tidal)
# had to be fixed with https://github.com/tamland/python-tidal/pull/130
import csv
import sys
import pprint
import tidalapi
session = tidalapi.Session()
session.login_oauth_simple()
favorites = tidalapi.Favorites(session, session.user.id)
open('tracks.csv', 'w').close()
f = open("tracks.csv", "a")
f.write('track,album,artist\n')
getMore = True
limit = 1000
offset = 0
while getMore == True:
tracks = favorites.tracks(limit, offset);
offset += limit;
if len(tracks) == 0:
getMore = False
for track in tracks:
f.write(','.join([track.name, track.album.name, track.artist.name]) + '\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment