mirror of
https://github.com/c0de-archive/spotipy.git
synced 2024-11-14 19:17:27 +00:00
27 lines
575 B
Python
27 lines
575 B
Python
# Delete a track from 'Your Collection' of saved tracks
|
|
|
|
import pprint
|
|
import sys
|
|
|
|
import spotipy
|
|
import spotipy.util as util
|
|
|
|
scope = 'user-library-modify'
|
|
|
|
if len(sys.argv) > 2:
|
|
username = sys.argv[1]
|
|
tids = sys.argv[2:]
|
|
else:
|
|
print("Usage: %s username track-id ..." % (sys.argv[0],))
|
|
sys.exit()
|
|
|
|
token = util.prompt_for_user_token(username, scope)
|
|
|
|
if token:
|
|
sp = spotipy.Spotify(auth=token)
|
|
sp.trace = False
|
|
results = sp.current_user_saved_tracks_delete(tracks=tids)
|
|
pprint.pprint(results)
|
|
else:
|
|
print("Can't get token for", username)
|