shot-scraper

shot-scraper is a tool to automate the process of updating screenshots.

Installation

$ python -m pip install shot-scraper
$ shot-scraper install

Note

The second line installs the required browser.

Use

shot-scraper can be used in two ways

  1. …for single screenshots on the command line:

    $  shot-scraper https://jupyter-tutorial.readthedocs.io/de/latest/clean-prep/index.html -o ~/Downloads/clean-prep.png
    

    …or with additional options, e.g. for JavaScript and CSS selectors:

    $ shot-scraper https://jupyter-tutorial.readthedocs.io/de/latest/clean-prep/index.html -s '#overview' -o ~/Downloads/clean-prep.png
    
  2. …for a set of screenshots configured in a YAML file:

    - url: https://jupyter-tutorial.readthedocs.io/de/latest/clean-prep/index.html
      output: ~/Downloads/clean-prep.png
    - url: https://www.example.org/
      width: 736
      quality: 40
      output: example.jpg
    

    Afterwards shot-scraper multi can be used, for example:

    $ shot-scraper multi shots.yaml
    Screenshot of 'https://jupyter-tutorial.readthedocs.io/de/latest/clean-prep/index.html' written to '~(Downloads/clean-prep.png'
    Screenshot of 'https://www.example.org/' written to 'example.jpg'
    

    See also

    • In the README.md file you will find a complete overview of the possible options.

    • In the shot-scraper-demo repository you will find a much more comprehensive shots.yaml file.

GitHub Actions

shot-scraper can be easily integrated into GitHub Actions. The shot-scraper-demo repository also contains an examplary shots.yml. Once a day, two screenshots are created and transferred back to the repository. Note, however, that saving image files that change frequently can make the revision history very unreadable. Therefore, you should use shot-scraper with caution together with GitHub Actions.