by dotancohen · 2y ago · 0 comments
I'm on mobile so don't have access to my notes, but I'm pretty sure that a year ago when I tried there was no reliable way to screenshot e.g. the BBC news website without getting the popups.
Again, thank you.
shot-scraper -h 800 'https://www.spiegel.de/international/' \
--wait-for "() => {
const div = document.querySelector('[id^="sp_message_container"]');
if (div) {
div.remove();
return true;
}
}"
shot-scraper runs that --wait-for script until it returns true. In this case we're waiting for the cookie consent overlay div to show up and then removing it before we take the screenshot.Screenshots here: https://gist.github.com/simonw/de75355c39025f9a64548aa3366b1...
It's quite a painful problem and we screenshot many millions of sites a day, our success rate at detecting these is high but still not 100%.
We have gotten quite far with heuristics and are exploring whether we can get better results by training a model.
Can the API provide a custom tag, comment or ID which will then be inserted in the output? Like in JPEG EXIF, PNG also knows Metadata, PDF description, HTML meta tag?
You could append a new meta tag by running some custom JS to add it, but we don't modify exif, metadata or pdf description at the moment.