更新了新的Bing search customer API支持

This commit is contained in:
TianlinLiang 2024-07-04 14:08:09 +08:00
parent 5885111183
commit e5a1082359
2 changed files with 5 additions and 5 deletions

View File

@ -48,7 +48,7 @@ pnpm install
PORT: 3000,
};
```
如果您注册的是Bing Customer Search的API您可以修改您的配置文件如下并且填写您的Custom Configuration ID:
如果您注册的是Bing Customer Search的API您可以修改您的配置文件如下并且填写您的Custom Configuration ID:
```diff
export default {
@ -57,7 +57,7 @@ pnpm install
BROWSER_TIMEOUT: 10000,
BING_SEARCH_API_URL: 'https://api.bing.microsoft.com/v7.0/custom/',
BING_SEARCH_API_KEY: 'YOUR_BING_SEARCH_API_KEY',
CUSTOM_CONFIG_ID : 'YOUR_CUSTOM_CONFIG_ID', //将的Custom Configuration ID放在此处
CUSTOM_CONFIG_ID : 'YOUR_CUSTOM_CONFIG_ID', //将的Custom Configuration ID放在此处
HOST: 'localhost',
PORT: 3000,
};

View File

@ -172,9 +172,9 @@ abstract class BaseBrowser {
logger.debug(`Searching for: ${query}`);
const search = new URLSearchParams({ q: query });
recency_days > 0 && search.append('recency_days', recency_days.toString());
if (config.CUSTOM_CONFIG_ID !== undefined) {
search.append('customconfig', config.CUSTOM_CONFIG_ID);
}
if (config.CUSTOM_CONFIG_ID) {
search.append('customconfig', config.CUSTOM_CONFIG_ID.toString());
}
const url = `${config.BING_SEARCH_API_URL}/search?${search.toString()}`;
console.log('Full URL:', url); // 输出完整的 URL查看是否正确