Something went wrong. Try again.
This string has no description
Something went wrong. Try again.
801 B · 19 lines · Created 1y ago
JavaScript
12345678910111213141516171819// let's count the number of likes on a Bluesky post// ...but without using any Bluesky infrastructure at all!
// Constellation knows about *all* references to every record// This API counts up the unique identities from those referencesconst url = new URL('https://constellation.microcosm.blue/links/count/distinct-dids')
// set the bluesky post's record at-uri as the "target"const record_uri = 'at://did:plc:hdhoaan3xa3jiuq4fg4mefid/app.bsky.feed.post/3lwcmto4tck2h';url.searchParams.set('target', record_uri);
// filter references to those from bluesky likesurl.searchParams.set('collection', 'app.bsky.feed.like')url.searchParams.set('path', '.subject.uri')
// let's go!const res = await fetch(url);const { total } = await res.json();// total now has the count of likes on our post!