mirror of
https://codeberg.org/ashley/poke.git
synced 2025-01-12 06:17:44 +01:00
use duckduckscrape :3
This commit is contained in:
parent
143353d4ae
commit
5f4c1783f9
1 changed files with 9 additions and 9 deletions
|
@ -53,7 +53,7 @@ const ChannelTabs = {
|
||||||
channels: "Y2hhbm5lbHM=",
|
channels: "Y2hhbm5lbHM=",
|
||||||
store: "c3RvcmU=",
|
store: "c3RvcmU=",
|
||||||
released: "cmVsZWFzZWQ=",
|
released: "cmVsZWFzZWQ=",
|
||||||
playlist:"cGxheWxpc3Rz"
|
playlist: "cGxheWxpc3Rz",
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = function (app, config, renderTemplate) {
|
module.exports = function (app, config, renderTemplate) {
|
||||||
|
@ -167,14 +167,14 @@ module.exports = function (app, config, renderTemplate) {
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get("/im-feeling-lucky", function (req, res) {
|
app.get("/im-feeling-lucky", function (req, res) {
|
||||||
res.send("WIP")
|
res.send("WIP");
|
||||||
});
|
});
|
||||||
|
|
||||||
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 search = require("duckduckgo-search");
|
const DDG = require("duck-duck-scrape");
|
||||||
|
|
||||||
if (req.query.lucky === "true") {
|
if (req.query.lucky === "true") {
|
||||||
res.redirect("/im-feeling-lucky?query=" + query);
|
res.redirect("/im-feeling-lucky?query=" + query);
|
||||||
|
@ -213,11 +213,11 @@ module.exports = function (app, config, renderTemplate) {
|
||||||
let continuation = req.query.continuation || "";
|
let continuation = req.query.continuation || "";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const results = []; // Initialize an array to store search results
|
const searchResults = await DDG.search(query, {
|
||||||
|
safeSearch: DDG.SafeSearchType.OFF,
|
||||||
|
});
|
||||||
|
|
||||||
for await (const result of search.text(query)) {
|
const results = searchResults.results;
|
||||||
results.push(result); // Push each result to the results array
|
|
||||||
}
|
|
||||||
|
|
||||||
renderTemplate(res, req, "search-web.ejs", {
|
renderTemplate(res, req, "search-web.ejs", {
|
||||||
j: "",
|
j: "",
|
||||||
|
@ -306,7 +306,7 @@ module.exports = function (app, config, renderTemplate) {
|
||||||
|
|
||||||
const channelINVUrl = `${apiUrl}${ID}/`;
|
const channelINVUrl = `${apiUrl}${ID}/`;
|
||||||
|
|
||||||
var [tj, shorts, playlist , stream, c, cinv] = await Promise.all([
|
var [tj, shorts, playlist, stream, c, cinv] = await Promise.all([
|
||||||
getChannelData(channelUrl),
|
getChannelData(channelUrl),
|
||||||
getChannelData(shortsUrl),
|
getChannelData(shortsUrl),
|
||||||
getChannelData(PlaylistUrl),
|
getChannelData(PlaylistUrl),
|
||||||
|
|
Loading…
Reference in a new issue