mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-06-19 09:13:53 +00:00
* Fixed scripts in examples directory that didn't work, deleted any redundant examples. * Added examples for methods related to audiobooks, shows and episodes * Updated changelog --------- Co-authored-by: Stéphane Bruckert <stephane.bruckert@gmail.com>
33 lines
917 B
Python
33 lines
917 B
Python
import argparse
|
|
import logging
|
|
|
|
import spotipy
|
|
from spotipy.oauth2 import SpotifyOAuth
|
|
|
|
scope = 'playlist-modify-public'
|
|
|
|
logger = logging.getLogger('examples.unfollow_playlist')
|
|
logging.basicConfig(level='DEBUG')
|
|
|
|
'''
|
|
Spotify doesn't have a dedicated endpoint for deleting a playlist. However,
|
|
unfollowing a playlist has the effect of deleting it from the user's account.
|
|
When a playlist is removed from the user's account, the system unfollows it,
|
|
and then no longer shows it in playlist list.'''
|
|
|
|
|
|
def get_args():
|
|
parser = argparse.ArgumentParser(description='Unfollows a playlist')
|
|
parser.add_argument('-p', '--playlist', required=True,
|
|
help='Playlist id')
|
|
return parser.parse_args()
|
|
|
|
|
|
def main():
|
|
args = get_args()
|
|
sp = spotipy.Spotify(auth_manager=SpotifyOAuth(scope=scope))
|
|
sp.current_user_unfollow_playlist(args.playlist)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main() |