forked from nutomic/joinpeertube
finish json generator
This commit is contained in:
parent
524674f9cc
commit
b750cf3cd1
1 changed files with 8 additions and 9 deletions
|
@ -3,15 +3,16 @@
|
||||||
import json
|
import json
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
instance_list = ['peertube.social', 'tube.tchncs.de', 'vidcommons.org']
|
instance_list = ['peertube.social', 'tube.tchncs.de', 'vidcommons.org', 'video.deadsuperhero.com', 'diode.zone', 'share.tube']
|
||||||
|
|
||||||
json_list = []
|
json_list = []
|
||||||
|
id = 0
|
||||||
for i in instance_list:
|
for i in instance_list:
|
||||||
r = requests.get('https://' + i + '/api/v1/config')
|
r = requests.get('https://' + i + '/api/v1/config')
|
||||||
jsonres = r.json()
|
jsonres = r.json()
|
||||||
|
|
||||||
data = json.dumps({
|
data = {
|
||||||
"id": -1,
|
"id": id,
|
||||||
"host": i,
|
"host": i,
|
||||||
"name": jsonres['instance']['name'],
|
"name": jsonres['instance']['name'],
|
||||||
"shortDescription": r.json()['instance']['shortDescription'],
|
"shortDescription": r.json()['instance']['shortDescription'],
|
||||||
|
@ -30,11 +31,9 @@ for i in instance_list:
|
||||||
"totalInstanceFollowing": None,
|
"totalInstanceFollowing": None,
|
||||||
"health": None,
|
"health": None,
|
||||||
"createdAt": None
|
"createdAt": None
|
||||||
})
|
}
|
||||||
json_list.append(data)
|
json_list.append(data)
|
||||||
print(data)
|
id += 1
|
||||||
|
|
||||||
print("\n\n\n")
|
json = json.dumps({"total": len(json_list), "data": json_list}, indent=4)
|
||||||
|
print(json, file=open('public/instances.json', 'w'))
|
||||||
# TODO: need to dump it all as a single list, no idea why this is not working
|
|
||||||
json.dumps(json_list)
|
|
||||||
|
|
Loading…
Reference in a new issue