Skip Navigation

How to programmatically get a list of all Lemmy instances?

I'm working on a Python script to find a snappy Lemmy instance, as the one I was using (not dbzer0) has recently slowed down to about 5 seconds per page load. I have a rough version of the script, but I need to fetch a list of available Lemmy instances through their API.

Could anyone guide me on how to access the Lemmy API to retrieve a list of instances?

4 comments
  • Not what you're asking, but I can probably do better.

    I'd give decent odds that the issue you're hitting is the thing that many Fediverse instances are hitting. There have been a lot of badly-written and very aggressive scraper-bots hammering servers all over (the Web, not just the Threadiverse) to try to find text to train AI models. If you've seen discussion on Anubis recently, that was aimed at trying to mitigate the load from that.

    Many instances dealt with this by disallowing anonymous access. This sucks, because it'd be nice to let people use an instance without logging in, but it did apparently drastically reduce the bot load.

    You can probably just pick an instance that doesn't provide for anonymous access.