Skip to content

Instantly share code, notes, and snippets.

@wong2
Created February 18, 2012 06:34
Show Gist options
  • Save wong2/1857851 to your computer and use it in GitHub Desktop.
Save wong2/1857851 to your computer and use it in GitHub Desktop.
获取人人上某视频分享下的所有评论
function getComments(shareId, ownerId, startCommentId){
var count = 0;
function getComment(commentId){
var data = { shareId: shareId, owner: ownerId, commentId: commentId }
data.md5 = XN.app.share.CommentManger.getOptions("shareUrlMd5");
var xhr = new XN.net.xmlhttp({
url: "http://share.renren.com/share/comment/moreurlcomment",
data: XN.array.toQueryString(data),
onSuccess: function(r){
var data = JSON.parse(r.responseText);
count += data.comments.length;
if(data.hasMore){
getComment(data.comments[0].id);
} else {
console.log(count);
}
}
});
}
getComment(startCommentId);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment