Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GET Replies to comments #293

Open
nicolasdossantos opened this issue Jun 21, 2019 · 0 comments
Open

GET Replies to comments #293

nicolasdossantos opened this issue Jun 21, 2019 · 0 comments

Comments

@nicolasdossantos
Copy link

nicolasdossantos commented Jun 21, 2019

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant