Last active
February 22, 2023 15:15
-
-
Save gilillo32/a4fd1e4d9fb2e56e644f848cc8e7681f to your computer and use it in GitHub Desktop.
Script to write in a file line by line all your Spotify saved songs' urls.
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 spotipy.oauth2 import SpotifyClientCredentials, SpotifyOAuth | |
APP_CLIENT_ID = "" | |
APP_CLIENT_SECRET = "" | |
SPOTIPY_REDIRECT_URI = "http://localhost:8000/" | |
sp = spotipy.Spotify(auth_manager=SpotifyOAuth(client_id=APP_CLIENT_ID, client_secret=APP_CLIENT_SECRET, | |
redirect_uri=SPOTIPY_REDIRECT_URI, scope="user-library-read")) | |
results = sp.current_user_saved_tracks() | |
tracks = results['items'] | |
while results['next']: | |
results = sp.next(results) | |
tracks.extend(results['items']) | |
f = open('Canciones.txt', 'w') | |
for t in tracks: | |
f.write(t['track']['external_urls']['spotify'] + '\n') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment