Help Needed: How find the 'Like' count?

on my journey to automated federation testing (https://mro.name/activitypub), I’d like to read the ‘like’ counter before and after Like and Dislike activities.

How would I do that with activitypub et al.?

1 Like

I ask all the implementers for help, what do you think about that?

@nutomic @chocobozzz @diogo @nightpool @trwnh @pukkamustard @tcit @mayel @Sebastian

Background: I think of a monitoring a la https://updown.io/4kug to demonstrate both usage and availability of some basic usecases and some servers.

If you have implemented the likes Collection for the object, then you just have to count the number of items in that collection :slight_smile:

1 Like

It’s about querying other servers. That’s meant with federation, isn’t it? Otherwise I wouldn’t bother the implementers.

Well then, the standard way to find the like count is also to look at the likes collection. :slight_smile: But this collection is optional, so it will work for softwares that chose to implement it.

2 Likes

solved: likes collection as done in https://codeberg.org/mro/activitypub/src/branch/master/monitor.cgi.

Caveat: optional.
AFAIK nobody but peertube implements it.

Maybe peertube is the only thing that needs it

Since other servers could easily lie about how many Likes have been sent, both Mastodon and Pleroma have chosen to only display the like count that is local to that server, not considering Likes that are claimed by the remote server.

how do I query that for e.g. https://digitalcourage.social/@mro/108206209517296437

I don’t read DE but the basic idea is to query for all posts with type = “Like” and object->id = x, where x is the id of the post whose likes are being counted, and return only the count of those results (although you might wish to enumerate the list of actors as well). The precise details will depend of course on your storage implementation and desired user interface.

I would have done exactly the same thing for Question ; which is in my opinion the most sensible approach but no longer practical and is off topic.