Im building a Spotify application with javascript and react, Ive managed to get a Spotify user's playlists and I have the user select two of those playlists which get put into two different arrays.
var playlist1 = [];
var playlist2 = [];
Inside these arrays there contains all the Spotify playlist data like its id, uri, tracks, etc. What Im trying to do is access these arrays in my python file and apply a recommendation algrotihms to create a playlist based on those two playlists. How would I go about accessesing these arrays in python? Thanks for any help :)
There are two main ways of doing something like this (fairly) easy.
If you want your app to stay local, just use text files to handle the data. A nice format that both languages can interpret is JSON. So, in your JS, write the data to a text file and then read that textfile in Python.
Above does not really makes sense when using react, since it is really web based. so I would recommend step 2:
Since you are using React, it is logical to build a client-server model where you use a
REST-API (or socket etc.) to send and receive the data to both
programs. Then, you can just send the data in JSON format by calling a POST
to the rest-api that is hosted by your Python application with the JSON array containing the spotify information.