Show HN: Instantly create a GitHub repository to take screenshots of a web page (simonwillison.net)
I built a GitHub repository template which automates the process of configuring a new repository to take web page screenshots using GitHub Actions.
You can try this out at https://github.com/simonw/shot-scraper-template
Use the https://github.com/simonw/shot-scraper-template/generate interface to create a new repository using that template, and paste the URL that you want to take screenshots of in as the "description" field.
The new repository will then configure itself using GitHub Actions, take the screenshot and save it back to the repo!
38 comments
[ 4.9 ms ] story [ 57.8 ms ] threadMy favourite so far is this one, which is taking screenshots of a variety of French news websites: https://github.com/ggtr1138/UneJournaux
Just to mention: The example of french news websites shows that popovers and consent forms are a serious problem for this kind of screenshotting.
Do you have any thoughts on how to best deal with them?
I felt a lot better about my git scraping work (https://simonwillison.net/2020/Oct/9/git-scraping/) after GitHub released https://next.github.com/projects/flat-data/ which was inspired by that work, as it feels like it's now acknowledged as an OK use of their platform.
I'm hoping people don't abuse shot-scraper too much in terms of saving huge binary files to free repositories - that's why I haven't yet included tips on running scheduled scrapers in the shot-scraper-template documentation.
HN post about this from yesterday (which failed to get any traction): https://news.ycombinator.com/item?id=30667588
I'll definitely investigate using this. I implemented my own MacGyver version of this basic functionality off selenium to grab screenshots for search.marginalia.nu/explore/random -- but that script is super sketchy and held together in with bubble gum and duct tape. Yours looks a lot better.
By the way, is there a way to extract favicons as well?
I wonder if there's a way to detect favicons just using JavaScript that runs against a page? Not sure if it's easy to detect /favicon.ico v.s. the various meta tags.
Yeah, maybe it's a pipe dream :-/ But even without them, it looks really useful!
I've been playing around with my own image-diff tool for this kind of thing, but it's not yet in a decent state: https://github.com/simonw/image-diff - there are other, better options out there such as https://github.com/mapbox/pixelmatch
Needle is an older system that did this using Selenium - updating that to work with Playwright (or Playwight via shot-scraper) would be an interesting project: https://github.com/python-needle/needle
"visual-regression": https://github.com/topics/visual-regression
Cypress.io can run in a CI job, does Time Travel, works with DevTools debugger, can take screenshots and [headless] video, and it looks like there's a visual regression testing thing for it: https://github.com/mjhea0/cypress-visual-regression https://docs.cypress.io/guides/overview/why-cypress#Features
I decided to set a height of 800 by default to avoid people accidentally saving 10MB+ images just because they were trying out the tool.
Edit: Sorry, I didn't see the author has replied you.
[0] https://github.com/simonw/shot-scraper-template#configuring-...
I'm thinking of connecting it to Zapier so that I can send the screenshot to some places.