Tool for taking automated screenshots
Project description
shot-scraper
Tool for taking automated screenshots
Installation
Install this tool using pip
:
pip install shot-scraper
This tool depends on Playwright, which first needs to install its own dedicated browser.
Run shot-scraper install
once to install that:
% shot-scraper install
Downloading Playwright build of chromium v965416 - 117.2 Mb [====================] 100% 0.0s
Playwright build of chromium v965416 downloaded to /Users/simon/Library/Caches/ms-playwright/chromium-965416
Downloading Playwright build of ffmpeg v1007 - 1.1 Mb [====================] 100% 0.0s
Playwright build of ffmpeg v1007 downloaded to /Users/simon/Library/Caches/ms-playwright/ffmpeg-1007
Taking a screenshot
To take a screenshot of a web page and write it to screenshot.png
run this:
shot-scraper https://datasette.io/ -o screenshot.png
If you omit the -o
the screenshot PNG binary will be output by the tool, so you can pipe it or redirect it to a file:
shot-scraper https://datasette.io/ > datasette.png
Screenshots default to being 1280px wide and as long as needed to capture the full page.
Taking multiple screenshot
You can configure multiple screenshots using a YAML file. Create a file called shots.yml
that looks like this:
- output: example.com.png
url: http://www.example.com/
- output: w3c.org.png
url: https://www.w3.org/
Then run the tool like so:
shot-scraper multi shots.yml
This will create two image files, example.com.png
and w3c.org.png
, containing screenshots of those two URLs.
Development
To contribute to this tool, first checkout the code. Then create a new virtual environment:
cd shot-scraper
python -m venv venv
source venv/bin/activate
Or if you are using pipenv
:
pipenv shell
Now install the dependencies and test dependencies:
pip install -e '.[test]'
To run the tests:
pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file shot-scraper-0.1.tar.gz
.
File metadata
- Download URL: shot-scraper-0.1.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45f492938b9c266a14770a5964b5b0c7c8baed8b4bdc347712e024262807161b |
|
MD5 | a9c7ca989d276e9898448cc24ce0a23f |
|
BLAKE2b-256 | 098bd02f3031f10e0b18f4087c44d34733414c57573aa14e07dbd7967d2d9ef2 |
File details
Details for the file shot_scraper-0.1-py3-none-any.whl
.
File metadata
- Download URL: shot_scraper-0.1-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab08db0453190fe10f9fd743e2cc708a0b7296198ac55e65316d25e3d8f53ba7 |
|
MD5 | 4ab3e61246fcfde626704272b05c932f |
|
BLAKE2b-256 | fa932daac2824283053c06c5c5945cd7a94c466a6cc6ed5447b5ee9c1f037ad4 |