1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// This tries to fetch a specific post on multiple Lemmpy instances
// and can try to fix missing comments on a specific instance.
export async function getLemmyPosts(instance: string, communityName: string) {
const { LemmyHttp } = await import("npm:lemmy-js-client");
let client = new LemmyHttp(`https://${instance}`, {
fetchFunction: fetch,
});
const { posts } = await client.getPosts({
community_name: communityName,
sort: "Active",
type_: "All",
limit: 20,
page: 1,
});
return posts;
}