mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-10-12 01:10:45 +00:00
Upload user_saved_albums_delete.py
This commit is contained in:
1 parent
816dd23482
commit
c610090a7c
1 file changed
+30
@@ -0,0 +1,30 @@
|
|||||||
|
"""
|
||||||
|
Deletes user saved album
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
import pprint
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
import spotipy
|
||||||
|
import spotipy.util as util
|
||||||
|
|
||||||
|
if len(sys.argv) > 1:
|
||||||
|
username = sys.argv[1]
|
||||||
|
else:
|
||||||
|
print("Usage: %s username" % (sys.argv[0],))
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
scope = 'user-library-modify'
|
||||||
|
token = util.prompt_for_user_token(username, scope)
|
||||||
|
|
||||||
|
if token:
|
||||||
|
sp = spotipy.Spotify(auth=token)
|
||||||
|
sp.trace = False
|
||||||
|
uris = input("input a list of album URIs, URLs or IDs: ")
|
||||||
|
uris = list(map(str, uris.split()))
|
||||||
|
deleted = sp.current_user_saved_albums_delete(uris)
|
||||||
|
print("Deletion successful.")
|
||||||
|
|
||||||
|
else:
|
||||||
|
print("Can't get token for", username)
|
||||||
Reference in new issue
Block a user