/get_spotify_data

obtain song and user playlists data using Spotify webAPI

Primary LanguageJupyter Notebook

get_spotify_data

Obtain data from the Spotify worldwide ranking chart and tracks and user playlists data using Spotify webAPI

0. Setting up your spotify credentials

Follow the instructions at the Spotify for Developers Quick Start page and follow up to the Set Up Your Account section. Alternatively, you may follow this tutorial

Make a new app and copy the Client ID and Secret Code.

1. scrape_spotify_charts.py

Based from automated data collection from Spotify's worldwide ranking in 50+ countries from edumucelli. The data collected by the code has been published at Kaggle datasets and is being updated on a quarterly basis.

First, create the folder data. This will be the directory where the downloaded files will be written.

On the command line, run by:

python scrape_spotify_charts.py

or alternatively, in the jupyter notebook

%run scrape_spotify_charts.py

Specify the desired region, start and end date, and directory.

2. consolidate_spotify_daily_charts.ipynb

Use this notebook to consolidate the daily charts data into monthly and a single unified file

3. set_credentials.ipynb

Install the keyring package

pip install keyring 

The Python keyring library provides an easy way to access the system keyring service from python. It can be used in any application that needs safe password storage.

Run the notebook. Keyring will ask for your Spotify Client ID and Secret Code and safely hold it in your device.

For the notebooks below, please also install the spotipy python module

pip install spotipy

4. get_spotify_track_artist_data.ipynb

Use this notebook to get Spotify track data for the tracks ranking in the daily charts data

5. get_spotify_playlists.ipynb

Use this notebook to get spotify playlists based on a spotipy query object