mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-06-19 09:13:53 +00:00
Upload user_saved_albums_delete.py
This commit is contained in:
parent
816dd23482
commit
c610090a7c
30
examples/user_saved_albums_delete.py
Normal file
30
examples/user_saved_albums_delete.py
Normal file
@ -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)
|
||||||
Loading…
Reference in New Issue
Block a user