RedditSharp-DEPRECATED- icon indicating copy to clipboard operation
RedditSharp-DEPRECATED- copied to clipboard

Comments is silently failing

Open tjones0808 opened this issue 5 years ago • 3 comments

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

tjones0808 avatar Feb 13 '20 02:02 tjones0808

Can you post a code sample?

CrustyJew avatar Feb 17 '20 22:02 CrustyJew

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);
            }`

tjones0808 avatar Feb 17 '20 23:02 tjones0808

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

CrustyJew avatar Feb 18 '20 14:02 CrustyJew