add wip instance data generator, plus updated instance data

This commit is contained in:
Felix 2020-02-09 02:46:32 +01:00
parent 911a6ea03b
commit 524674f9cc
2 changed files with 82 additions and 26 deletions

View file

@ -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)

View file

@ -1,11 +1,31 @@
{ {
"total": 1, "total": 3,
"data": [ "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, "id": -1,
"host": "peertube.social", "host": "tube.tchncs.de",
"name": "Peertube.social", "name": "tchncs",
"shortDescription": "Peertube instance for leftist and non-commercial content. Unlimited uploads (up to 500 MB per day)", "shortDescription": "PeerTube instance for your unique Vlogs and what not. 😉",
"version": "2.0.0", "version": "2.0.0",
"signupAllowed": false, "signupAllowed": false,
"userVideoQuota": -1, "userVideoQuota": -1,
@ -14,18 +34,16 @@
"autoBlacklistUserVideosEnabled": false, "autoBlacklistUserVideosEnabled": false,
"defaultNSFWPolicy": "do_not_list", "defaultNSFWPolicy": "do_not_list",
"isNSFW": false, "isNSFW": false,
"totalUsers": 4, "totalUsers": null,
"totalVideos": 10282, "totalVideos": null,
"totalLocalVideos": 8, "totalLocalVideos": null,
"totalInstanceFollowers": 10, "totalInstanceFollowers": null,
"totalInstanceFollowing": 64, "totalInstanceFollowing": null,
"supportsIPv6": true, "health": null,
"country": "US", "createdAt": null
"health": 100,
"createdAt": "2020-02-08T17:52:18.386Z"
}, },
{ {
"id": 1, "id": -1,
"host": "vidcommons.org", "host": "vidcommons.org",
"name": "The VidCommons Project", "name": "The VidCommons Project",
"shortDescription": "A PeerTube instance dedicated to media licensed under the Creative Commons and Public Domain.", "shortDescription": "A PeerTube instance dedicated to media licensed under the Creative Commons and Public Domain.",
@ -37,15 +55,13 @@
"autoBlacklistUserVideosEnabled": false, "autoBlacklistUserVideosEnabled": false,
"defaultNSFWPolicy": "do_not_list", "defaultNSFWPolicy": "do_not_list",
"isNSFW": false, "isNSFW": false,
"totalUsers": 4, "totalUsers": null,
"totalVideos": 10282, "totalVideos": null,
"totalLocalVideos": 8, "totalLocalVideos": null,
"totalInstanceFollowers": 10, "totalInstanceFollowers": null,
"totalInstanceFollowing": 64, "totalInstanceFollowing": null,
"supportsIPv6": true, "health": null,
"country": "US", "createdAt": null
"health": 100,
"createdAt": "2020-02-08T17:52:18.386Z"
} }
] ]
} }