2019-06-11 18:16:59 +02:00
|
|
|
const se_scraper = require('./../src/node_scraper.js');
|
2019-01-30 23:53:09 +01:00
|
|
|
|
2019-06-11 18:16:59 +02:00
|
|
|
(async () => {
|
|
|
|
let browser_config = {
|
2019-07-07 19:38:28 +02:00
|
|
|
debug_level: 1,
|
2019-07-06 21:42:13 +02:00
|
|
|
test_evasion: false,
|
2019-07-18 19:34:09 +02:00
|
|
|
log_http_headers: true,
|
2019-08-12 16:05:17 +02:00
|
|
|
log_ip_address: true,
|
|
|
|
random_user_agent: false,
|
2019-07-18 20:19:15 +02:00
|
|
|
apply_evasion_techniques: true,
|
2019-08-12 16:05:17 +02:00
|
|
|
screen_output: false,
|
|
|
|
html_output: true,
|
|
|
|
clean_html_output: true,
|
|
|
|
compress: true,
|
2019-06-11 18:16:59 +02:00
|
|
|
};
|
2019-01-30 23:53:09 +01:00
|
|
|
|
2019-06-11 18:16:59 +02:00
|
|
|
let scrape_job = {
|
2019-07-11 19:23:40 +02:00
|
|
|
search_engine: 'google',
|
2019-08-12 16:05:17 +02:00
|
|
|
keywords: ['buy a nice car'],
|
2019-06-11 18:16:59 +02:00
|
|
|
num_pages: 1,
|
2019-07-18 19:34:09 +02:00
|
|
|
google_settings: {
|
|
|
|
"gl": "us",
|
|
|
|
"hl": "en",
|
|
|
|
"start": 0,
|
|
|
|
"num": 10
|
|
|
|
}
|
2019-06-11 18:16:59 +02:00
|
|
|
};
|
2019-01-30 23:53:09 +01:00
|
|
|
|
2019-06-11 18:16:59 +02:00
|
|
|
var scraper = new se_scraper.ScrapeManager(browser_config);
|
|
|
|
|
|
|
|
await scraper.start();
|
|
|
|
|
|
|
|
var results = await scraper.scrape(scrape_job);
|
|
|
|
|
|
|
|
console.dir(results, {depth: null, colors: true});
|
|
|
|
|
|
|
|
await scraper.quit();
|
|
|
|
})();
|