From 740372c59b2d422c9cde029a9293cd4ec90d93c1 Mon Sep 17 00:00:00 2001 From: Dave Date: Mon, 2 Jun 2025 05:45:17 +0200 Subject: [PATCH] feat(discover): update searxng query options to include categories and time range --- src/app/api/discover/route.ts | 8 ++++---- src/lib/searxng.ts | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/app/api/discover/route.ts b/src/app/api/discover/route.ts index b1c761d..1a1b1a5 100644 --- a/src/app/api/discover/route.ts +++ b/src/app/api/discover/route.ts @@ -30,11 +30,11 @@ export const GET = async (req: Request) => { .map(async (_, i) => { return ( await searchSearxng( - `site:${articleWebsites[i % articleWebsites.length]} ${ - topics[i % topics.length] + `site:${articleWebsites[i % articleWebsites.length]} ${topics[i % topics.length] }`, { - engines: ['bing news'], + categories: ['news'], + time_range: ['month'], pageno: 1, }, ) @@ -49,7 +49,7 @@ export const GET = async (req: Request) => { data = ( await searchSearxng( `site:${articleWebsites[Math.floor(Math.random() * articleWebsites.length)]} ${topics[Math.floor(Math.random() * topics.length)]}`, - { engines: ['bing news'], pageno: 1 }, + { categories: ['news'], time_range: ['month'], pageno: 1 }, ) ).results; } diff --git a/src/lib/searxng.ts b/src/lib/searxng.ts index ae19db2..c333797 100644 --- a/src/lib/searxng.ts +++ b/src/lib/searxng.ts @@ -6,6 +6,7 @@ interface SearxngSearchOptions { engines?: string[]; language?: string; pageno?: number; + time_range?: string[]; } interface SearxngSearchResult {