Update src/libpoketube/init/pages-channel-and-download.js

This commit is contained in:
ashley 2025-04-06 19:33:16 +00:00
parent 4acf840d80
commit 4bf687b4a3

View File

@ -94,15 +94,15 @@ module.exports = function (app, config, renderTemplate) {
var media_proxy = config.media_proxy; var media_proxy = config.media_proxy;
if (req.useragent.source.includes("Pardus")) { if (config.useragent.source.includes("Pardus")) {
var media_proxy = "https://media-proxy.ashley0143.xyz"; var media_proxy = "https://media-proxy.ashley0143.xyz";
} }
var uaos = req.useragent.os; var uaos = config.useragent.os;
var IsOldWindows; let IsOldWindows;
if (uaos == "Windows 7" && req.useragent.browser == "Firefox") { if (uaos == "Windows 7" && config.useragent.browser == "Firefox") {
IsOldWindows = true; IsOldWindows = true;
} else if (uaos == "Windows 8" && req.useragent.browser == "Firefox") { } else if (uaos == "Windows 8" && config.useragent.browser == "Firefox") {
IsOldWindows = true; IsOldWindows = true;
} else { } else {
IsOldWindows = false; IsOldWindows = false;
@ -135,7 +135,6 @@ module.exports = function (app, config, renderTemplate) {
res.redirect("https://lite.duckduckgo.com/lite/?q=" + query); res.redirect("https://lite.duckduckgo.com/lite/?q=" + query);
} }
if (query && query.startsWith("Hey ChatGPT,") && query.length > 2) { if (query && query.startsWith("Hey ChatGPT,") && query.length > 2) {
res.redirect("https://chatgpt.com/?q=" + query + "- sent using pokeAI features"); res.redirect("https://chatgpt.com/?q=" + query + "- sent using pokeAI features");
} }
@ -164,7 +163,6 @@ const xmlData = await fetch(searchUrl)
.then((res) => res.text()) .then((res) => res.text())
.then((txt) => getJson(txt)); .then((txt) => getJson(txt));
renderTemplate(res, req, "search.ejs", { renderTemplate(res, req, "search.ejs", {
invresults: xmlData, invresults: xmlData,
turntomins, turntomins,
@ -199,7 +197,7 @@ const xmlData = await fetch(searchUrl)
try { try {
var media_proxy = config.media_proxy; var media_proxy = config.media_proxy;
if (req.useragent.source.includes("Pardus")) { if (config.useragent.source.includes("Pardus")) {
var media_proxy = "https://media-proxy.ashley0143.xyz"; var media_proxy = "https://media-proxy.ashley0143.xyz";
} }
@ -280,7 +278,6 @@ const PlaylistUrl = `${apiUrl}${ID}/${atob(
getChannelData(channelINVUrl), getChannelData(channelINVUrl),
]); ]);
var bannedchannels = ["UC1okSIA8UEY8OqvtjGHFvzA", "UClsVg5LkK2COQRo1mVS4taA", "UCIr4vkCsn0tdTW2xZ1jRG1g"]; var bannedchannels = ["UC1okSIA8UEY8OqvtjGHFvzA", "UClsVg5LkK2COQRo1mVS4taA", "UCIr4vkCsn0tdTW2xZ1jRG1g"];
var bypassQuery = "cG9rZXR1YmVjaGFubmVsYnlwYXNzbG9scGVvcGxldGhpbmt0aGlzaXNjZW5zb3JzaGlwLTQ1OTBh"; var bypassQuery = "cG9rZXR1YmVjaGFubmVsYnlwYXNzbG9scGVvcGxldGhpbmt0aGlzaXNjZW5zb3JzaGlwLTQ1OTBh";
@ -288,14 +285,11 @@ var bypassExists = req.query.bypass === bypassQuery;
var tabExists = 'tab' in req.query; var tabExists = 'tab' in req.query;
var continuationExists = 'continuation' in req.query; var continuationExists = 'continuation' in req.query;
if (bannedchannels.some(channel => channel === ID) && !bypassExists && !tabExists && !continuationExists) { if (bannedchannels.some(channel => channel === ID) && !bypassExists && !tabExists && !continuationExists) {
var cinv = { var cinv = {
error:`this channel may include disinformation. If you still wanna view content <a href="/channel?id=${ID}&bypass=${bypassQuery}">click here</a> to bypass this restriction.` error: `this channel may include disinformation. If you still wanna view content <a href="/channel?id=${ID}&bypass=${bypassQuery}">click here</a> to bypass this restriction.`,
};
} }
}
function getThumbnailUrl(video) { function getThumbnailUrl(video) {
const maxresDefaultThumbnail = video.videoThumbnails.find( const maxresDefaultThumbnail = video.videoThumbnails.find(
@ -333,8 +327,6 @@ if (bannedchannels.some(channel => channel === ID) && !bypassExists && !tabExist
); );
const dnoreplace = about?.Description.toString(); const dnoreplace = about?.Description.toString();
let ChannelFirstVideoObject = { let ChannelFirstVideoObject = {
subCountText: "0", subCountText: "0",
authorVerified: false, authorVerified: false,
@ -348,29 +340,17 @@ if (bannedchannels.some(channel => channel === ID) && !bypassExists && !tabExist
j: boutJson, j: boutJson,
sort: sort_by, sort: sort_by,
stream, stream,
tj, description,
c, subscribers,
banner: c.banner,
logo: c.logo,
ctv: c.ctv,
cinv, cinv,
convert,
turntomins,
pronoun,
media_proxy_url: media_proxy,
dnoreplace, dnoreplace,
getThumbnailUrl, media_proxy_url: media_proxy,
continuation,
wiki: "",
getFirstLine,
isMobile: req.useragent.isMobile,
about,
playlist,
subs:
typeof subscribers === "string"
? subscribers.replace("subscribers", "")
: "None",
desc: dnoreplace === "[object Object]" ? "" : description,
}); });
} catch (error) { } catch (error) {
console.error("Failed to render channel page:", error); console.log(error);
res.redirect("/"); res.redirect("/");
} }
}); });