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:
|
2020-02-09 13:31:09 +00:00
|
|
|
config_json = requests.get('https://' + i + '/api/v1/config').json()
|
2020-02-09 13:35:18 +00:00
|
|
|
about_json = requests.get('https://' + i + '/api/v1/config/about').json()
|
|
|
|
stats_json = requests.get('https://' + i + '/api/v1/server/stats').json()
|
2020-02-09 01:46:32 +00:00
|
|
|
|
2020-02-09 02:47:11 +00:00
|
|
|
data = {
|
|
|
|
"id": id,
|
2020-02-09 01:46:32 +00:00
|
|
|
"host": i,
|
2020-02-09 13:31:09 +00:00
|
|
|
"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'],
|
2020-02-09 01:46:32 +00:00
|
|
|
"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'))
|