forked from nutomic/joinpeertube
42 lines
1.7 KiB
Python
42 lines
1.7 KiB
Python
#!/bin/python3
|
|
|
|
import json
|
|
import requests
|
|
|
|
instance_list = ['peertube.social', 'tube.tchncs.de', 'vidcommons.org', 'video.deadsuperhero.com', 'diode.zone', 'share.tube']
|
|
|
|
json_list = []
|
|
id = 0
|
|
for i in instance_list:
|
|
config_json = requests.get('https://' + i + '/api/v1/config').json()
|
|
about = requests.get('https://' + i + '/api/v1/config/about')
|
|
stats = requests.get('https://' + i + '/api/v1/server/stats')
|
|
about_json = about.json()
|
|
stats_json = stats.json()
|
|
|
|
data = {
|
|
"id": id,
|
|
"host": i,
|
|
"name": config_json['instance']['name'],
|
|
"shortDescription": config_json['instance']['shortDescription'],
|
|
"version": config_json['serverVersion'],
|
|
"signupAllowed": config_json['signup']['allowed'],
|
|
"userVideoQuota": config_json['user']['videoQuota'],
|
|
"categories": about_json['instance']['categories'],
|
|
"languages": about_json['instance']['languages'],
|
|
"autoBlacklistUserVideosEnabled": config_json['autoBlacklist']['videos']['ofUsers']['enabled'],
|
|
"defaultNSFWPolicy": config_json['instance']['defaultNSFWPolicy'],
|
|
"isNSFW": config_json['instance']['isNSFW'],
|
|
"totalUsers": stats_json['totalUsers'],
|
|
"totalVideos": stats_json['totalVideos'],
|
|
"totalLocalVideos": stats_json['totalLocalVideos'],
|
|
"totalInstanceFollowers": stats_json['totalInstanceFollowers'],
|
|
"totalInstanceFollowing": stats_json['totalInstanceFollowing'],
|
|
"health": None,
|
|
"createdAt": None
|
|
}
|
|
json_list.append(data)
|
|
id += 1
|
|
|
|
json = json.dumps({"total": len(json_list), "data": json_list}, indent=4)
|
|
print(json, file=open('public/instances.json', 'w'))
|