faster fetching :3

This commit is contained in:
Ashley 2022-11-16 17:42:06 +01:00
parent 44a938852d
commit 4d87c3621d

View file

@ -81,8 +81,7 @@ module.exports = function (app, config, renderTemplate) {
const isvld = await core.isvalidvideo(v);
if (isvld) {
for (let i = 0; i < 3; i++) {
try {
core.video(v).then((data) => {
const k = data.video;
const json = data.json;
@ -141,16 +140,7 @@ module.exports = function (app, config, renderTemplate) {
lyrics: "",
});
});
break;
} catch (err) {
if (err.status === 503) {
// retry after a bit
await new Promise((resolve) => setTimeout(resolve, 1000));
} else {
return "";
}
}
}
} else {
res.redirect("/");
}