fix google pse
i tested everything, also tested if invalid api key and such and regression tested searxng which still works
This commit is contained in:
parent
4d41243108
commit
7a816efc04
4 changed files with 29 additions and 39 deletions
|
|
@ -6,9 +6,8 @@ import logger from '../utils/logger';
|
|||
|
||||
const router = express.Router();
|
||||
|
||||
const searchEngine = getSearchEngineBackend();
|
||||
|
||||
async function performSearch(query: string, site: string, searchEngine: string) {
|
||||
async function performSearch(query: string, site: string) {
|
||||
const searchEngine = getSearchEngineBackend();
|
||||
switch (searchEngine) {
|
||||
case 'google': {
|
||||
const googleResult = await searchGooglePSE(query);
|
||||
|
|
@ -65,7 +64,7 @@ router.get('/', async (req, res) => {
|
|||
queries.map(async ({ site, topic }) => {
|
||||
try {
|
||||
const query = `site:${site} ${topic}`;
|
||||
return await performSearch(query, site, searchEngine);
|
||||
return await performSearch(query, site);
|
||||
} catch (error) {
|
||||
logger.error(`Error searching ${site}: ${error.message}`);
|
||||
return [];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue