mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-28 17:29:02 +01:00
new ui pog
This commit is contained in:
parent
244c904c7b
commit
f4eb4704e3
1 changed files with 35 additions and 10 deletions
41
server.js
41
server.js
|
@ -46,13 +46,12 @@ const fetch = require("node-fetch");
|
|||
const fetcher = require("./src/fetcher.js");
|
||||
|
||||
app.get("/watch", async function (req, res) {
|
||||
|
||||
var v = req.query.v;
|
||||
const getColors = require('get-image-colors')
|
||||
var e = req.query.e;
|
||||
if(!v) res.redirect("/")
|
||||
var fetching = await fetcher(v)
|
||||
const j = fetching.video.Player.Formats.Format,
|
||||
const j = fetching.video.Player.Formats.Format,
|
||||
j_ = Array.isArray(j)
|
||||
? j[j.length - 1]
|
||||
: j;
|
||||
|
@ -73,6 +72,34 @@ if (j_.URL != undefined)
|
|||
lyrics: lyrics.replace(/\n/g, " <br> "),
|
||||
});
|
||||
});
|
||||
|
||||
app.get("/old/watch", async function (req, res) {
|
||||
var v = req.query.v;
|
||||
const getColors = require('get-image-colors')
|
||||
var e = req.query.e;
|
||||
if(!v) res.redirect("/")
|
||||
var fetching = await fetcher(v)
|
||||
const j = fetching.video.Player.Formats.Format,
|
||||
j_ = Array.isArray(j)
|
||||
? j[j.length - 1]
|
||||
: j;
|
||||
let url;
|
||||
if (j_.URL != undefined)
|
||||
url = j_.URL;
|
||||
const json = fetching.video.Player
|
||||
const engagement = fetching.engagement
|
||||
const lyrics = await lyricsFinder(json.Title);
|
||||
if (lyrics == undefined) lyrics = "Lyrics not found";
|
||||
renderTemplate(res, req, "poketube-old.ejs", {
|
||||
url: url,
|
||||
color: await getColors(`https://i.ytimg.com/vi/${v}/maxresdefault.jpg`).then((colors) => colors[0].hex()),
|
||||
engagement:engagement,
|
||||
video: json,
|
||||
date: moment(json.uploadDate).format("LL"),
|
||||
e:e,
|
||||
lyrics: lyrics.replace(/\n/g, " <br> "),
|
||||
});
|
||||
});
|
||||
app.get("/", function (req, res) {
|
||||
const things = random_words[Math.floor((Math.random()*random_words.length))];
|
||||
renderTemplate(res, req, "main.ejs", {
|
||||
|
@ -82,9 +109,7 @@ app.get("/", function (req, res) {
|
|||
app.get("/channel", async (req, res) => {
|
||||
const ID = req.query.id;
|
||||
const { toJson } = require("xml2json");
|
||||
const bout = await fetch(
|
||||
`https://lighttube.herokuapp.com/api/channel?id=${ID}&tab=about`
|
||||
);
|
||||
const bout = await fetch( `https://tube.kuylar.dev/api/channel?id=${ID}&tab=about`);
|
||||
const h = await bout.text();
|
||||
const k = JSON.parse(toJson(h));
|
||||
const { Subscribers: subscribers } = k.Channel.Metadata;
|
||||
|
@ -115,9 +140,7 @@ app.get("/api/search", async (req, res) => {
|
|||
app.get("/search", async (req, res) => {
|
||||
const { toJson } = require("xml2json");
|
||||
const query = req.query.query;
|
||||
const search = await fetch(
|
||||
`https://tube.kuylar.dev/api/search?query=${query}`
|
||||
);
|
||||
const search = await fetch(`https://tube.kuylar.dev/api/search?query=${query}`);
|
||||
const text = await search.text();
|
||||
const j = JSON.parse(toJson(text));
|
||||
if (!query) {
|
||||
|
@ -143,6 +166,8 @@ app.get("/api/video/download", 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)
|
||||
});
|
||||
|
||||
|
||||
app.get("*", function (req, res) {
|
||||
const things = random_words[Math.floor((Math.random()*random_words.length))];
|
||||
renderTemplate(res, req, "404.ejs", {
|
||||
|
|
Loading…
Reference in a new issue