se-scraper/examples/gnold.js

27 lines
932 B
JavaScript
Raw Permalink Normal View History

2019-06-11 18:16:59 +02:00
const se_scraper = require('./../src/node_scraper.js');
2019-06-11 18:16:59 +02:00
(async () => {
let browser_config = {
output_file: 'examples/results/gnold.json',
google_news_old_settings: {
gl: 'us', // The gl parameter determines the Google country to use for the query.
hl: 'fr', // The hl parameter determines the Google UI language to return results.
start: 0, // Determines the results offset to use, defaults to 0.
num: 100, // Determines the number of results to show, defaults to 10. Maximum is 100.
},
};
2019-06-11 18:16:59 +02:00
let scrape_job = {
search_engine: 'google_news_old',
keywords: ['news world'],
num_pages: 1,
};
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();
})();