-
-
Save Stormix/41fe93b271e1ed1fda273c8135afeed0 to your computer and use it in GitHub Desktop.
Make all playlist private on spotify
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SPOTIPY_CLIENT_ID='' | |
SPOTIPY_CLIENT_SECRET='' | |
SPOTIPY_REDIRECT_URI='http://localhost' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import spotipy | |
from dotenv import load_dotenv | |
load_dotenv() | |
import spotipy | |
from spotipy.oauth2 import SpotifyOAuth | |
scope = "user-read-private user-read-email user-library-read playlist-modify-public playlist-modify-private playlist-read-private" | |
sp = spotipy.Spotify(auth_manager=SpotifyOAuth(scope=scope)) | |
playlists = sp.current_user_playlists() | |
while playlists: | |
for idx, playlist in enumerate(playlists['items']): | |
if playlist['owner']['id'] == sp.current_user()['id']: | |
print("Changing: ", idx, playlist['name'], "to: Private") | |
sp.playlist_change_details(playlist['id'], playlist['name'], False) | |
if playlists['next']: | |
playlists = sp.next(playlists) | |
else: | |
playlists = None |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment