mirror of
https://github.com/NikolaiT/se-scraper.git
synced 2025-06-20 17:47:49 +02:00
Remove uneeded try catch block in Google Search module
This commit is contained in:
parent
0db6e068da
commit
dde2b14fc0
@ -1,3 +1,4 @@
|
|||||||
|
'use strict';
|
||||||
const cheerio = require('cheerio');
|
const cheerio = require('cheerio');
|
||||||
const Scraper = require('./se_scraper');
|
const Scraper = require('./se_scraper');
|
||||||
const common = require('./common.js');
|
const common = require('./common.js');
|
||||||
@ -175,11 +176,7 @@ class GoogleScraper extends Scraper {
|
|||||||
|
|
||||||
this.last_response = await this.page.goto(startUrl);
|
this.last_response = await this.page.goto(startUrl);
|
||||||
|
|
||||||
try {
|
|
||||||
await this.page.waitForSelector('input[name="q"]', { timeout: this.STANDARD_TIMEOUT });
|
await this.page.waitForSelector('input[name="q"]', { timeout: this.STANDARD_TIMEOUT });
|
||||||
} catch (e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -253,12 +250,9 @@ class GoogleNewsOldScraper extends Scraper {
|
|||||||
async load_start_page() {
|
async load_start_page() {
|
||||||
let startUrl = this.build_start_url('https://www.google.com/search?source=lnms&tbm=nws&') || 'https://www.google.com/search?source=lnms&tbm=nws';
|
let startUrl = this.build_start_url('https://www.google.com/search?source=lnms&tbm=nws&') || 'https://www.google.com/search?source=lnms&tbm=nws';
|
||||||
|
|
||||||
try {
|
|
||||||
await this.page.goto(startUrl);
|
await this.page.goto(startUrl);
|
||||||
await this.page.waitForSelector('input[name="q"]', { timeout: this.STANDARD_TIMEOUT });
|
await this.page.waitForSelector('input[name="q"]', { timeout: this.STANDARD_TIMEOUT });
|
||||||
} catch (e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user