2019-06-11 18:16:59 +02:00
|
|
|
const se_scraper = require('./src/node_scraper.js');
|
2019-06-13 12:34:39 +02:00
|
|
|
var Scraper = require('./src/modules/se_scraper');
|
2018-12-24 14:25:02 +01:00
|
|
|
|
2019-06-13 12:34:39 +02:00
|
|
|
async function scrape(browser_config, scrape_config) {
|
|
|
|
// scrape config overwrites the browser_config
|
|
|
|
Object.assign(browser_config, scrape_config);
|
2019-02-07 16:09:38 +01:00
|
|
|
|
2019-06-13 12:34:39 +02:00
|
|
|
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-02-27 20:58:13 +01:00
|
|
|
|
2019-06-11 18:16:59 +02:00
|
|
|
module.exports = {
|
|
|
|
scrape: scrape,
|
|
|
|
ScrapeManager: se_scraper.ScrapeManager,
|
2019-06-13 12:34:39 +02:00
|
|
|
Scraper: Scraper,
|
2018-12-24 14:25:02 +01:00
|
|
|
};
|