mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-06-19 09:13:53 +00:00
20 lines
444 B
Python
20 lines
444 B
Python
# Prints whether a track exists in your collection of saved tracks
|
|
|
|
import pprint
|
|
import sys
|
|
|
|
import spotipy
|
|
from spotipy.oauth2 import SpotifyOAuth
|
|
|
|
scope = 'user-library-read'
|
|
|
|
if len(sys.argv) > 1:
|
|
tid = sys.argv[1]
|
|
else:
|
|
print("Usage: %s track-id ..." % (sys.argv[0],))
|
|
sys.exit()
|
|
|
|
sp = spotipy.Spotify(auth_manager=SpotifyOAuth(scope=scope))
|
|
results = sp.current_user_saved_tracks_contains(tracks=[tid])
|
|
pprint.pprint(results)
|