Skip to content

Crawlee—A web scraping and browser automation library for Node.js to build reliable crawlers. In JavaScript and TypeScript. Extract data for AI, LLMs, RAG, or GPTs. Download HTML, PDF, JPG, PNG, and other files from websites. Works with Puppeteer, Playwright, Cheerio, JSDOM, and raw HTTP. Both headful and headless mode. With proxy rotation.

Fix saveSnapshot on local (#849)

Lukáš Křivkaf243864803d6
diff --git a/src/puppeteer_utils.js b/src/puppeteer_utils.js
index d240d5963..77f607b33 100644
--- a/src/puppeteer_utils.js
+++ b/src/puppeteer_utils.js
@@ -508,12 +508,12 @@ const saveSnapshot = async (page, options = {}) => {
const store = await openKeyValueStore(keyValueStoreName);
if (saveScreenshot) {
- const screenshotName = isAtHome() ? `${key}.jpg` : key;
+ const screenshotName = `${key}.jpg`;
const screenshotBuffer = await page.screenshot({ fullPage: true, screenshotQuality, type: 'jpeg' });
await store.setValue(screenshotName, screenshotBuffer, { contentType: 'image/jpeg' });
}
if (saveHtml) {
- const htmlName = isAtHome() ? `${key}.html` : key;
+ const htmlName = `${key}.html`;
const html = await page.content();
await store.setValue(htmlName, html, { contentType: 'text/html' });
}