small updates week6 + week4

This commit is contained in:
gauthiier
2016-12-07 18:35:42 +01:00
parent de732246dd
commit 6a95d6287c
3 changed files with 88 additions and 5 deletions
+4
View File
@@ -69,6 +69,10 @@ function search_for_username(username, callback) {
instagram.get('/users/search', {q: username}).then(function(res, pag) {
console.log('blablbalblalbalbla');
console.log(res);
callback(res);
}).catch(function(err) {
+39 -5
View File
@@ -46,7 +46,11 @@ function search_for_tracks(keyword, callback) {
console.log('search_for_tracks: ' + keyword);
spotify.searchTracks(keyword, null, function(err, data) {
var options = {
limit: 1
}
spotify.searchTracks(keyword, options, function(err, data) {
if (err) {
console.error('Something went wrong', err.message);
@@ -58,6 +62,32 @@ function search_for_tracks(keyword, callback) {
});
}
function search_playlist(keyword, callback) {
var options = {
limit: 5
}
spotify.searchPlaylists(keyword, options, function(err, data) {
if (err) {
console.error('Something went wrong', err.message);
return;
}
for(i of data.body.playlists.items) {
console.log(i);
console.log('---------\n\n\n\n');
}
});
}
/* -----------------------------
@@ -75,10 +105,14 @@ io.on('connection', function(socket) {
console.log('searching spotify with: ' + JSON.stringify(msg));
search_for_tracks(msg.keyword, function(results) {
// send raw results
io.emit('search_spotify_results', results);
});
search_playlist(msg.keyword, function(results) {
});
// search_for_tracks(msg.keyword, function(results) {
// // send raw results
// io.emit('search_spotify_results', results);
// });
});