Reddit.NET icon indicating copy to clipboard operation
Reddit.NET copied to clipboard

redditClient.GetPosts(List<string> fullnames) drops posts if over 25 is requested

Open largenumberhere opened this issue 2 years ago • 2 comments

image Posts are silently discarded if over 25 are requested. Please add documentation and an error to protect against users silently losing posts. Thanks

largenumberhere avatar Jan 17 '23 09:01 largenumberhere

Can you post some code to go with this example? As far as I'm aware, there is no such limit. If you request 30 posts, you should get 30 posts. I've done quite a bit of testing to make sure of this.

So my first guess would be an issue with your code, but I'd need to see it in order to be sure.

sirkris avatar May 28 '23 03:05 sirkris

I've noticed the same 25 limit in GetPosts. Here's an example, using Base36Library to create a list of 50 id's:


string startID = "16xyz93";

//create a list of 50 id's using Base36Library
long startNumber = Base36.Decode(startID);
List<string> ids = new List<string>();
int nextId = 0;
while (nextId < 50)
{
	ids.Add("t3_" + Base36.Encode(startNumber + nextId).ToLower());
	nextId++;
}

//get posts by id
List<Post> posts = new List<Post>();
var refreshToken = AuthorizeUser("appId", "appSecret");
var reddit = new RedditClient("appId", "appSecret", "refreshToken");
posts = reddit.GetPosts(ids);

I've found this reddit post that explains the /by_id? endpoint only gives 25 results, and recommends using the /info endpoint for 100 results. But I can't find how to call that endpoint with Reddit.NET.

Shalie avatar Oct 05 '23 12:10 Shalie