2020-02-09 01:46:32 +00:00
|
|
|
#!/bin/python3
|
|
|
|
|
|
|
|
import json
|
|
|
|
import requests
|
|
|
|
|
2020-02-09 02:47:11 +00:00
|
|
|
instance_list = ['peertube.social', 'tube.tchncs.de', 'vidcommons.org', 'video.deadsuperhero.com', 'diode.zone', 'share.tube']
|
2020-02-09 01:46:32 +00:00
|
|
|
|
|
|
|
json_list = []
|
2020-02-09 02:47:11 +00:00
|
|
|
id = 0
|
2020-02-09 01:46:32 +00:00
|
|
|
for i in instance_list:
|
|
|
|
r = requests.get('https://' + i + '/api/v1/config')
|
|
|
|
jsonres = r.json()
|
|
|
|
|
2020-02-09 02:47:11 +00:00
|
|
|
data = {
|
|
|
|
"id": id,
|
2020-02-09 01:46:32 +00:00
|
|
|
"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
|
2020-02-09 02:47:11 +00:00
|
|
|
}
|
2020-02-09 01:46:32 +00:00
|
|
|
json_list.append(data)
|
2020-02-09 02:47:11 +00:00
|
|
|
id += 1
|
2020-02-09 01:46:32 +00:00
|
|
|
|
2020-02-09 02:47:11 +00:00
|
|
|
json = json.dumps({"total": len(json_list), "data": json_list}, indent=4)
|
|
|
|
print(json, file=open('public/instances.json', 'w'))
|