forked from extern/se-scraper
Use bing_setting.bing_domain if defined for startUrl
This commit is contained in:
parent
a3ebe357a4
commit
a0e63aa4b0
@ -47,6 +47,21 @@ class BingScraper extends Scraper {
|
||||
async load_start_page() {
|
||||
let startUrl = this.build_start_url('https://www.bing.com/search?') || 'https://www.bing.com/';
|
||||
|
||||
if (this.config.bing_settings) {
|
||||
startUrl = `https://www.${this.config.bing_settings.bing_domain}/search?`;
|
||||
if (this.config.bing_settings.bing_domain) {
|
||||
startUrl = `https://www.${this.config.bing_settings.bing_domain}/search?`;
|
||||
} else {
|
||||
startUrl = `https://www.bing.com/search?`;
|
||||
}
|
||||
|
||||
for (var key in this.config.bing_settings) {
|
||||
if (key !== 'bing_domain') {
|
||||
startUrl += `${key}=${this.config.bing_settings[key]}&`
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
await this.page.goto(startUrl);
|
||||
await this.page.waitForSelector('input[name="q"]', { timeout: this.STANDARD_TIMEOUT });
|
||||
@ -171,4 +186,4 @@ class BingNewsScraper extends Scraper {
|
||||
module.exports = {
|
||||
BingNewsScraper: BingNewsScraper,
|
||||
BingScraper: BingScraper,
|
||||
};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user