출처: https://machinelearningknowledge.ai/tutorial-how-to-use-spotipy-api-to-scrape-spotify-data/

Step 1: Creating Spotify Developers Account
기존에 사용하던 Spotify 계정을 사용하여 로그인
Step 2: Creating a New App
Step 3: Obtaining Client Id and Client Secret Keys
pip install spotipy
import spotipy
from spotipy.oauth2 import SpotifyClientCredentials
import json
import numpy as np
import pandas as pd
client_id = <step 3의 32자 난수의 id 복사>
client_secret = <step 3의 32자 난수의 secret 복사>
client_credentials_manager = SpotifyClientCredentials(client_id=client_id,client_secret=client_secret)
sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager)
# https://open.spotify.com/playlist/37i9dQZF1DX35DWKgAk2B5
# 위 url에서 37i9dQZF1DX35DWKgAk2B5 부분
playlist_id = <알고자 하는 playlist의 url의 난수 복사>
results = sp.user_playlist(<username>, playlist_id, 'tracks')
playlist_tracks_data = results['tracks']
playlist_tracks_id = []
playlist_tracks_titles = []
playlist_tracks_artists = []
playlist_tracks_first_artists = []
for track in playlist_tracks_data['items']:
playlist_tracks_id.append(track['track']['id'])
playlist_tracks_titles.append(track['track']['name'])
# adds a list of all artists involved in the song to the list of artists for the playlist
artist_list = []
for artist in track['track']['artists']:
artist_list.append(artist['name'])
playlist_tracks_artists.append(artist_list)
playlist_tracks_first_artists.append(artist_list[0])
features = sp.audio_features(playlist_tracks_id)
feature_df = pd.DataFrame(data=features, columns = features[0].keys())
features_df['title'] = playlist_tracks_titles
features_df['first_artist'] = playlist_tracks_first_artists
features_df['all_artists'] = playlist_tracks_artists
#features_df = features_df.set_index('id')
features_df = features_df[['id', 'title', 'first_artist', 'all_artists',
'danceability', 'energy', 'key', 'loudness',
'mode', 'acousticness', 'instrumentalness',
'liveness', 'valence', 'tempo',
'duration_ms', 'time_signature']]
features_df
features_df.to_csv("playlist.csv", encoding='utf-8',index="false")Very good article, now i will go download spotify apk to experience free songs only available here
https://aloapk.com/es/spotify-apk/
You don’t really need to “scrape” Spotify since Spotipy gives you proper API access for tracks, playlists, and artist data. Just register a Spotify developer app, grab your client ID/secret, and use Spotipy to authenticate. From there you can pull track metadata, audio features, or even build custom playlists programmatically. It’s much cleaner and safer than scraping. And if you’re just looking for a quick way to listen while testing, something simple like SpotifyFree.net
https://spotifyfree.net/
thanks for sharing, i will find out if the Spotify API works well with the Spotify Mod APK app i downloaded from https://spotify-apk.es.modfyp.com.
It's a valuable resource for developers interested in working with Spotify's data. If you're considering taking your interest in Spotify further and want to explore building a music streaming app, this guide on "how to make a Spotify app" can provide you with a comprehensive understanding of the development process and associated costs: https://www.cleveroad.com/blog/how-to-make-a-spotify-app--look-inside-a-spotify-app-and-find-out-the-cost-of-app-development/. It's a great complement to your data scraping work.