mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-10 11:18:29 +01:00
Update 'src/libpoketube/libpoketube-core.js'
This commit is contained in:
parent
557950ffe3
commit
d93d23c5a6
1 changed files with 20 additions and 18 deletions
|
@ -86,33 +86,35 @@ async function video(v) {
|
||||||
const urls = [
|
const urls = [
|
||||||
"invidious.sethforprivacy.com",
|
"invidious.sethforprivacy.com",
|
||||||
"invidious.weblibre.org",
|
"invidious.weblibre.org",
|
||||||
"inv.vern.cc",
|
|
||||||
"invidious.privacydev.net",
|
|
||||||
"inv.zzls.xyz",
|
"inv.zzls.xyz",
|
||||||
"vid.puffyan.us"
|
"invidious.privacydev.net"
|
||||||
];
|
];
|
||||||
|
|
||||||
let vid;
|
let vid;
|
||||||
|
|
||||||
try {
|
|
||||||
for (const url of urls) {
|
for (const url of urls) {
|
||||||
|
try {
|
||||||
const videoInfo = await fetch(`https://${url}/api/v1/videos/${v}`).then(res => res.text());
|
const videoInfo = await fetch(`https://${url}/api/v1/videos/${v}`).then(res => res.text());
|
||||||
vid = await getJson(videoInfo);
|
vid = await getJson(videoInfo);
|
||||||
|
|
||||||
if (vid?.descriptionHtml !== "<p></p>") {
|
switch (true) {
|
||||||
|
case vid?.descriptionHtml !== "<p></p>":
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
} catch (error) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!vid) {
|
|
||||||
// Handle error case
|
|
||||||
throw new Error('Unable to fetch video information.');
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
// Handle error case
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!vid) {
|
||||||
|
console.log(`Sorry nya, we couldn't find any information about that video qwq`);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (checkUnexistingObject(vid)) {
|
if (checkUnexistingObject(vid)) {
|
||||||
var a;
|
var a;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue