Skip to content

Commit 5bd9e46

Browse files
author
Benoist Bouteiller
committed
feat(*): add custom url
1 parent 92817b3 commit 5bd9e46

File tree

4 files changed

+7
-32
lines changed

4 files changed

+7
-32
lines changed

src/modules/duckduckgo.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,8 @@ class DuckduckgoScraper extends Scraper {
4646

4747
async load_start_page() {
4848
debug('load_start_page');
49-
let startUrl = 'https://duckduckgo.com/';
50-
51-
this.last_response = await this.page.goto(startUrl);
49+
this.last_response = await this.page.goto(this.startUrl);
5250
await this.page.waitForSelector('input[name="q"]', { timeout: this.STANDARD_TIMEOUT });
53-
5451
return true;
5552
}
5653

src/modules/google.js

+2-20
Original file line numberDiff line numberDiff line change
@@ -213,26 +213,8 @@ class GoogleScraper extends Scraper {
213213
}
214214

215215
async load_start_page() {
216-
let startUrl = 'https://www.google.com';
217-
218-
if (this.config.google_settings) {
219-
startUrl = `https://www.${this.config.google_settings.google_domain}/search?q=`;
220-
if (this.config.google_settings.google_domain) {
221-
startUrl = `https://www.${this.config.google_settings.google_domain}/search?`;
222-
} else {
223-
startUrl = `https://www.google.com/search?`;
224-
}
225-
226-
for (var key in this.config.google_settings) {
227-
if (key !== 'google_domain') {
228-
startUrl += `${key}=${this.config.google_settings[key]}&`
229-
}
230-
}
231-
}
232-
233-
this.logger.info('Using startUrl: ' + startUrl);
234-
235-
this.last_response = await this.page.goto(startUrl);
216+
this.logger.info('Using startUrl: ' + this.startUrl);
217+
this.last_response = await this.page.goto(this.startUrl);
236218

237219
await this.page.waitForSelector('input[name="q"]', { timeout: this.STANDARD_TIMEOUT });
238220

src/modules/infospace.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,8 @@ class InfospaceScraper extends Scraper {
4141
}
4242

4343
async load_start_page() {
44-
45-
let startUrl = this.build_start_url('http://search.infospace.com/search/web?') || 'http://infospace.com/index.html';
46-
4744
try {
48-
this.last_response = await this.page.goto(startUrl);
45+
this.last_response = await this.page.goto(this.this.startUrl);
4946
await this.page.waitForSelector('input[name="q"]', { timeout: 5000 });
5047
} catch (e) {
5148
return false;

src/modules/yandex.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,10 @@ class YandexScraper extends Scraper {
7171
}
7272

7373
async load_start_page() {
74-
let startUrl = 'https://yandex.com';
74+
75+
this.logger.info('Using startUrl: ' + this.startUrl);
7576

76-
this.logger.info('Using startUrl: ' + startUrl);
77-
78-
this.last_response = await this.page.goto(startUrl);
77+
this.last_response = await this.page.goto(this.startUrl);
7978

8079
await this.page.waitForSelector('input[name="text"]', { timeout: this.STANDARD_TIMEOUT });
8180

0 commit comments

Comments
 (0)