-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_piped.js
More file actions
34 lines (32 loc) · 1.18 KB
/
test_piped.js
File metadata and controls
34 lines (32 loc) · 1.18 KB
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
async function testPiped() {
const instances = [
'https://pipedapi.kavin.rocks',
'https://pipedapi.tokhmi.xyz',
'https://piped-api.garudalinux.org',
'https://pipedapi.smnz.de'
];
for (const inst of instances) {
try {
console.log("Testing", inst);
const res = await fetch(`${inst}/streams/fJ9rUzIMcZQ`);
if (res.ok) {
const data = await res.json();
console.log(`Success with ${inst}`);
console.log("Title:", data.title);
console.log("Audio formats:", data.audioStreams?.length);
console.log("Video formats:", data.videoStreams?.length);
// test if the url works
if (data.audioStreams?.[0]?.url) {
const audioRes = await fetch(data.audioStreams[0].url, { method: 'HEAD' });
console.log("Audio URL Status:", audioRes.status);
}
return;
} else {
console.log("Failed:", res.status);
}
} catch (e) {
console.log("Error:", e.message);
}
}
}
testPiped();