11shot-scraper
22============
33
4- `shot-scraper <https://simonwillison.net/2022/Mar/10/ shot-scraper/ >`_ is a tool
5- to automate the process of updating screenshots.
4+ `shot-scraper <https://shot-scraper.datasette.io/en/stable/ >`_ is a tool to
5+ automate the process of updating screenshots.
66
77Installation
88------------
@@ -15,50 +15,77 @@ Installation
1515 .. note ::
1616 The second line installs the required browser.
1717
18+ .. seealso ::
19+ `shot-scraper Installation
20+ <https://shot-scraper.datasette.io/en/stable/installation.html> `_
21+
1822Use
1923---
2024
21- shot-scraper can be used in two ways
25+ shot-scraper can be used in several ways
2226
2327#. …for single screenshots on the command line:
2428
2529 .. code-block :: console
2630
27- $ shot-scraper https://jupyter-tutorial.readthedocs.io/de/latest/clean-prep/index.html -o ~/Downloads/clean-prep.png
31+ $ uv run shot-scraper https://jupyter-tutorial.readthedocs.io/de/latest/clean-prep/index.html -o ~/Downloads/clean-prep.png
2832
29- …or with additional options, e.g. for JavaScript and CSS selectors:
33+ …or with additional options, for example for JavaScript and CSS selectors:
3034
31- .. code-block ::
35+ .. code-block :: console
3236
33- $ shot-scraper https://jupyter-tutorial.readthedocs.io/de/latest/clean-prep/index.html -s '#overview' -o ~/Downloads/clean-prep.png
37+ $ uv run shot-scraper https://jupyter-tutorial.readthedocs.io/de/latest/clean-prep/index.html -s '#overview' -o ~/Downloads/clean-prep.png
3438
3539 #. …for a set of screenshots configured in a YAML file:
3640
3741 .. code-block :: yaml
3842
39- - url : https://jupyter-tutorial.readthedocs.io/de/latest/clean-prep/index.html
40- output : ~/Downloads/clean-prep.png
41- - url : https://www.example.org/
42- width : 736
43- quality : 40
44- output : example.jpg
43+ - url : https://jupyter-tutorial.readthedocs.io/de/latest/clean-prep/index.html
44+ output : ~/Downloads/clean-prep.png
45+ - url : https://www.example.org/
46+ width : 736
47+ quality : 40
48+ output : example.jpg
4549
4650 Afterwards ``shot-scraper multi `` can be used, for example:
4751
4852 .. code-block :: console
4953
50- $ shot-scraper multi shots.yaml
51- Screenshot of 'https://jupyter-tutorial.readthedocs.io/de/latest/clean-prep/index.html' written to '~(Downloads/clean-prep.png'
52- Screenshot of 'https://www.example.org/' written to 'example.jpg'
54+ $ shot-scraper multi shots.yaml
55+ Screenshot of 'https://jupyter-tutorial.readthedocs.io/de/latest/clean-prep/index.html' written to '~(Downloads/clean-prep.png'
56+ Screenshot of 'https://www.example.org/' written to 'example.jpg'
57+
58+ .. seealso ::
59+ * `Taking multiple screenshots
60+ <https://shot-scraper.datasette.io/en/stable/multi.html> `_
61+
62+ #. …for videos:
63+
64+ The ``shot-scraper video `` command captures a WebM video based on a
65+ :doc: `Python4DataScience:data-processing/serialisation-formats/yaml/index `
66+ storyboard. Storyboards describe the video as a sequence of scenes. Each
67+ scene can open a page, wait for content, perform actions and pause between
68+ steps, for example:
69+
70+ .. literalinclude :: storyboard.yml
71+ :caption: storyboard.yml
72+ :language: yaml
73+
74+ Then run the following command:
75+
76+ .. code-block :: console
77+
78+ $ uv run shot-scraper video storyboard.yml
79+
80+ This opens ``url ``, records the scenes and saves the video as
81+ :file: `demo.webm `.
82+
83+ As long as `FFmpeg <https://www.ffmpeg.org/ >`_ is installed, you can use the
84+ ``--mp4 `` option to convert the recorded WebM video to MP4 as well.
5385
5486 .. seealso ::
55- * In the `README.md
56- <https://github.com/simonw/shot-scraper/blob/main/README.md> `_ file you
57- will find a complete overview of the possible options.
58- * In the shot-scraper-demo repository you will find a much more
59- comprehensive `shots.yaml
60- <https://github.com/simonw/shot-scraper-demo/blob/main/.github/workflows/shots.yml> `_
61- file.
87+ * `Recording videos
88+ <https://shot-scraper.datasette.io/en/stable/video.html> `_
6289
6390GitHub Actions
6491--------------
0 commit comments