JMPerez / spotify-web-api-js

A client-side JS wrapper for the Spotify Web API
https://jmperezperez.com/spotify-web-api-js/
MIT License
1.87k stars 265 forks source link

Hi, how can I get album instead of tracks? #52

Closed Pancho111 closed 7 years ago

Pancho111 commented 7 years ago

Hi Jose Manuel , this website is using Spotify-web-api-js , how can I make it do albums instead of tracks? for example , Michael Jackson - Off the Wall Off the Wall is an album and a track of the same album this website is giving me the track uri spotify:track:3zYpRGnnoegSpt3SguSo3W but I would like to get the album uri instead spotify:album:2ZytN2cY4Zjrr9ukb2rqTP How can I achieve this task?

thanks

JMPerez commented 7 years ago

Hi @calixto111. Not sure what website you are referring to, but it seems to be using the search endpoint. You can pass "album" as the type of search results you want to get back, instead of "track".

Eg https://api.spotify.com/v1/search?q=Michael+Jackson+Off+the+Wall&type=album

You can also use the Web API console as a playground: https://developer.spotify.com/web-api/console/get-search-item?q=Michael+Jackson+Off+the+Wall&type=album

When using the wrapper, call the searchAlbums() function. Check out https://jmperezperez.com/spotify-web-api-js/#searchAlbums

Pancho111 commented 7 years ago

hi , JMPerez, this is the website I refered to http://michaeldick.me/YetAnotherSpotifyPlaylistConverter/ how can I edit this to get a different result , I mean album uri , instead of track? thanks