playwright-snapper
Usage
- Preferably set up a virtualenv, as you do for a Python project.
- Install
playwright
:pip install playwright
playwright install
- Run the script:
python playwright-snapper.py -d snapshots https://akx.github.io
snapshots/
will now contain PNG and PDF files.- The script will not overwrite pre-existing files.
Shell protip!
To run the script against multiple URLs in a text file, use xargs
:
cat urls.txt | xargs python playwright-snapper.py -d snapshots
TODO
Pull requests welcome. :-)
- This script could be made more efficient by not using
playwright screenshot
etc., but the Playwright Python API instead, so the same session is used for both the screenshot and the PDF. - The script could be made multi-threaded, so each URL is processed in parallel.