1
0
Fork 0
mirror of https://codeberg.org/ashley/poke.git synced 2024-11-17 09:14:39 -05:00

Update server.js

This commit is contained in:
Ashley 2022-03-06 23:46:29 +03:00 committed by GitHub
parent 57d8857889
commit 6a7f6f93f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -31,24 +31,7 @@ const renderTemplate = async (res, req, template, data = {}) => {
};
const fetch = require("node-fetch");
const fetcher = require("./src/fetcher.js");
app.get("/watchnew", async function (req, res) {
var url = req.query.v;
var uu = `https://www.youtube.com/watch?v=${url}`;
const json = await fetch(
`https://yt-proxy-api.herokuapp.com/get_player_info?v=${url}`
).then((res) => res.json());
const lyrics = await lyricsFinder(json.title);
if (lyrics == undefined) lyrics = "Lyrics not found";
renderTemplate(res, req, "youtubenew.ejs", {
url: json.formats[1].url,
title: json,
video: json,
date: json.upload_date,
lyrics: lyrics.replace(/\n/g, " <br> "),
});
});
app.get("/watch", async function (req, res) {
var url = req.query.v;
var e = req.query.e;