se-scraper/index.js

24 lines
570 B
JavaScript
Raw Permalink Normal View History

2019-06-11 18:16:59 +02:00
const se_scraper = require('./src/node_scraper.js');
var Scraper = require('./src/modules/se_scraper');
2018-12-24 14:25:02 +01:00
async function scrape(browser_config, scrape_config) {
// scrape config overwrites the browser_config
Object.assign(browser_config, scrape_config);
var scraper = new se_scraper.ScrapeManager(browser_config);
2018-12-24 14:25:02 +01:00
2019-06-11 18:16:59 +02:00
await scraper.start();
2018-12-24 14:25:02 +01:00
2019-06-11 18:16:59 +02:00
var results = await scraper.scrape(scrape_config);
2018-12-24 14:25:02 +01:00
2019-06-11 18:16:59 +02:00
await scraper.quit();
2018-12-24 14:25:02 +01:00
2019-06-11 18:16:59 +02:00
return results;
}
2019-06-11 18:16:59 +02:00
module.exports = {
scrape: scrape,
ScrapeManager: se_scraper.ScrapeManager,
Scraper: Scraper,
2018-12-24 14:25:02 +01:00
};