非常感谢! 我上班了,
我发现的唯一问题是获取特定的评论ID 提交它会返回分解的评论,
E.g
Reddit reddit = new Reddit("USER","PASSWORD");
List<Submission> submissions = reddit.getSubmission(1); //returns 1 submission
for (Submission sub : submissions) {
System.out.println("BEGINNING OF SUBMISSION \n"+sub);
System.out.println(reddit.getCommentsForSubmission(sub.getIdentifier())); //prints out
System.out.println("END OF SUBMISSION \n");
}
此代码仅打印第一个看起来像这样的评论..
提交的开始 提交(t3_31qc98)
结束运行
getCommentsForSubmission看起来像这样......
public List<Comment> getCommentsForSubmission(String subId){
Comments coms = new Comments(getRestClient(), getUser());
List<Comment> commentsSubmission = coms.ofSubmission(subId, null, 0, 8, 20, CommentSort.TOP);
return commentsSubmission;
}
为什么Jreddit没有打印出整个评论?
答案 0 :(得分:1)
jReddit/src/main/java/com/github/jreddit/entity/Comment.java
类包含以下toString()
@Override
public String toString() {
return "Comment(" + identifier + ")<" + ((body.length() > 10) ? body.substring(0, 10) : body) + ">";
}
您可以打电话获取完整评论:
comment.getBody();
问题是你正在调用System.out.println()
,它会自动调用方法中调用的当前对象的toString()
。