public async Task <E621Post> SearchRandom(string tags) { var options = new E621SearchOptions { Limit = 1, Tags = $"{tags} order:random", TypedTags = true }; var posts = await _client.Search(options); return(posts.FirstOrDefault()); }
public async Task <(List <E621Post>, long)> SearchAfter(string tags, long afterId) { var searchOptions = new E621SearchOptions { Tags = tags, TypedTags = true }; var posts = await _client.Search(searchOptions); var newPosts = posts .TakeWhile(post => post.Id > afterId) .Take(afterId == default ? 1 : 8) .ToList(); var newLastId = posts.Max(post => post.Id); return(newPosts, newLastId); }