add did you mean? prompt

This commit is contained in:
Ashley 2022-11-18 09:42:25 +00:00
parent 64ff616867
commit 249a375aae

View file

@ -1,4 +1,13 @@
const { fetcher,core, wiki,musicInfo, modules, version, initlog, init,} = require("../libpoketube-initsys.js");
const {
fetcher,
core,
wiki,
musicInfo,
modules,
version,
initlog,
init,
} = require("../libpoketube-initsys.js");
const {
IsJsonString,
convert,
@ -72,12 +81,23 @@ app.get("/search", async (req, res) => {
return res.redirect("/");
}
h = " ";
if (j.Search.Results.DynamicItem) {
if (j.Search.Results.DynamicItem.id == "didYouMeanRenderer") {
var h = JSON.parse(j.Search.Results.DynamicItem.Title);
}
}
const summary = await wiki
.summary(query + " ")
.then((summary_) => (summary_.title !== "Not found." ? summary_ : "none"));
.then((summary_) =>
summary_.title !== "Not found." ? summary_ : "none"
);
renderTemplate(res, req, "search.ejs", {
j,
h,
continuation,
q: query,
summary,
@ -104,7 +124,8 @@ app.get("/channel/", async (req, res) => {
//videos
const channel = await modules.fetch(
config.tubeApi + `channel?id=${ID}&tab=shorts&Continuation=${continuation}`
config.tubeApi +
`channel?id=${ID}&tab=shorts&Continuation=${continuation}`
);
const c = await channel.text();
const tj = JSON.parse(modules.toJson(c));
@ -150,4 +171,4 @@ app.get("/channel/", async (req, res) => {
desc: d,
});
});
}
};