Skip to content

Commit

Permalink
Merge bcaedfd into 420665d
Browse files Browse the repository at this point in the history
  • Loading branch information
huyphamily committed Sep 2, 2014
2 parents 420665d + bcaedfd commit 9c7f9b3
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions server/api/search/grab.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,18 @@ exports.instagram = function(query, cb) {
//parsing the json string
var data = JSON.parse(result).data;

//grabing specific data from instagram
data.forEach(function(value){
var obj = {};
obj.picture = value.images.standard_resolution.url;
obj.user = value.user.username;
obj.proPic = value.user.profile_picture;
obj.link = value.link;
obj.date = value.created_time;
storage.push(obj);
});
if( data ) {
//grabing specific data from instagram
data.forEach(function(value){
var obj = {};
obj.picture = value.images.standard_resolution.url;
obj.user = value.user.username;
obj.proPic = value.user.profile_picture;
obj.link = value.link;
obj.date = value.created_time;
storage.push(obj);
});
}

//passing the array of data into the callback
cb( storage );
Expand Down Expand Up @@ -81,15 +83,17 @@ exports.reddit = function(query, cb) {
//parsing the json string
var data = JSON.parse(result).data.children;

//grabing specific data from reddit
data.forEach(function(value){
var obj = {};
obj.title = value.data.title;
obj.name = value.data.name;
obj.link = value.data.url;
obj.date = value.data.created;
storage.push(obj);
});
if( data ) {
//grabing specific data from reddit
data.forEach(function(value){
var obj = {};
obj.title = value.data.title;
obj.name = value.data.name;
obj.link = value.data.url;
obj.date = value.data.created;
storage.push(obj);
});
}

//passing array of data into the callback
cb( storage );
Expand Down

0 comments on commit 9c7f9b3

Please sign in to comment.