Grab band name search results from Spotify API

2019-09-18 20:06发布

问题:

I am seeking to add a search ability to my custom search bar of a web app I am developing to grab recognized band names and have the result grab the Spotify Result.

I have found this information regarding the search in spotify;

https://developer.spotify.com/technologies/web-api/

I am wondering if anyone has tried this and how I may approach this.

Ultimately I am seeking how to pull in Spotify Playlists based on band searched; utilizing Spotify API

回答1:

As stated in the comment, it doesn't look like the API provides CORS or JSONP so you can't access it directly from JavaScript unless your page is on the same domain as the API (or if you use forcecors plugin for firefox but that means every client visiting your site has to install and activate the plugin).

To use the API on a public website with a different domain as the API your site has to proxy requests from JavaScript to the API. You have to use server side script like PHP, .net, Python or Java for this.