Created
February 18, 2012 06:34
-
-
Save wong2/1857851 to your computer and use it in GitHub Desktop.
获取人人上某视频分享下的所有评论
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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