this post was submitted on 04 Oct 2024
4 points (70.0% liked)

Lemmy App Development

711 readers
1 users here now

A place for Lemmy builders to chat about building apps, clients, tools and bots for the Lemmy platform.

On-Topic:

Off-Topic:

founded 1 year ago
MODERATORS
 

Is there a way to get a list of users subscribed to a given Lemmy community? Trying to do some Lemmy wide data analysis using that information.

Or alternatively, is there a way to get a list of communities a given user is subscribed to?

top 2 comments
sorted by: hot top controversial new old
[โ€“] [email protected] 3 points 1 month ago (1 children)

If you're an admin of an instance which it seems you are, you can fetch some info of limited usefulness depending on where the community and users are.

  1. for remote communities, you can fetch which local users are subbed to it
  2. for local communities, you can fetch all users subbed to it

There's no UI or API (that I know of), but it can be fetched from the db.

SELECT p.actor_id, cf.published 
FROM community_follower cf 
JOIN person p ON p.id = cf.person_id 
JOIN community c ON c.id = cf.community_id 
WHERE c.actor_id = 'https://lemm.ee/c/lemmydev';

A lemm.ee admin would get all users since the community is on their instance.
A sh.itjust.works admin would get sh.itjust.works users, etc.

Obviously, if your instance has neither the community nor the users, that's all moot.

[โ€“] [email protected] 2 points 1 month ago

Yeah ok. My server only has me as a user (minus a few test users). And all local communities are fairly small, so doesn't really help me.

So last paragraph really applies.

Might make a feature suggestion on the Lemmy repo for this. Would be super interesting data to analyze.

Thanks for your reply tho! Really appreciate it.