Merge pull request 'main' (#3) from ashley/poke:main into main

Reviewed-on: https://codeberg.org/Korbs/poke/pulls/3
This commit is contained in:
Korbs 2024-05-08 05:56:03 +00:00
commit 43cf7dc468
15 changed files with 442 additions and 369 deletions

25
ascii_txt.txt Normal file
View file

@ -0,0 +1,25 @@
_____ _______ _____ _____
/\ \ /::\ \ /\ \ /\ \
/::\ \ /::::\ \ /::\____\ /::\ \
/::::\ \ /::::::\ \ /:::/ / /::::\ \
/::::::\ \ /::::::::\ \ /:::/ / /::::::\ \
/:::/\:::\ \ /:::/~~\:::\ \ /:::/ / /:::/\:::\ \
/:::/__\:::\ \ /:::/ \:::\ \ /:::/____/ /:::/__\:::\ \
/::::\ \:::\ \ /:::/ / \:::\ \ /::::\ \ /::::\ \:::\ \
/::::::\ \:::\ \ /:::/____/ \:::\____\ /::::::\____\________ /::::::\ \:::\ \
/:::/\:::\ \:::\____\ |:::| | |:::| | /:::/\:::::::::::\ \ /:::/\:::\ \:::\ \
/:::/ \:::\ \:::| ||:::|____| |:::| |/:::/ |:::::::::::\____\/:::/__\:::\ \:::\____\
\::/ \:::\ /:::|____| \:::\ \ /:::/ / \::/ |::|~~~|~~~~~ \:::\ \:::\ \::/ /
\/_____/\:::\/:::/ / \:::\ \ /:::/ / \/____|::| | \:::\ \:::\ \/____/
\::::::/ / \:::\ /:::/ / |::| | \:::\ \:::\ \
\::::/ / \:::\__/:::/ / |::| | \:::\ \:::\____\
\::/____/ \::::::::/ / |::| | \:::\ \::/ /
~~ \::::::/ / |::| | \:::\ \/____/
\::::/ / |::| | \:::\ \
\::/____/ \::| | \:::\____\
~~ \:| | \::/ /
\|___| \/____/

View file

@ -5,7 +5,7 @@
"invchannel": "https://invid-api.poketube.fun/api/v1", "invchannel": "https://invid-api.poketube.fun/api/v1",
"p_url":"https://p.poketube.fun", "p_url":"https://p.poketube.fun",
"media_proxy": "https://image-proxy.poketube.fun", "media_proxy": "https://image-proxy.poketube.fun",
"videourl":"https://usa-proxy.poketube.fun", "videourl":"https://eu-proxy.poketube.fun",
"email_main_url":"https://email-server.poketube.fun", "email_main_url":"https://email-server.poketube.fun",
"mastodon_client_url":"https://fediverse.poketube.fun", "mastodon_client_url":"https://fediverse.poketube.fun",
"libreoffice_online_url":"https://office.poketube.fun", "libreoffice_online_url":"https://office.poketube.fun",

BIN
css/poke-screnshot-v2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,020 KiB

View file

@ -731,30 +731,30 @@ a.new-button:hover {
display: none; display: none;
} }
.v:checked ~ .div_box { .v:checked~.div_box {
display: flex; display:flex;
margin-top: -51em; margin-top:-51em;
text-align: left; text-align:left;
background: #0009; background:#0009;
border-radius: 10px; border-radius:10px;
height: fit-content; height:fit-content;
padding: 10px; padding:10px;
font-family: "ubuntu", sans-serif; font-family:ubuntu,sans-serif;
margin-left: -11em; width:43em;
width: 43em; position:absolute;
position: absolute; white-space:-moz-pre-wrap!important;
white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */ white-space:-pre-wrap;
white-space: -pre-wrap; /* Opera 4-6 */ white-space:-o-pre-wrap;
white-space: -o-pre-wrap; /* Opera 7 */ white-space:pre-wrap;
white-space: pre-wrap; /* css-3 */ word-wrap:break-word;
word-wrap: break-word; /* Internet Explorer 5.5+ */ white-space:-webkit-pre-wrap;
white-space: -webkit-pre-wrap; /* Newer versions of Chrome/Safari*/ word-break:break-all;
word-break: break-all; white-space:normal;
white-space: normal; height:-moz-fit-content;
height: -moz-fit-content; height:-webkit-fit-content;
height: -webkit-fit-content; max-width:708px;
max-width: 708px; max-height:185.6px;
max-height: 185.6px; margin-right: 13em;
} }
@media screen and (min-width: 1400px) { @media screen and (min-width: 1400px) {

View file

@ -1,4 +1,4 @@
<%- include('error.ejs', { <%- include('error.ejs', {
error: "404", error: "404 ER_ROR",
description: "Very 1984 Innit? I dont think this webpage exist :p" description: "you are in violation. thEy mustn't know you were here. no one should ever find out About this. you can never tell anyone about thiS -- for The sake of the others' survIval, you muSt keep this silent. we mUst keeP silent. no one can know. no one can know. no o ne c an kn ow_ (Violation Code. 15398642_14)"
}) %> }) %>

View file

@ -107,7 +107,7 @@
<img src="/static/poke-chan-outfit-a.png" title="Poke-chan sitting :3"> <img src="/static/poke-chan-outfit-a.png" title="Poke-chan sitting :3">
<div style="display: flex; gap: 12px;"> <div style="display: flex; gap: 12px;">
<img src="/static/poke-screnshot-a.png" /> <img src="/static/poke-screnshot-v2.png" />
<img src="/static/Poke-Mobile.jpg" /> <img src="/static/Poke-Mobile.jpg" />
</div> </div>

View file

@ -370,12 +370,12 @@ a[data-onclick="jump_to_time"] {
</style> </style>
<!-- css files --> <!-- css files -->
<link href="/css/app-cdn.min.css" rel=stylesheet> <link href="/css/app-cdn.min.css?v=9893448" rel=stylesheet>
<link href="/css/app.main.css?v=44600" rel=stylesheet> <link href="/css/app.main.css?v=446008" rel=stylesheet>
<link href="/css/watch.main.css" rel=stylesheet> <link href="/css/watch.main.css?v=9893448" rel=stylesheet>
<link href="/css/watch-util.css" rel=stylesheet> <link href="/css/watch-util.css?v=9893448" rel=stylesheet>
<link href="/css/watch-navbar.css" rel=stylesheet> <link href="/css/watch-navbar.css?v=9893448" rel=stylesheet>
<link href="/css/poketube.css?v=989344" rel=stylesheet> <link href="/css/poketube.css?v=98934844" rel=stylesheet>
<% if (k.Video.Channel.Name == "7clouds") { %> <% if (k.Video.Channel.Name == "7clouds") { %>
<style> <style>
@ -395,6 +395,11 @@ a[data-onclick="jump_to_time"] {
.auto-play{ .auto-play{
display:none !important; display:none !important;
} }
.theather {
display:none !important;
}
.progress-container { .progress-container {
display:none !important; display:none !important;
} }
@ -1061,11 +1066,16 @@ Privacy
<input type="checkbox" class="v" id="box" style="display:none"> <input type="checkbox" class="v" id="box" style="display:none">
<label class="h" for="box"> <label class="h" for="box">
<div class="fnt"> <div class="fnt">
<i title="Stats for nerdys" class="fa-light fa-bug"></i> Stats <% if (Math.floor(Math.random() * 50) === 0) { %>
<i title="Stats for nerdys" class="fa-light fa-bug"></i> Stats For Puppies
<% } else { %>
<i title="Stats for nerdys" class="fa-light fa-bug"></i> Stats For Nerds
<% } %>
</div> </div>
</label> </label>
<a onclick="if(document.querySelector('.watch-page').style.display === 'grid') {document.querySelector('.watch-page').style.display = 'flex'} else {document.querySelector('.watch-page').style.display = 'grid'}"><i class="fa-sharp fa-light fa-up-right-and-down-left-from-center"></i> Theater</a>
<a onclick="if(document.querySelector('.watch-page').style.display === 'grid') {document.querySelector('.watch-page').style.display = 'flex'} else {document.querySelector('.watch-page').style.display = 'grid'}" class="theather"><i class="fa-sharp fa-light fa-up-right-and-down-left-from-center"></i> Theater</a>
<% if (inv.comments) { %> <% if (inv.comments) { %>
<input type="checkbox" class="hj" id="j" style="display:none"> <input type="checkbox" class="hj" id="j" style="display:none">

View file

@ -24,7 +24,7 @@
<link href=/css/yt-ukraine.svg?v=6 rel=icon> <link href=/css/yt-ukraine.svg?v=6 rel=icon>
<link href=/css/app-cdn.min.css rel=stylesheet> <link href=/css/app-cdn.min.css rel=stylesheet>
<link href=/css/app.main.css?v=44600 rel=stylesheet> <link href=/css/app.main.css?v=44600 rel=stylesheet>
<link href=/css/search.main.css?v=57 rel=stylesheet> <link href=/css/search.main.css?v=547 rel=stylesheet>
<link href=/css/watch.main.css rel=stylesheet> <link href=/css/watch.main.css rel=stylesheet>
<meta name="darkreader-lock"> <!-- tells dark reader that the site has a dark theme and to turn itself off --> <meta name="darkreader-lock"> <!-- tells dark reader that the site has a dark theme and to turn itself off -->
<meta content="Searching <%=q%> - Poke" property=og:title> <meta content="Searching <%=q%> - Poke" property=og:title>

6
infocards.json Normal file
View file

@ -0,0 +1,6 @@
{
"Open Source":{
"infocard":"<i>Open Source</i> is a wrong terminology",
"more_info":"https://gnu.org/not-open-source"
}
}

View file

@ -32,9 +32,19 @@
const media_proxy = require("./src/libpoketube/libpoketube-video.js"); const media_proxy = require("./src/libpoketube/libpoketube-video.js");
const { sinit } = require("./src/libpoketube/init/superinit.js"); const { sinit } = require("./src/libpoketube/init/superinit.js");
const innertube = require("./src/libpoketube/libpoketube-youtubei-objects.json"); const innertube = require("./src/libpoketube/libpoketube-youtubei-objects.json");
const fs = require("fs");
const config = require("./config.json"); const config = require("./config.json");
const u = await media_proxy(); const u = await media_proxy();
fs.readFile("ascii_txt.txt", "utf8", (err, data) => {
if (err) {
console.error("Error reading the file:", err);
return;
}
// Log the ASCII art to the console
console.log(data);
});
initlog("Loading..."); initlog("Loading...");
initlog( initlog(
"[Welcome] Welcome To Poke - The ultimate privacy app - :3 " + "[Welcome] Welcome To Poke - The ultimate privacy app - :3 " +
@ -65,12 +75,11 @@
const sha384 = modules.hash; const sha384 = modules.hash;
const rateLimit = require("express-rate-limit"); const rateLimit = require("express-rate-limit");
const limiter = rateLimit({
windowMs: 45 * 1000, // 45 Seconds
max: 886, // limit each IP to 866 requests per windowMs
});
const limiter = rateLimit({
windowMs:45 * 1000, // 45 Seconds
max: 886, // limit each IP to 866 requests per windowMs
});
var app = modules.express(); var app = modules.express();
app.use(limiter); app.use(limiter);
initlog("Loaded express.js"); initlog("Loaded express.js");
@ -79,7 +88,7 @@
app.use(modules.useragent.express()); app.use(modules.useragent.express());
app.use(modules.express.json()); // for parsing application/json app.use(modules.express.json()); // for parsing application/json
app.enable("trust proxy"); app.enable("trust proxy");
var toobusy = require('toobusy-js') var toobusy = require("toobusy-js");
const renderTemplate = async (res, req, template, data = {}) => { const renderTemplate = async (res, req, template, data = {}) => {
res.render( res.render(
@ -87,26 +96,25 @@
Object.assign(data) Object.assign(data)
); );
}; };
// Set check interval to a faster value. This will catch more latency spikes
// but may cause the check to be too sensitive.
toobusy.interval(110);
toobusy.maxLag(3500); // Set check interval to a faster value. This will catch more latency spikes
// but may cause the check to be too sensitive.
app.use(function(req, res, next) { toobusy.interval(110);
if (toobusy()) {
res.send(503, "I'm busy right now, sorry."); toobusy.maxLag(3500);
} else {
next(); app.use(function (req, res, next) {
} if (toobusy()) {
}); res.send(503, "I'm busy right now, sorry.");
} else {
toobusy.onLag(function(currentLag) { next();
process.exit(1); }
console.log("Event loop lag detected! Latency: " + currentLag + "ms"); });
});
toobusy.onLag(function (currentLag) {
process.exit(1);
console.log("Event loop lag detected! Latency: " + currentLag + "ms");
});
const random_words = [ const random_words = [
"banana pie", "banana pie",
@ -140,8 +148,8 @@ toobusy.maxLag(3500);
res.header("secure-poketube-instance", "1"); res.header("secure-poketube-instance", "1");
// opt out of googles "FLOC" bullcrap :p See https://spreadprivacy.com/block-floc-with-duckduckgo/ // opt out of googles "FLOC" bullcrap :p See https://spreadprivacy.com/block-floc-with-duckduckgo/
res.header("Permissions-Policy", "interest-cohort=()") res.header("Permissions-Policy", "interest-cohort=()");
res.header("software-name", "poke") res.header("software-name", "poke");
next(); next();
}); });
@ -162,10 +170,22 @@ toobusy.maxLag(3500);
}); });
app.use(function (req, res, next) { app.use(function (req, res, next) {
res.header("X-PokeTube-Youtube-Client-Name", innertube.innertube.CONTEXT_CLIENT.INNERTUBE_CONTEXT_CLIENT_NAME); res.header(
res.header("Hey-there", "Do u wanna help poke? contributons are welcome :3 https://codeberg.org/Ashley/poke") "X-PokeTube-Youtube-Client-Name",
res.header("X-PokeTube-Youtube-Client-Version", innertube.innertube.CLIENT.clientVersion); innertube.innertube.CONTEXT_CLIENT.INNERTUBE_CONTEXT_CLIENT_NAME
res.header("X-PokeTube-Client-name", innertube.innertube.CLIENT.projectClientName); );
res.header(
"Hey-there",
"Do u wanna help poke? contributons are welcome :3 https://codeberg.org/Ashley/poke"
);
res.header(
"X-PokeTube-Youtube-Client-Version",
innertube.innertube.CLIENT.clientVersion
);
res.header(
"X-PokeTube-Client-name",
innertube.innertube.CLIENT.projectClientName
);
res.header("X-PokeTube-Speeder", "3 seconds no cache, 280ms w/cache"); res.header("X-PokeTube-Speeder", "3 seconds no cache, 280ms w/cache");
res.header("X-HOSTNAME", req.hostname); res.header("X-HOSTNAME", req.hostname);
if (req.url.match(/^\/(css|js|img|font)\/.+/)) { if (req.url.match(/^\/(css|js|img|font)\/.+/)) {
@ -177,7 +197,7 @@ toobusy.maxLag(3500);
} }
const a = 890; const a = 890;
if (!req.url.match(/^\/(css|js|img|font)\/.+/)) { if (!req.url.match(/^\/(css|js|img|font)\/.+/)) {
res.setHeader("Cache-Control", "public, max-age=" + a); // cache header res.setHeader("Cache-Control", "public, max-age=" + a); // cache header
res.setHeader("poketube-cacher", "PAGE"); res.setHeader("poketube-cacher", "PAGE");

View file

@ -58,6 +58,7 @@ const splash = [
"not done, josh dun!", "not done, josh dun!",
"your the judge, oh no!", "your the judge, oh no!",
"I dont wanna backslide", "I dont wanna backslide",
"welcome back to trench!",
"sai is propaganda!", "sai is propaganda!",
" •|i|• Ø i+! ].[", " •|i|• Ø i+! ].[",
"stay alive! |-/", "stay alive! |-/",

View file

@ -31,13 +31,13 @@ const os = require('os');
const cnf = require("../../../config.json"); const cnf = require("../../../config.json");
const innertube = require("../libpoketube-youtubei-objects.json"); const innertube = require("../libpoketube-youtubei-objects.json");
const verfull = "v24.2801-JeSsIcA-MAJOR-stable-dev-nonLTS-git-MTcwNjQzMTc0OQ=="; const verfull = "v24.0605-VeE-MINOR_UPDATE-stable-dev-nonLTS-git-MTcxNTAwOTczNQ==";
const versmol = "v24.2801-JeSsIcA" const versmol = "v24.0605-vEe"
const branch = "dev/master"; const branch = "dev/master";
const codename = "jessica"; const codename = "vee";
const versionnumber = "273"; const versionnumber = "291";
const relaseunixdate = "MTcwNjQzMTc0OQ==" const relaseunixdate = "MTcxNTAwOTczNQ=="
const updatequote = "Empty your cup so that it may be filled; become devoid to gain totality. - Bruce Lee" const updatequote = "Love is the ultimate software update; embrace the patches, for they refine the code of our shared existence, hand in hand, heart to heard (unknown)"
module.exports = function (app, config, renderTemplate) { module.exports = function (app, config, renderTemplate) {

View file

@ -109,25 +109,27 @@ module.exports = function (app, config, renderTemplate) {
const poketube_universe_value = "poketube_smart_search"; const poketube_universe_value = "poketube_smart_search";
if (query) { if (query) {
let redirectTo = null; let redirectTo = null;
let splitParam = ":";
if (query.includes("youtube.com/watch?v=")) { if (query.includes("youtube.com/watch?v=")) {
redirectTo = "/watch?v="; redirectTo = "/watch";
} else if (query.includes("channel:")) { splitParam = "?v=";
} else if (query.includes("channel:")) {
redirectTo = "/channel?id="; redirectTo = "/channel?id=";
} else if (query.includes("video:")) { } else if (query.includes("video:")) {
redirectTo = "/watch?v="; redirectTo = "/watch?v=";
} }
if (redirectTo) { if (redirectTo) {
try { try {
const id = query.split(":")[1]; const id = query.split(splitParam)[1];
res.redirect(`${redirectTo}${id}`); res.redirect(`${redirectTo}${splitParam}${id}`);
} catch { } catch {
return; return;
} }
}
} }
}
if (query && query.startsWith("!") && query.length > 2) { if (query && query.startsWith("!") && query.length > 2) {
res.redirect("https://lite.duckduckgo.com/lite/?q=" + query); res.redirect("https://lite.duckduckgo.com/lite/?q=" + query);
@ -229,9 +231,8 @@ module.exports = function (app, config, renderTemplate) {
let continuation = req.query.continuation || ""; let continuation = req.query.continuation || "";
try { try {
const results = web.web;
const results = web.web;
renderTemplate(res, req, "search-web.ejs", { renderTemplate(res, req, "search-web.ejs", {
j: "", j: "",
IsOldWindows, IsOldWindows,
@ -318,7 +319,7 @@ module.exports = function (app, config, renderTemplate) {
)}/${ID}/?hl=en-US`; )}/${ID}/?hl=en-US`;
const channelINVUrl = `${apiUrl}${ID}/`; const channelINVUrl = `${apiUrl}${ID}/`;
const checkPronoun = async (id) => (await (await fetch('https://codeberg.org/ashley/poke-pronouns-db/raw/branch/main/pronouns.json')).json())[id] || `no pronouns set`; const checkPronoun = async (id) => (await (await fetch('https://codeberg.org/ashley/poke-pronouns-db/raw/branch/main/pronouns.json')).json())[id] || `no pronouns set`;
const pronoun = await checkPronoun(ID); const pronoun = await checkPronoun(ID);
var [tj, shorts, playlist, stream, c, cinv] = await Promise.all([ var [tj, shorts, playlist, stream, c, cinv] = await Promise.all([

View file

@ -141,8 +141,8 @@ function lightOrDark(color) {
} }
function isDntEnabled(req) { function isDntEnabled(req) {
const dntHeader = req.header('DNT'); const dntHeader = req.header("DNT");
return dntHeader && (dntHeader === '1' || dntHeader === 'true'); return dntHeader && (dntHeader === "1" || dntHeader === "true");
} }
function IsInArray(array, id) { function IsInArray(array, id) {
@ -184,7 +184,7 @@ module.exports = function (app, config, renderTemplate) {
}); });
app.get("/watch", async (req, res) => { app.get("/watch", 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("/");
@ -202,153 +202,158 @@ module.exports = function (app, config, renderTemplate) {
const secure = ["poketube.fun"].includes(req.hostname); const secure = ["poketube.fun"].includes(req.hostname);
const verify = req.hostname === "poketube.sudovanilla.com"; 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(X_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 (uaos === "Windows XP" || uaos === "Windows Vista")
res.redirect("/lite?v=" + req.query.v);
if (req.query.from === "short") var shortsui = true;
INNERTUBE.getYouTubeApiVideo(f, v, contentlang, contentregion).then(
(data) => {
try { try {
renderTemplate(res, req, "poketube.ejs", { const k = data?.video;
color: data.color, const channel_uploads = data?.channel_uploads;
color2: data.color2, const json = data?.json;
linkify, const engagement = data?.engagement;
engagement, const inv_comments = data?.comments || "Disabled";
IsOldWindows, const inv_vid = data?.vid;
channelurlfixer, const desc = data?.desc || "";
support,
shortsui, let d = false;
u: vidurl, if (desc !== "[object Object]") {
isvidious: isvidious, d = desc.toString().replace(/\n/g, " <br> ");
video: json, }
date: k.Video.uploadDate,
e, const descriptionString = String(inv_vid?.description);
a,
twitter, function extractInfo(regex) {
k, return descriptionString !== "[object Object]"
dm, ? (regex.exec(descriptionString) ?? {}).groups
proxyurl, : undefined;
media_proxy_url: mediaproxy, }
instagram,
useragent: req.useragent, const support = extractInfo(PATREON_REGEX);
verify, const twitter = extractInfo(X_REGEX);
discord, const discord = extractInfo(CORD_REGEX);
turntomins, const twitch = extractInfo(TWITCH_REGEX);
twitch, const reddit = extractInfo(REDDIT_REGEX);
dnt_val, const instagram = extractInfo(INSTAGRAM_REGEX);
reddit,
channel_uploads, var proxyurl = config.p_url;
secure, var vidurl = u.url;
process, var isvidious = u.isInvidiousURL;
isSchoolProxy, var mediaproxy = config.media_proxy;
sha384,
lightOrDark, if (inv_vid?.genre === "Music") {
isMobile: req.useragent.isMobile, var vidurl = u.losslessurl;
tj: data.channel, }
r,
qua: q, var vidurl = config.videourl;
inv: inv_comments, var isvidious = true;
convert,
universe, if (req.useragent.source.includes("Pardus")) {
wiki: data.wiki, var vidurl = "https://iv.ggtyler.dev";
escapeHtml, var mediaproxy = "https://nyc1.pokejan.ggtyler.dev/";
f, var isvidious = true;
t: config.t_url, var isSchoolProxy = "";
optout: m, }
badges,
desc, // unused
comments, let badges = "";
n: nnn, let comments = "";
inv_vid, let nnn = "";
lyrics: "",
}); const dnt_val = isDntEnabled(req);
} catch {
return; 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"
);
}
if (inv_vid?.error) {
renderTemplate(res, req, "404.ejs", {
v,
});
}
var uaos = req.useragent.os;
const browser = req.useragent.browser;
const IsOldWindows =
(uaos === "Windows 7" || uaos === "Windows 8") &&
browser === "Firefox";
if (uaos === "Windows XP" || uaos === "Windows Vista")
res.redirect("/lite?v=" + req.query.v);
if (req.query.from === "short") var shortsui = true;
try {
renderTemplate(res, req, "poketube.ejs", {
color: data.color,
color2: data.color2,
linkify,
engagement,
IsOldWindows,
channelurlfixer,
support,
shortsui,
u: vidurl,
isvidious: isvidious,
video: json,
date: k.Video.uploadDate,
e,
a,
twitter,
k,
dm,
proxyurl,
media_proxy_url: mediaproxy,
instagram,
useragent: req.useragent,
verify,
discord,
turntomins,
twitch,
dnt_val,
reddit,
channel_uploads,
secure,
process,
isSchoolProxy,
sha384,
lightOrDark,
isMobile: req.useragent.isMobile,
tj: data.channel,
r,
qua: q,
inv: inv_comments,
convert,
universe,
wiki: data.wiki,
escapeHtml,
f,
t: config.t_url,
optout: m,
badges,
desc,
comments,
n: nnn,
inv_vid,
lyrics: "",
});
} catch {
return;
}
} catch (error) {
console.error(error);
return res.redirect(`/watch?v=${req.query.v}&fx=1&err=${error}`);
} }
} catch (error) {
console.error(error);
return res.redirect(`/watch?v=${req.query.v}&fx=1&err=${error}`);
} }
}); );
}); });
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("/");
@ -366,145 +371,144 @@ module.exports = function (app, config, renderTemplate) {
const secure = ["poketube.fun"].includes(req.hostname); const secure = ["poketube.fun"].includes(req.hostname);
const verify = req.hostname === "poketube.sudovanilla.com"; 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(X_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 = "https://eu-proxy.poketube.fun";
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;
INNERTUBE.getYouTubeApiVideo(f, v, contentlang, contentregion).then(
(data) => {
try { try {
renderTemplate(res, req, "lite.ejs", { const k = data?.video;
color: data.color, const channel_uploads = data?.channel_uploads;
color2: data.color2, const json = data?.json;
linkify, const engagement = data?.engagement;
engagement, const inv_comments = data?.comments || "Disabled";
IsOldWindows, const inv_vid = data?.vid;
channelurlfixer, const desc = data?.desc || "";
support,
shortsui, let d = false;
u: vidurl, if (desc !== "[object Object]") {
isvidious: isvidious, d = desc.toString().replace(/\n/g, " <br> ");
video: json, }
date: k.Video.uploadDate,
e, const descriptionString = String(inv_vid?.description);
a,
twitter, function extractInfo(regex) {
k, return descriptionString !== "[object Object]"
dm, ? (regex.exec(descriptionString) ?? {}).groups
proxyurl, : undefined;
media_proxy_url: mediaproxy, }
instagram,
useragent: req.useragent, const support = extractInfo(PATREON_REGEX);
verify, const twitter = extractInfo(X_REGEX);
discord, const discord = extractInfo(CORD_REGEX);
turntomins, const twitch = extractInfo(TWITCH_REGEX);
twitch, const reddit = extractInfo(REDDIT_REGEX);
dnt_val, const instagram = extractInfo(INSTAGRAM_REGEX);
reddit,
channel_uploads, var proxyurl = config.p_url;
secure, var vidurl = u.url;
process, var isvidious = u.isInvidiousURL;
isSchoolProxy, var mediaproxy = config.media_proxy;
sha384,
lightOrDark, if (inv_vid?.genre === "Music") {
isMobile: req.useragent.isMobile, var vidurl = u.losslessurl;
tj: data.channel, }
r,
qua: q, var vidurl = "https://eu-proxy.poketube.fun";
inv: inv_comments, var isvidious = true;
convert,
universe, if (req.useragent.source.includes("Pardus")) {
wiki: data.wiki, var vidurl = "https://iv.ggtyler.dev";
f, var mediaproxy = "https://media-proxy.ashley0143.xyz";
t: config.t_url, var isvidious = true;
optout: m, var isSchoolProxy = "";
badges, }
desc,
comments, // unused
n: nnn, let badges = "";
inv_vid, let comments = "";
lyrics: "", let nnn = "";
});
} catch { const dnt_val = isDntEnabled(req);
return;
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,
linkify,
engagement,
IsOldWindows,
channelurlfixer,
support,
shortsui,
u: vidurl,
isvidious: isvidious,
video: json,
date: k.Video.uploadDate,
e,
a,
twitter,
k,
dm,
proxyurl,
media_proxy_url: mediaproxy,
instagram,
useragent: req.useragent,
verify,
discord,
turntomins,
twitch,
dnt_val,
reddit,
channel_uploads,
secure,
process,
isSchoolProxy,
sha384,
lightOrDark,
isMobile: req.useragent.isMobile,
tj: data.channel,
r,
qua: q,
inv: inv_comments,
convert,
universe,
wiki: data.wiki,
f,
t: config.t_url,
optout: m,
badges,
desc,
comments,
n: nnn,
inv_vid,
lyrics: "",
});
} catch {
return;
}
} catch (error) {
console.error(error);
return res.redirect(`/watch?v=${req.query.v}&fx=1&err=${error}`);
} }
} catch (error) {
console.error(error);
return res.redirect(`/watch?v=${req.query.v}&fx=1&err=${error}`);
} }
}); );
}); });
app.get("/music", async function (req, res) { app.get("/music", async function (req, res) {
@ -655,4 +659,4 @@ module.exports = function (app, config, renderTemplate) {
} }
} }
}); });
}; };

View file

@ -30,7 +30,13 @@ class InnerTubePokeVidious {
this.config = config; this.config = config;
this.cache = {}; this.cache = {};
this.language = "hl=en-US"; this.language = "hl=en-US";
this.param = "2AMB"
this.param_legacy = "CgIIAdgDAQ%3D%3D"
this.apikey = "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8" this.apikey = "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8"
this.ANDROID_API_KEY = "AIzaSyA8eiZmM1FaDVjRy-df2KTyQ_vz_yYM39w"
this.ANDROID_APP_VERSION = "19.14.42"
this.ANDROID_VERSION = "13"
this.useragent = "com.google.android.youtube/19.14.42 (Linux; U; Android 12; US) gzip"
this.INNERTUBE_CONTEXT_CLIENT_VERSION = "1" this.INNERTUBE_CONTEXT_CLIENT_VERSION = "1"
this.region = "region=US"; this.region = "region=US";
this.sqp = "-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLBy_x4UUHLNDZtJtH0PXeQGoRFTgw"; this.sqp = "-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLBy_x4UUHLNDZtJtH0PXeQGoRFTgw";