mattbdean/JRAW

GET Replies to comments

nicolasdossantos opened this issue · 0 comments

Hello,
I am trying to retrieve comments and its replies from a submission.
With the code I have I am only getting comments but no replies. How could I change the in order to obtain the replies as well?

` public static List executeRedditCommentSearch(RedditClient client, Submission
submission, Integer commentMaxDepth,
Integer commentMaxResults, CommentSort commentSort, Logger log) {

	List<Comment> comments = new ArrayList<Comment>();
	
	try {
		Iterator<CommentNode<Comment>> iterator = client.submission(submission.getId()).comments().iterator();
		while(iterator.hasNext()) {
			comments.add(iterator.next().getSubject());
		}
		
	} catch(Exception e) {
		log.error("Problem retrieving comments for submission[" + submission.getUrl() + "].");
		comments = Lists.newArrayList();
	}
	log.info("Reddit Comment Searcher retrieved " + comments.size() + " comments for submission " + submission.getId() + ".");
	return comments;
}`

Thank you!