mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-17 10:54:39 -05:00
* Rename youtube.ejs and ytmain.ejs
and use video object instead
This commit is contained in:
parent
a1e444654e
commit
31ab1776f3
1 changed files with 6 additions and 14 deletions
20
server.js
20
server.js
|
@ -1,4 +1,4 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2021-2022 POKETUBE (https://github.com/iamashley0/poketube)
|
Copyright (C) 2021-2022 POKETUBE (https://github.com/iamashley0/poketube)
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -16,7 +16,6 @@
|
||||||
*/
|
*/
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const htmlParser = require("node-html-parser");
|
const htmlParser = require("node-html-parser");
|
||||||
|
|
||||||
const moment = require("moment");
|
const moment = require("moment");
|
||||||
const templateDir = path.resolve(`${process.cwd()}${path.sep}html`);
|
const templateDir = path.resolve(`${process.cwd()}${path.sep}html`);
|
||||||
var express = require("express");
|
var express = require("express");
|
||||||
|
@ -64,24 +63,19 @@ if (j_.URL != undefined)
|
||||||
const engagement = fetching.engagement
|
const engagement = fetching.engagement
|
||||||
const lyrics = await lyricsFinder(json.Title);
|
const lyrics = await lyricsFinder(json.Title);
|
||||||
if (lyrics == undefined) lyrics = "Lyrics not found";
|
if (lyrics == undefined) lyrics = "Lyrics not found";
|
||||||
|
renderTemplate(res, req, "poketube.ejs", {
|
||||||
renderTemplate(res, req, "youtube.ejs", {
|
|
||||||
url: url,
|
url: url,
|
||||||
color: await getColors(`https://i.ytimg.com/vi/${v}/maxresdefault.jpg`).then((colors) => colors[0].hex()),
|
color: await getColors(`https://i.ytimg.com/vi/${v}/maxresdefault.jpg`).then((colors) => colors[0].hex()),
|
||||||
engagement:engagement,
|
engagement:engagement,
|
||||||
title: json,
|
|
||||||
a:json,
|
|
||||||
video: json,
|
video: json,
|
||||||
date: moment(json.uploadDate).format("LL"),
|
date: moment(json.uploadDate).format("LL"),
|
||||||
e:e,
|
e:e,
|
||||||
lyrics: lyrics.replace(/\n/g, " <br> "),
|
lyrics: lyrics.replace(/\n/g, " <br> "),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
app.get("/", function (req, res) {
|
app.get("/", function (req, res) {
|
||||||
const things = random_words[Math.floor((Math.random()*random_words.length))];
|
const things = random_words[Math.floor((Math.random()*random_words.length))];
|
||||||
renderTemplate(res, req, "ytmain.ejs", {
|
renderTemplate(res, req, "main.ejs", {
|
||||||
random:things,
|
random:things,
|
||||||
});});
|
});});
|
||||||
app.get("/channel", function (req, res) {
|
app.get("/channel", function (req, res) {
|
||||||
|
@ -92,6 +86,9 @@ app.get("/channel", function (req, res) {
|
||||||
app.get("/privacy", function (req, res) {
|
app.get("/privacy", function (req, res) {
|
||||||
renderTemplate(res, req, "priv.ejs");
|
renderTemplate(res, req, "priv.ejs");
|
||||||
});
|
});
|
||||||
|
app.get("/143", function (req, res) {
|
||||||
|
renderTemplate(res, req, "143.ejs");
|
||||||
|
});
|
||||||
app.get("/domains", function (req, res) {
|
app.get("/domains", function (req, res) {
|
||||||
renderTemplate(res, req, "domains.ejs");
|
renderTemplate(res, req, "domains.ejs");
|
||||||
});
|
});
|
||||||
|
@ -118,15 +115,10 @@ app.get("/api/video/download", async function (req, res) {
|
||||||
app.get("/api/video/downloadjson", async function (req, res) {
|
app.get("/api/video/downloadjson", async function (req, res) {
|
||||||
var v = req.query.v;var fetching = await fetcher(v);const url = fetching.video.Player.Formats.Format[1].URL;res.json(url)
|
var v = req.query.v;var fetching = await fetcher(v);const url = fetching.video.Player.Formats.Format[1].URL;res.json(url)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
app.get("*", function (req, res) {
|
app.get("*", function (req, res) {
|
||||||
const things = random_words[Math.floor((Math.random()*random_words.length))];
|
const things = random_words[Math.floor((Math.random()*random_words.length))];
|
||||||
renderTemplate(res, req, "404.ejs", {
|
renderTemplate(res, req, "404.ejs", {
|
||||||
random:things,
|
random:things,
|
||||||
});});
|
});});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
app.listen("3000", () => {
|
app.listen("3000", () => {
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue