Extract your Spotify history using the command line with this plugin for chronicle-etl.
# Install chronicle-etl and this plugin
$ gem install chronicle-etl
$ chronicle-etl plugins:install spotifyTo get access to the Spotify API, you must first create an app. Press the "Create an app" button in the Developer Dashboard.
In the app's setting, in the Redirect URIs field, add http://localhost:4567/auth/spotify/callback. After your app has been saved, grab the client_id and client_secret credentials and save them to chronicle-etl secrets:
$ chronicle-etl secrets:set spotify client_id
$ chronicle-etl secrets:set spotify client_secretNext, we need an access token for accessing your data. We can use the authorization flow:
$ chronicle-etl authorizations:new spotifyThis will open a browser window to authorize on spotify.com. When the flow is complete, access/refresh tokens will be saved in the chronicle secret system under the "spotify" namespace. It'll be available automatically whenever you use this plugin.
# Extract recent limits
$ chronicle-etl --extractor spotify:listen --limit 10
# Extract liked tracks from the last week
$ chronicle-etl --extractor spotify:like --since 1w
# Transform as Chronicle Schema
$ chronicle-etl --extractor spotify:like --since 1w --schema chronicle
# Extract saved albums
$ chronicle-etl --extractor spotify:saved-album --limit 10
# Display a table of album names you've liked in last week
$ chronicle-etl --extractor spotify:saved-album --since 1w --schema chronicle --loader table --fields end_time object.nameAll the extractors expect uid, access_token and refresh_token to be available in your Chronicle secrets. After doing the authorization flow, you can verify that they exist using: $ chronicle-etl secrets:list spotify
Extractor for your Spotify liked tracks
Extractor for your Spotify saved albums
Extractor for your recent listens. Due to API limitations, only your 50 most recent
- extractor for playlist activity (#3)
- incorporate more Spotify metadata into the transformed records