-
Notifications
You must be signed in to change notification settings - Fork 3
poc: Generate thumbnail with playwright #494
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
}); | ||
const page = await context.newPage(); | ||
|
||
await context.addCookies([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potentially we could inpersonate a user to get a thumbnail of their private data, it seems that this is not needed for the first iteration
|
||
fs.writeFile(outputPath, screenshotBuffer, (err) => { | ||
if (err) { | ||
console.error('Error saving screenshot:', err); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console.error('Error saving screenshot:', err); | |
console.error('Error saving screenshot to ${outputPath}:', err); |
// sharp(screenshotBuffer) | ||
// .resize(200, 150) // Set the thumbnail dimensions here | ||
// .toFile(outputPath, (err, info) => { | ||
// if (err) { | ||
// console.error('Error generating thumbnail:', err); | ||
// } else { | ||
// console.log('Thumbnail generated successfully:', info); | ||
// } | ||
// }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: what's this for? can it be removed?
}, | ||
]); | ||
|
||
await page.goto('https://app.staging.terraso.net/tools/story-maps/f2xs943/ecuador-2'); // Replace with the URL of the website you want to capture |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await page.goto('https://app.staging.terraso.net/tools/story-maps/f2xs943/ecuador-2'); // Replace with the URL of the website you want to capture | |
await page.goto(pageUrl); |
const sharp = require('sharp'); | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const pageUrl = 'https://app.staging.terraso.net/tools/story-maps/f2xs943/ecuador-2'; // Replace with the URL of the website you want to capture | |
Description