mirror of
https://codeberg.org/ashley/poke.git
synced 2024-12-25 20:28:40 +01:00
add did you mean? prompt
This commit is contained in:
parent
64ff616867
commit
249a375aae
1 changed files with 142 additions and 121 deletions
|
@ -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,
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue