mirror of
https://git.sr.ht/~cadence/cloudtube
synced 2024-11-10 02:27:29 +00:00
24 lines
493 B
JavaScript
24 lines
493 B
JavaScript
const {request} = require("../utils/request")
|
|
|
|
let globalList = []
|
|
|
|
function execute() {
|
|
return request("https://instances.invidio.us/instances.json?sort_by=health").then(res => res.json()).then(list => {
|
|
list = list.filter(i => i[1].type === "https").map(i => i[1].uri)
|
|
globalList = list
|
|
}).catch(error => {
|
|
console.error(error)
|
|
})
|
|
}
|
|
|
|
function getInstances() {
|
|
return globalList
|
|
}
|
|
|
|
execute()
|
|
setInterval(() => {
|
|
execute()
|
|
}, 60*60*1000)
|
|
|
|
module.exports.getInstances = getInstances
|