-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhyperpipe.ts
45 lines (39 loc) Β· 1.24 KB
/
hyperpipe.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
const instances = [
"https://hpapi.ngn.tf",
"https://hpapi.ggtyler.dev",
"https://hyperpipeapi.pfcd.me",
"https://musicapi.adminforge.de",
"https://musicapi.reallyaweso.me",
"https://hyperpipe-api.lunar.icu",
"https://hyperpipeapi.drgns.space",
"https://hyperpipeapi.ducks.party",
"https://hyperpipeapi.onrender.com",
"https://hp-proxy.iqbalrifai.eu.org",
"https://hyperpipeapi.darkness.services",
"https://hyperpipeapi.frontendfriendly.xyz",
"https://hyperpipebackend.eu.projectsegfau.lt",
"https://hyperpipebackend.us.projectsegfau.lt",
"https://hyperpipebackend.in.projectsegfau.lt"
];
export async function gethp() {
const hp = async (i: string) => {
const t = performance.now();
return fetch(`${i}/channel/UCERrDZ8oN0U_n9MphMKERcg`)
.then(_ => _.json())
.then(data => {
const score = Math.floor(1e5 / (performance.now() - t));
console.log(`${i} - ${score}`);
if (data.playlistId?.length)
return [score, i];
else throw new Error();
})
.catch(() => [0, i]);
}
const data = await Promise
.all(instances.map(hp))
.then(array => array
.sort((a, b) => <number>b[0] - <number>a[0])
.filter((i) => i[0])
);
return data[0][1];
}