RedditSharp-DEPRECATED-
RedditSharp-DEPRECATED- copied to clipboard
Comments is silently failing
post.Comments.GetComments("new") and post.Comments.GetNew() are just silently failing for me. Anyone else having this issue?
Can you post a code sample?
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);
}`
What version of RedditSharp is this? I recommend upgrading to the 2.0 pre-release versions and trying that.