Skip to content

Instantly share code, notes, and snippets.

@dannyvassallo
Created May 18, 2015 21:59
Show Gist options
  • Save dannyvassallo/1b94aa931d1a37e0f742 to your computer and use it in GitHub Desktop.
Save dannyvassallo/1b94aa931d1a37e0f742 to your computer and use it in GitHub Desktop.
Get Facebook Feed from Superfan
$.ajax({
dataType: "json",
url: "http://superfan-tsm-localhost.com:3000/api/v1/facebookfeeds/5",
headers: {"X-Api-Key":"tBEPQTWZO2tArSNQ4emyagtt"} ,
success: function(data){
var feed = data["feed"]
$.each(feed, function(i, item) {
var postMessage = feed[i].message;
var postUserName = feed[i].from;
var postUserId = feed[i].id;
var postPicture = feed[i].picture;
var comments = feed[i]["comments"];
console.log(postUserName);
console.log(postUserId);
console.log(postPicture);
console.log(postMessage);
console.log(" ");
if(comments != null){
$.each(comments, function(i, item) {
var commentMessage = comments[i].message;
var commentUserName = comments[i].name;
var commentUserId = comments[i].id;
var commentPolarity = comments[i].polarity;
var commentReplies = comments[i].comments;
console.log(commentMessage);
console.log(commentUserName);
console.log(commentUserId);
console.log(commentPolarity);
console.log(" ");
if(commentReplies != null){
$.each(commentReplies, function(i, item) {
var replyMessage = commentReplies[i].message;
var replyUserName = commentReplies[i].name;
var replyUserId = commentReplies[i].id;
var replyPolarity = commentReplies[i].polarity;
console.log(replyMessage);
console.log(replyUserName);
console.log(replyUserId);
console.log(replyPolarity);
console.log(" ");
})
}
})
}
})
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment