This commit is contained in:
ashley 2024-07-03 10:30:11 +00:00
parent 41486bf8a3
commit 61db054304

View file

@ -243,32 +243,29 @@ module.exports = function (app, config, renderTemplate) {
const videoObject = inv_vid?.adaptiveFormats; const videoObject = inv_vid?.adaptiveFormats;
function findItag(adaptiveFormats) { function findItag(adaptiveFormats) {
let has298 = false; let itag298 = null;
let has136 = false; let itag136 = null;
let itag298, itag136;
adaptiveFormats.forEach((format) => { adaptiveFormats.forEach((format) => {
if (format.itag == 298) { if (format.itag == 298) {
has298 = true;
itag298 = format; itag298 = format;
} }
if (format.itag == 136) { if (format.itag == 136) {
has136 = true;
itag136 = format; itag136 = format;
} }
}); });
if (has298 && has136) { if (itag298 && itag136) {
return { itag298, itag136 }; return { itag298, itag136 };
} else if (has298) { } else if (itag298) {
return itag298; return itag298;
} else if (has136) { } else if (itag136) {
return itag136; return itag136;
} else { } else {
return null; return null;
} }
} }
const itag_hd = findItag(videoObject); const itag_hd = await findItag(videoObject);
var proxyurl = config.p_url; var proxyurl = config.p_url;
var vidurl = u.url; var vidurl = u.url;
var isvidious = u.isInvidiousURL; var isvidious = u.isInvidiousURL;
@ -391,7 +388,6 @@ module.exports = function (app, config, renderTemplate) {
app.get("/lite", async (req, res) => { app.get("/lite", async (req, res) => {
const { dm, region, hl, v, e, r, f, m, quality: q, a, universe, } = req.query; const { dm, region, hl, v, e, r, f, m, quality: q, a, universe, } = req.query;
if (!v) { if (!v) {
return res.redirect("/"); return res.redirect("/");
} }