@pee_zombie Gee, numerous instances:
#!/usr/bin/env python3
import ast
import requests
from sortedcontainers import SortedSet
def getPeerSet(url:str) -> SortedSet:
r = requests.get(url)
return SortedSet( ast.literal_eval( r.text ) )
instance = ['mastodon.radio', 'schelling.pt', 'mathstodon.xyz', 'mastodon.social']
peers = SortedSet()
for inst in instance:
url = 'https://' + inst + '/api/v1/instance/peers'
peers = peers.union( getPeerSet( url ) )
for elt in peers:
print(elt)
@pee_zombie $ wc -l mastolist.log
53992 mastolist.log
@flengyel it's JSON, basically a de facto standard for RESTful APIs
@pee_zombie Thanks. Well I cheated then with the python code I posted, since I used the python ast module to parse the output as if it was python. I could be pedantic and parse as JSON...
@flengyel if it works it works! no cheating here
@pee_zombie I suppose so, though I "should" use a JSON library instead of the python abstract syntax tree. Just in case someone exposes their block list.
(mastodon.radio blocks instances--I wanted the whole picture.) I took the union of this and two other instances (mastodon.radio and mathstodon.xyz) and one where I don't have a login (mastodon.social). 55K instances is impressive. Mastodon is superior to the site that cannot be named--you can take your marbles elsewhere, and it's resilient.
@pee_zombie A RESTful API with python list syntax (unless it's JSON--looks like python). Many thanks!