mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-14 05:28:58 +01:00
Update 'server.js'
This commit is contained in:
parent
e2db1a4d6e
commit
45d34792c3
1 changed files with 14 additions and 5 deletions
11
server.js
11
server.js
|
@ -41,6 +41,8 @@ var sha384 = require("js-sha512").sha384;
|
|||
var sha512_256 = require("js-sha512").sha512_256;
|
||||
var sha512_224 = require("js-sha512").sha512_224;
|
||||
|
||||
const musicInfo = require("music-info");
|
||||
|
||||
var app = express();
|
||||
app.engine("html", require("ejs").renderFile);
|
||||
app.use(express.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded
|
||||
|
@ -132,6 +134,7 @@ app.get("/watch", async function (req, res) {
|
|||
var q = req.query.quality;
|
||||
|
||||
const video = await fetch(config.tubeApi + `video?v=${v}`);
|
||||
|
||||
var fetching = await fetcher(v);
|
||||
|
||||
const json = fetching.video.Player;
|
||||
|
@ -197,17 +200,19 @@ app.get("/music", async function (req, res) {
|
|||
var f = req.query.f;
|
||||
var t = req.query.t;
|
||||
|
||||
if (!v) res.redirect("/");
|
||||
|
||||
const video = await fetch(config.tubeApi + `video?v=${v}`);
|
||||
var fetching = await fetcher(v);
|
||||
|
||||
const json = fetching.video.Player;
|
||||
const h = await video.text();
|
||||
const k = JSON.parse(toJson(h));
|
||||
if (!v) res.redirect("/");
|
||||
|
||||
if (!json.Channel.Name.endsWith(" - Topic")) {
|
||||
res.redirect(`/watch?v=${v}`);
|
||||
}
|
||||
|
||||
//video
|
||||
var url = `https://tube.kuylar.dev/proxy/media/${v}/18`;
|
||||
|
||||
|
@ -225,8 +230,12 @@ app.get("/music", async function (req, res) {
|
|||
// lyrics
|
||||
const lyrics = await lyricsFinder(json.Title);
|
||||
|
||||
// info
|
||||
const info = await musicInfo.searchSong({ title: json.Title, artist:json.Channel.Name.replace("- Topic", "")}, 1000)
|
||||
|
||||
renderTemplate(res, req, "poketube-music.ejs", {
|
||||
url: url_e,
|
||||
info: info,
|
||||
color: await getColors(
|
||||
`https://i.ytimg.com/vi/${v}/maxresdefault.jpg`
|
||||
).then((colors) => colors[0].hex()),
|
||||
|
|
Loading…
Reference in a new issue