feat(discover): update searxng query options to include categories and time range

This commit is contained in:
Dave 2025-06-02 05:45:17 +02:00
parent 0b7989c3d3
commit 740372c59b
2 changed files with 5 additions and 4 deletions

View file

@ -30,11 +30,11 @@ export const GET = async (req: Request) => {
.map(async (_, i) => { .map(async (_, i) => {
return ( return (
await searchSearxng( await searchSearxng(
`site:${articleWebsites[i % articleWebsites.length]} ${ `site:${articleWebsites[i % articleWebsites.length]} ${topics[i % topics.length]
topics[i % topics.length]
}`, }`,
{ {
engines: ['bing news'], categories: ['news'],
time_range: ['month'],
pageno: 1, pageno: 1,
}, },
) )
@ -49,7 +49,7 @@ export const GET = async (req: Request) => {
data = ( data = (
await searchSearxng( await searchSearxng(
`site:${articleWebsites[Math.floor(Math.random() * articleWebsites.length)]} ${topics[Math.floor(Math.random() * topics.length)]}`, `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; ).results;
} }

View file

@ -6,6 +6,7 @@ interface SearxngSearchOptions {
engines?: string[]; engines?: string[];
language?: string; language?: string;
pageno?: number; pageno?: number;
time_range?: string[];
} }
interface SearxngSearchResult { interface SearxngSearchResult {