Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ class PuppeteerPlugin {
await page.close();

// convert utf-8 -> binary string because website-scraper needs binary
return Buffer.from(content).toString('binary');
// https://github.com/website-scraper/node-website-scraper?tab=readme-ov-file#afterresponse: (binary) This is advised against because of the binary assumption being made can foul up saving of utf8 responses to the filesystem.
return {
body: content,
encoding: 'utf8'
Copy link
Member

@aivus aivus Aug 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@s0ph1e Should we do the same we did in website-scraper?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @azlarsin,
thank you for your contribution 👍 and sorry for the very late response from my side.

Hi @aivus,
thank you for pinging me. I think, it's a good idea to use the same approach, that already exists in the main module. It would also be nice to have some tests for it (we can use an example in the PR comment).

};
} else {
return response.body;
}
Expand Down