-
Notifications
You must be signed in to change notification settings - Fork 75
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
Use "More" to "Continue this thread" #219
Comments
Whats the implementation of If you call |
Hi, I'm on mobile so apologies in advance for dodgy formatting. GetAllComments look like: private static List<Comment> GetAllComments(Post post, CommentSort sorting)
{
Task<List<Thing>> getCommentsTask = post.GetCommentsWithMoresAsync(0, sorting);
getCommentsTask.Wait();
List<Comment> comments = ResolveToComments(getCommentsTask.Result);
getCommentsTask.Dispose();
return comments;
}
private static List<Comment> ResolveToComments(List<Thing> things)
{
List<Comment> comments = new List<Comment>();
foreach (Thing item in things)
{
if (item is Comment)
{
comments.Add((Comment)item);
}
else if(item is More)
{
More more = (More)item;
Task<List<Thing>> getThingsTask = more.GetThingsAsync();
getThingsTask.Wait();
List<Thing> moreItems = getThingsTask.Result;
getThingsTask.Dispose();
comments.AddRange(ResolveToComments(moreItems));
}
else
{
Console.WriteLine("Could not resolve thing to comment - " + item.ToString() + " - " + item.GetType().ToString());
}
}
return comments;
} Call signature may not match as I simplified the original code I posted a bit for clarity. |
Ok, think I've tracked down the issue. The initial issue I raised I think was a problem in my code, not the lib. However, there is a closely related issue that has been mentioned in a couple of places elsewhere. The second thread there link through to the praw solution. But to summarise - on some deeply nested comments, like those I linked in the original issue, the "Continue this thread" object looks like this: {{
"count": 0,
"name": "t1__",
"id": "_",
"parent_id": "t1_cydnx3d",
"depth": 10,
"children": []
}} Which obviously isn't particularly useful. The solution to get the perma-link of the parent to get an updated context returns a 403 when calling like so: string urlFormat = "https://www.reddit.com{0}";
Uri permaLink = new Uri(String.Format(urlFormat, ((Comment)parent).Permalink));
Task<Comment> getPermaTask = Reddit.GetCommentAsync(permaLink);
getPermaTask.Wait();
parent = getPermaTask.Result; So the called endpoint ends up being I also tried adding |
Actually was thinking of the |
@czf your changes didn't fix it, but a fresh look at your version and looking at Praw and SnooWrap meant I figured it out - thanks! @CrustyJew I forked cfz's fork, so up to you if you merge both PRs or not, don't suppose it makes a difference? 🤷♂ |
@czf thanks for the help on this one. |
Hi, I'm struggling to iterate down a comment tree. Based on what I've seen of the RedditSharp code and the Reddit API, I think I should get back a
More
object on comments that on Reddit show with aContinue this thread
link. I'm not seeing this and I'm not sure if it's not implemented or I'm doing something wrong...The post I'm looking at specifically in trying to solve this is this one, specifically this comment thread. And my current implementation looks something like this, where I've retrieved the above linked post, and I'm traversing down the above comment thread.
The text was updated successfully, but these errors were encountered: