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

Comments is silently failing #226

Open
tjones0808 opened this issue Feb 13, 2020 · 3 comments
Open

Comments is silently failing #226

tjones0808 opened this issue Feb 13, 2020 · 3 comments
Labels

Comments

@tjones0808
Copy link

post.Comments.GetComments("new") and post.Comments.GetNew() are just silently failing for me. Anyone else having this issue?

@CrustyJew
Copy link
Owner

Can you post a code sample?

@tjones0808
Copy link
Author

tjones0808 commented Feb 17, 2020

Fails with no exception thrown at post.Comments.GetNew()

`
var reddit = new Reddit.RedditClient(_appId, _refreshToken, _appSecret, _accessToken);

            var subreddit = reddit.Subreddit(subredditName);

            var redditPosts = new List<Reddit.Controllers.Post>();
            string after = "";
            DateTime start = DateTime.Now;
            DateTime today = DateTime.Today;
            bool outdated = false;
            do
            {
                foreach (Reddit.Controllers.Post post in subreddit.Posts.GetNew(after: after, limit:250))
                {
                    if (post.Created != null)
                    {
                        redditPosts.Add(post);
                    }
                    else
                    {
                        outdated = true;
                        break;
                    }

                    after = post.Fullname;
                }
            } while (!outdated
                && start.AddMinutes(5) > DateTime.Now
                && subreddit.Posts.New.Count > 0);  // This is automatically populated with the results of the last GetNew call.

            var mappedPosts = MapPosts(redditPosts);

            await _dal.SavePostsBulk(mappedPosts);

            foreach (var post in redditPosts) 
            {
                var mappedComments = MapComments(post.Comments.GetNew());

                await _dal.SaveCommentsBulk(mappedComments);
            }`

@CrustyJew
Copy link
Owner

What version of RedditSharp is this? I recommend upgrading to the 2.0 pre-release versions and trying that.

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

No branches or pull requests

2 participants