非常感谢 !
我上班了
我发现的唯一问题是,当获取特定的评论ID时
提交后返回分条注释,
例如
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为什么不打印全部评论?
最佳答案
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()
。关于java - jreddit返回意外结果,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/29498185/