mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-22 18:37:49 +01:00
finally fix search
This commit is contained in:
parent
810b040aa3
commit
c0b1c678db
1 changed files with 7 additions and 10 deletions
|
@ -171,11 +171,15 @@ module.exports = function (app, config, renderTemplate) {
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get("/web", async (req, res) => {
|
app.get("/web", async (req, res) => {
|
||||||
/*
|
|
||||||
const query = req.query.query;
|
const query = req.query.query;
|
||||||
const tab = req.query.tab;
|
const tab = req.query.tab;
|
||||||
|
|
||||||
const DDG = require("duck-duck-scrape");
|
const { fetch } = await import("undici");
|
||||||
|
|
||||||
|
const search = await fetch(
|
||||||
|
`https://4get.sudovanilla.com/api/v1/web?s=${query}`
|
||||||
|
);
|
||||||
|
const web = getJson(await search.text());
|
||||||
|
|
||||||
if (req.query.lucky === "true") {
|
if (req.query.lucky === "true") {
|
||||||
res.redirect("/im-feeling-lucky?query=" + query);
|
res.redirect("/im-feeling-lucky?query=" + query);
|
||||||
|
@ -214,11 +218,7 @@ module.exports = function (app, config, renderTemplate) {
|
||||||
let continuation = req.query.continuation || "";
|
let continuation = req.query.continuation || "";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const searchResults = await DDG.search(query, {
|
const results = web.web;
|
||||||
safeSearch: DDG.SafeSearchType.OFF,
|
|
||||||
});
|
|
||||||
|
|
||||||
const results = searchResults.results;
|
|
||||||
|
|
||||||
renderTemplate(res, req, "search-web.ejs", {
|
renderTemplate(res, req, "search-web.ejs", {
|
||||||
j: "",
|
j: "",
|
||||||
|
@ -235,9 +235,6 @@ module.exports = function (app, config, renderTemplate) {
|
||||||
console.error(`Error while searching for '${query}':`, error);
|
console.error(`Error while searching for '${query}':`, error);
|
||||||
res.redirect("/");
|
res.redirect("/");
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
res.redirect("/");
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get("/channel/", async (req, res) => {
|
app.get("/channel/", async (req, res) => {
|
||||||
|
|
Loading…
Reference in a new issue