From 82ad5716b31d7a69db11a5063e278126ca2b0b1f Mon Sep 17 00:00:00 2001 From: Memo Chou Date: Sat, 3 Feb 2024 21:51:47 +0800 Subject: [PATCH] Fix params of serpapi --- .env.example | 1 - config/index.js | 3 +-- services/serpapi.js | 6 ++---- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.env.example b/.env.example index a5c6e381..e7f75f0f 100644 --- a/.env.example +++ b/.env.example @@ -43,4 +43,3 @@ LINE_CHANNEL_SECRET= SERPAPI_TIMEOUT= SERPAPI_API_KEY= SERPAPI_LOCATION= -SERPAPI_LANG= diff --git a/config/index.js b/config/index.js index ec90b367..ba16065e 100644 --- a/config/index.js +++ b/config/index.js @@ -47,8 +47,7 @@ const config = Object.freeze({ LINE_CHANNEL_SECRET: env.LINE_CHANNEL_SECRET || null, SERPAPI_TIMEOUT: env.SERPAPI_TIMEOUT || env.APP_API_TIMEOUT, SERPAPI_API_KEY: env.SERPAPI_API_KEY || null, - SERPAPI_LOCATION: env.SERPAPI_LOCATION || 'Taiwan', - SERPAPI_LANG: env.SERPAPI_LANG || 'lang_zh-TW', + SERPAPI_LOCATION: env.SERPAPI_LOCATION || 'tw', }); export default config; diff --git a/services/serpapi.js b/services/serpapi.js index 691c0ede..43b4eefe 100644 --- a/services/serpapi.js +++ b/services/serpapi.js @@ -26,13 +26,11 @@ client.interceptors.response.use(handleFulfilled, (err) => { }); const search = ({ - lr = config.SERPAPI_LOCATION, - location = config.SERPAPI_LOCATION, + gl = config.SERPAPI_LOCATION, q, }) => client.get('/search', { params: { - lr, - location, + gl, q, }, });