mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-28 18:49:04 +01:00
lyricsss
This commit is contained in:
parent
9802cad2b0
commit
0dbc93ac0f
1 changed files with 42 additions and 14 deletions
56
server.js
56
server.js
|
@ -134,7 +134,7 @@ app.get("/watch", async function (req, res) {
|
||||||
var q = req.query.quality;
|
var q = req.query.quality;
|
||||||
|
|
||||||
const video = await fetch(config.tubeApi + `video?v=${v}`);
|
const video = await fetch(config.tubeApi + `video?v=${v}`);
|
||||||
|
|
||||||
var fetching = await fetcher(v);
|
var fetching = await fetcher(v);
|
||||||
|
|
||||||
const json = fetching.video.Player;
|
const json = fetching.video.Player;
|
||||||
|
@ -149,8 +149,15 @@ app.get("/watch", async function (req, res) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// encryption
|
// encryption
|
||||||
const url_e = url + "?e=" + sha384(json.id) + sha384(json.Title) + sha384(json.Channel.id) + sha384(json.Channel.id) + "Piwik" + sha384(config.t_url);
|
const url_e =
|
||||||
|
url +
|
||||||
|
"?e=" +
|
||||||
|
sha384(json.Title) +
|
||||||
|
sha384(json.Channel.id) +
|
||||||
|
sha384(json.Channel.id) +
|
||||||
|
"Piwik" +
|
||||||
|
sha384(config.t_url);
|
||||||
|
|
||||||
// channel info
|
// channel info
|
||||||
const engagement = fetching.engagement;
|
const engagement = fetching.engagement;
|
||||||
const channel = await fetch(
|
const channel = await fetch(
|
||||||
|
@ -180,7 +187,7 @@ app.get("/watch", async function (req, res) {
|
||||||
f: f,
|
f: f,
|
||||||
t: config.t_url,
|
t: config.t_url,
|
||||||
optout: t,
|
optout: t,
|
||||||
lyrics: ""
|
lyrics: "",
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -199,7 +206,7 @@ app.get("/music", async function (req, res) {
|
||||||
var r = req.query.r;
|
var r = req.query.r;
|
||||||
var f = req.query.f;
|
var f = req.query.f;
|
||||||
var t = req.query.t;
|
var t = req.query.t;
|
||||||
|
|
||||||
if (!v) res.redirect("/");
|
if (!v) res.redirect("/");
|
||||||
|
|
||||||
const video = await fetch(config.tubeApi + `video?v=${v}`);
|
const video = await fetch(config.tubeApi + `video?v=${v}`);
|
||||||
|
@ -208,16 +215,24 @@ app.get("/music", async function (req, res) {
|
||||||
const json = fetching.video.Player;
|
const json = fetching.video.Player;
|
||||||
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 (!json.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 = url + "?e=" + sha384(json.id) + sha384(json.Title) + sha384(json.Channel.id) + sha384(json.Channel.id) + "Piwik" + sha384(config.t_url);
|
const url_e =
|
||||||
|
url +
|
||||||
|
"?e=" +
|
||||||
|
sha384(json.id) +
|
||||||
|
sha384(json.Title) +
|
||||||
|
sha384(json.Channel.id) +
|
||||||
|
sha384(json.Channel.id) +
|
||||||
|
"Piwik" +
|
||||||
|
sha384(config.t_url);
|
||||||
|
|
||||||
// channel info
|
// channel info
|
||||||
const engagement = fetching.engagement;
|
const engagement = fetching.engagement;
|
||||||
|
@ -227,13 +242,26 @@ app.get("/music", async function (req, res) {
|
||||||
const c = await channel.text();
|
const c = await channel.text();
|
||||||
const tj = JSON.parse(toJson(c));
|
const tj = JSON.parse(toJson(c));
|
||||||
|
|
||||||
// lyrics
|
|
||||||
const lyrics = await lyricsFinder(json.Title);
|
|
||||||
|
|
||||||
// info
|
// info
|
||||||
const info = await musicInfo.searchSong({ title: json.Title, artist:json.Channel.Name.replace("- Topic", "")}, 1000)
|
const info = await musicInfo.searchSong(
|
||||||
|
{ title: json.Title, artist: json.Channel.Name.replace("- Topic", "") },
|
||||||
|
1000
|
||||||
|
);
|
||||||
|
|
||||||
|
var lyrics = await musicInfo
|
||||||
|
.searchLyrics({ title: info.title, artist: info.artist })
|
||||||
|
.catch(() => null);
|
||||||
|
|
||||||
|
var ly = "";
|
||||||
|
|
||||||
|
if (lyrics === null) {
|
||||||
|
ly = "This Is Where I'd Put The songs lyrics. IF IT HAD ONE ";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lyrics) {
|
||||||
|
ly = lyrics.lyrics.replace(/\n/g, " <br> ");
|
||||||
|
}
|
||||||
|
|
||||||
renderTemplate(res, req, "poketube-music.ejs", {
|
renderTemplate(res, req, "poketube-music.ejs", {
|
||||||
url: url_e,
|
url: url_e,
|
||||||
info: info,
|
info: info,
|
||||||
|
@ -252,7 +280,7 @@ app.get("/music", async function (req, res) {
|
||||||
f: f,
|
f: f,
|
||||||
t: config.t_url,
|
t: config.t_url,
|
||||||
optout: t,
|
optout: t,
|
||||||
lyrics: ""
|
lyrics: ly,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue