javascript - Spotify API: get random songs -
hello people on stackoverflow,
i have make webapp spotify study. decided make application 30 seconds preview of random song. able or dislike song.
so have random songs out of spotify. can me please. me lot!
thanks help!!
regards
edit
i'm trying use spotify api create application finds , plays random song spotify library.
in spotify api can 1 single track. track, need trackid. can songs user's library, instead of getting tracks user's library, want tracks whole spotify library. in spotify api developers area there isn't getting tracks spotify library.
i can load album , 1 track out of album. , every single time, isn't easy @ all. know if there easier solution tracks spotify.
i got solution. think best solution random tracks out of spotify. let me know guys think of this. isn't random, it's kind of.:)
//make variable search queries , put in array. (you can create more search queries. $getrandomsongsarray = array('%25a%25', 'a%25', '%25e%25', 'e%25', '%25i%25', 'i%25', '%25o%25', 'o%25'); //this random result out of array above $getrandomsongs = $getrandomsongsarray[array_rand($getrandomsongsarray)]; //this random offset number between 1 , 1000. random track. (you can change numbers btw) $getrandomoffset = rand(1, 1000); //this url gets results out of spotify api. have put in variables created above. $url = "https://api.spotify.com/v1/search?query=$getrandomsongs&offset=$getrandomoffset&limit=1&type=track&market=nl";
Comments
Post a Comment