diff --git a/generate-instances-json.py b/generate-instances-json.py new file mode 100644 index 0000000..ac792e3 --- /dev/null +++ b/generate-instances-json.py @@ -0,0 +1,40 @@ +#!/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) diff --git a/public/instances.json b/public/instances.json index d8802df..6bf4938 100644 --- a/public/instances.json +++ b/public/instances.json @@ -1,11 +1,31 @@ { - "total": 1, - "data": [ + "total": 3, + "data": [{ + "id": -1, + "host": "peertube.social", + "name": "Peertube.social", + "shortDescription": "Peertube instance for leftist and non-commercial content. Unlimited uploads (up to 500 MB per day)", + "version": "2.0.0", + "signupAllowed": false, + "userVideoQuota": -1, + "categories": [], + "languages": [], + "autoBlacklistUserVideosEnabled": false, + "defaultNSFWPolicy": "do_not_list", + "isNSFW": false, + "totalUsers": null, + "totalVideos": null, + "totalLocalVideos": null, + "totalInstanceFollowers": null, + "totalInstanceFollowing": null, + "health": null, + "createdAt": null + }, { - "id": 1, - "host": "peertube.social", - "name": "Peertube.social", - "shortDescription": "Peertube instance for leftist and non-commercial content. Unlimited uploads (up to 500 MB per day)", + "id": -1, + "host": "tube.tchncs.de", + "name": "tchncs", + "shortDescription": "PeerTube instance for your unique Vlogs and what not. 😉", "version": "2.0.0", "signupAllowed": false, "userVideoQuota": -1, @@ -14,18 +34,16 @@ "autoBlacklistUserVideosEnabled": false, "defaultNSFWPolicy": "do_not_list", "isNSFW": false, - "totalUsers": 4, - "totalVideos": 10282, - "totalLocalVideos": 8, - "totalInstanceFollowers": 10, - "totalInstanceFollowing": 64, - "supportsIPv6": true, - "country": "US", - "health": 100, - "createdAt": "2020-02-08T17:52:18.386Z" + "totalUsers": null, + "totalVideos": null, + "totalLocalVideos": null, + "totalInstanceFollowers": null, + "totalInstanceFollowing": null, + "health": null, + "createdAt": null }, { - "id": 1, + "id": -1, "host": "vidcommons.org", "name": "The VidCommons Project", "shortDescription": "A PeerTube instance dedicated to media licensed under the Creative Commons and Public Domain.", @@ -37,15 +55,13 @@ "autoBlacklistUserVideosEnabled": false, "defaultNSFWPolicy": "do_not_list", "isNSFW": false, - "totalUsers": 4, - "totalVideos": 10282, - "totalLocalVideos": 8, - "totalInstanceFollowers": 10, - "totalInstanceFollowing": 64, - "supportsIPv6": true, - "country": "US", - "health": 100, - "createdAt": "2020-02-08T17:52:18.386Z" + "totalUsers": null, + "totalVideos": null, + "totalLocalVideos": null, + "totalInstanceFollowers": null, + "totalInstanceFollowing": null, + "health": null, + "createdAt": null } ] -} \ No newline at end of file +}