mirror of
https://codeberg.org/ashley/poke.git
synced 2025-01-08 19:59:27 +01:00
use local json instead because api.inv.io slooooooooooooooow
This commit is contained in:
parent
6cb3ad5fb1
commit
bfafd7a01e
1 changed files with 18 additions and 25 deletions
|
@ -44,32 +44,25 @@ module.exports = async function (video_id) {
|
||||||
}, {});
|
}, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
// gets invidious instances
|
||||||
// gets invidious instances
|
const invInstanceList = require("./invapi.json");
|
||||||
const invUrl = "https://api.invidious.io/instances.json?sort_by=type,health";
|
|
||||||
const invInstanceList = await modules
|
|
||||||
.fetch(invUrl)
|
|
||||||
.then((res) => res.text())
|
|
||||||
.then((json) => JSON.parse(json));
|
|
||||||
|
|
||||||
// gets random instances from the list
|
// gets random instances from the list
|
||||||
const instance = invInstanceList[Math.floor(Math.random() * invInstanceList.length)];
|
const instance =
|
||||||
|
invInstanceList[Math.floor(Math.random() * invInstanceList.length)];
|
||||||
|
|
||||||
let url;
|
let url;
|
||||||
if (instance[1].type != "https") {
|
if (instance[1].type != "https") {
|
||||||
url = "https://invidious.weblibre.org";
|
url = "https://invidious.sethforprivacy.com";
|
||||||
} else {
|
} else {
|
||||||
url = instance[1].uri
|
url = instance[1].uri
|
||||||
.replace("invidious.tiekoetter.com", "invidious.weblibre.org")
|
.replace("invidious.tiekoetter.com", "invidious.sethforprivacy.com")
|
||||||
.replace("yewtu.be", "invidious.sethforprivacy.com")
|
.replace("yewtu.be", "invidious.sethforprivacy.com")
|
||||||
.replace("invidious.slipfox.xyz", "invidious.weblibre.org")
|
.replace("invidious.slipfox.xyz", "invidious.sethforprivacy.com")
|
||||||
.replace("vid.priv.au", "inv.vern.cc")
|
.replace("vid.priv.au", "inv.vern.cc")
|
||||||
.replace("invidious.snopyta.org", "invidious.sethforprivacy.com");
|
.replace("invidious.snopyta.org", "invidious.sethforprivacy.com")
|
||||||
}
|
.replace("invidious.weblibre.org", "invidious.sethforprivacy.com");
|
||||||
|
|
||||||
return url;
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Failed to get Invidious instance:", error);
|
|
||||||
return " ";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return url;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue