new channel page for mobile :3

This commit is contained in:
Ashley 2022-09-23 13:25:02 +02:00
parent 8c1575480a
commit 2e0e929e91

View file

@ -98,6 +98,13 @@ return new Intl.NumberFormat('en-GB', {
}).format(value); }).format(value);
} }
function getFirstLine(text) {
var index = text.indexOf("<br> ");
if (index === -1) index = undefined;
return text.substring(0, index);
}
///////////////////////////////// /////////////////////////////////
app.use(function (req, res, next) { app.use(function (req, res, next) {
@ -317,35 +324,35 @@ app.get("/music", async function (req, res) {
const h = await video.text(); const h = await video.text();
const k = JSON.parse(toJson(h)); const k = JSON.parse(toJson(h));
if (!json.Channel.Name.endsWith(" - Topic")) { if (!k.Video.Channel.Name.endsWith(" - Topic")) {
res.redirect(`/watch?v=${v}`); res.redirect(`/watch?v=${v}`);
} }
//video //video
var url = `https://tube.kuylar.dev/proxy/media/${v}/18`; var url = `https://tube.kuylar.dev/proxy/media/${v}/18`;
// encryption // encryption
const url_e = const url_e =
url + url +
"?e=" + "?e=" +
sha384(json.id) + sha384(k.Video.Channel.id) +
sha384(json.Title) + sha384(k.Video.Channel.id) +
sha384(json.Channel.id) +
sha384(json.Channel.id) +
"Piwik" + "Piwik" +
sha384(config.t_url); sha384(config.t_url);
// channel info // channel info
const engagement = fetching.engagement; const engagement = fetching.engagement;
const channel = await fetch( const channel = await fetch(
config.tubeApi + `channel?id=${json.Channel.id}&tab=videos` config.tubeApi + `channel?id=${k.Video.Channel.id}&tab=videos`
); );
const c = await channel.text(); const c = await channel.text();
const tj = JSON.parse(toJson(c)); const tj = JSON.parse(toJson(c));
// info // info
const song = await musicInfo.searchSong( const song = await musicInfo.searchSong(
{ title: json.Title, artist: json.Channel.Name.replace("- Topic", "") }, { title: k.Video.Title, artist: k.Video.Channel.Name.replace("- Topic", "") },
1000 1000
); );
@ -487,6 +494,7 @@ app.get("/channel/", async (req, res) => {
j: k, j: k,
tj: tj, tj: tj,
wiki: w, wiki: w,
getFirstLine:getFirstLine,
isMobile: req.useragent.isMobile, isMobile: req.useragent.isMobile,
about: k.Channel.Contents.ItemSection.About, about: k.Channel.Contents.ItemSection.About,
subs: subs: