Update src/libpoketube/init/pages-video.js
This commit is contained in:
parent
0dd11da061
commit
c15070bb19
@ -393,101 +393,7 @@ module.exports = function (app, config, renderTemplate) {
|
||||
});
|
||||
|
||||
app.get("/lite", async (req, res) => {
|
||||
const { dm, region, hl, v, e, r, f, m, quality: q, a, universe, } = req.query;
|
||||
|
||||
if (!v) {
|
||||
return res.redirect("/");
|
||||
}
|
||||
|
||||
var contentlang = hl || "en-US";
|
||||
var contentregion = region || "US";
|
||||
|
||||
const isVideoValid = await INNERTUBE.isvalidvideo(v);
|
||||
if (!isVideoValid) {
|
||||
return res.redirect("/?fromerror=21_video_not_valid");
|
||||
}
|
||||
|
||||
const u = await media_proxy(v);
|
||||
|
||||
const secure = ["poketube.fun"].includes(req.hostname);
|
||||
const verify = req.hostname === "poketube.sudovanilla.com";
|
||||
|
||||
INNERTUBE.getYouTubeApiVideo(f, v, contentlang, contentregion).then(
|
||||
(data) => {
|
||||
try {
|
||||
const k = data?.video;
|
||||
const channel_uploads = data?.channel_uploads;
|
||||
const json = data?.json;
|
||||
const engagement = data?.engagement;
|
||||
const inv_comments = data?.comments || "Disabled";
|
||||
const inv_vid = data?.vid;
|
||||
const desc = data?.desc || "";
|
||||
|
||||
let d = false;
|
||||
if (desc !== "[object Object]") {
|
||||
d = desc.toString().replace(/\n/g, " <br> ");
|
||||
}
|
||||
|
||||
const descriptionString = String(inv_vid?.description);
|
||||
|
||||
function extractInfo(regex) {
|
||||
return descriptionString !== "[object Object]"
|
||||
? (regex.exec(descriptionString) ?? {}).groups
|
||||
: undefined;
|
||||
}
|
||||
|
||||
const support = extractInfo(PATREON_REGEX);
|
||||
const twitter = extractInfo(TWITTER_REGEX);
|
||||
const discord = extractInfo(CORD_REGEX);
|
||||
const twitch = extractInfo(TWITCH_REGEX);
|
||||
const reddit = extractInfo(REDDIT_REGEX);
|
||||
const instagram = extractInfo(INSTAGRAM_REGEX);
|
||||
|
||||
var proxyurl = config.p_url;
|
||||
var vidurl = u.url;
|
||||
var isvidious = u.isInvidiousURL;
|
||||
var mediaproxy = config.media_proxy;
|
||||
|
||||
if (inv_vid?.genre === "Music") {
|
||||
var vidurl = u.losslessurl;
|
||||
}
|
||||
|
||||
var vidurl = config.videourl;
|
||||
var isvidious = true;
|
||||
|
||||
if (req.useragent.source.includes("Pardus")) {
|
||||
var vidurl = "https://iv.ggtyler.dev";
|
||||
var mediaproxy = "https://media-proxy.ashley0143.xyz";
|
||||
var isvidious = true;
|
||||
var isSchoolProxy = "";
|
||||
}
|
||||
|
||||
// unused
|
||||
let badges = "";
|
||||
let comments = "";
|
||||
let nnn = "";
|
||||
|
||||
const dnt_val = isDntEnabled(req);
|
||||
|
||||
if (
|
||||
inv_vid?.error ===
|
||||
"The uploader has not made this video available in your country" ||
|
||||
inv_vid?.error === "This video is not available"
|
||||
) {
|
||||
res.send(
|
||||
"error: " + inv_vid.error + " please refresh the page please qt"
|
||||
);
|
||||
}
|
||||
|
||||
var uaos = req.useragent.os;
|
||||
const browser = req.useragent.browser;
|
||||
const IsOldWindows =
|
||||
(uaos === "Windows 7" || uaos === "Windows 8") &&
|
||||
browser === "Firefox";
|
||||
|
||||
if (req.query.from === "short") var shortsui = true;
|
||||
|
||||
try {
|
||||
|
||||
renderTemplate(res, req, "lite.ejs", {
|
||||
color: data.color,
|
||||
color2: data.color2,
|
||||
@ -540,15 +446,7 @@ module.exports = function (app, config, renderTemplate) {
|
||||
inv_vid,
|
||||
lyrics: "",
|
||||
});
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return res.redirect(`/watch?v=${req.query.v}&fx=1&err=${error}`);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
app.get("/music", async function (req, res) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user