40 lines
1.2 KiB
Python
40 lines
1.2 KiB
Python
#!/bin/python3
|
|
|
|
import json
|
|
import requests
|
|
|
|
instance_list = ['peertube.social', 'tube.tchncs.de', 'vidcommons.org']
|
|
|
|
json_list = []
|
|
for i in instance_list:
|
|
r = requests.get('https://' + i + '/api/v1/config')
|
|
jsonres = r.json()
|
|
|
|
data = json.dumps({
|
|
"id": -1,
|
|
"host": i,
|
|
"name": jsonres['instance']['name'],
|
|
"shortDescription": r.json()['instance']['shortDescription'],
|
|
"version": jsonres['serverVersion'],
|
|
"signupAllowed": jsonres['signup']['allowed'],
|
|
"userVideoQuota": jsonres['user']['videoQuota'],
|
|
"categories": [],
|
|
"languages": [],
|
|
"autoBlacklistUserVideosEnabled": False,
|
|
"defaultNSFWPolicy": jsonres['instance']['defaultNSFWPolicy'],
|
|
"isNSFW": jsonres['instance']['isNSFW'],
|
|
"totalUsers": None,
|
|
"totalVideos": None,
|
|
"totalLocalVideos": None,
|
|
"totalInstanceFollowers": None,
|
|
"totalInstanceFollowing": None,
|
|
"health": None,
|
|
"createdAt": None
|
|
})
|
|
json_list.append(data)
|
|
print(data)
|
|
|
|
print("\n\n\n")
|
|
|
|
# TODO: need to dump it all as a single list, no idea why this is not working
|
|
json.dumps(json_list)
|