Fixed screenshot capture
This commit is contained in:
@@ -10,7 +10,7 @@ puppeteer.use(StealthPlugin());
|
|||||||
* @param {string} screenshotPath - Path where the screenshot should be saved.
|
* @param {string} screenshotPath - Path where the screenshot should be saved.
|
||||||
* @returns {Promise<object>} - Metadata including title, description, keywords, language, and HTTP status.
|
* @returns {Promise<object>} - Metadata including title, description, keywords, language, and HTTP status.
|
||||||
*/
|
*/
|
||||||
async function scrapePage(url, screenshotPath, { screenshot = true }) {
|
async function scrapePage(url, screenshotPath) {
|
||||||
console.log(`🔍 Scraping: ${url}`);
|
console.log(`🔍 Scraping: ${url}`);
|
||||||
|
|
||||||
const browser = await puppeteer.launch({
|
const browser = await puppeteer.launch({
|
||||||
@@ -90,7 +90,7 @@ async function scrapePage(url, screenshotPath, { screenshot = true }) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
if (screenshot && screenshotPath) {
|
if (screenshotPath) {
|
||||||
await page.screenshot({ path: screenshotPath, fullPage: true });
|
await page.screenshot({ path: screenshotPath, fullPage: true });
|
||||||
console.log(`✔ Screenshot saved: ${screenshotPath}`);
|
console.log(`✔ Screenshot saved: ${screenshotPath}`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user