Merge pull request #62 from aularon/patch-1

Take screenshot before modifying HTML
This commit is contained in:
Nikolai Tschacher 2020-02-13 20:04:20 +01:00 committed by GitHub
commit 33fa371716
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -193,6 +193,13 @@ module.exports = class Scraper {
let parsed = this.parse(html);
this.results[keyword][this.page_num] = parsed ? parsed : await this.parse_async(html);
if (this.config.screen_output) {
this.results[keyword][this.page_num].screenshot = await this.page.screenshot({
encoding: 'base64',
fullPage: false,
});
}
if (this.config.html_output) {
if (this.config.clean_html_output) {
@ -239,13 +246,6 @@ module.exports = class Scraper {
this.results[keyword][this.page_num].html = html_contents;
}
if (this.config.screen_output) {
this.results[keyword][this.page_num].screenshot = await this.page.screenshot({
encoding: 'base64',
fullPage: false,
});
}
this.page_num += 1;
// only load the next page when we will pass the next iteration