Readme

Fetches the 20 active posts in a community from a specific Lemmy instance.

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;
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
October 23, 2023