Web Page Snapshot

The chrome_snap plugin relies on having Google Chrome browser installed beforehand.

The following recipe demonstrates how to capture two web pages and save them as image files using the chrome_snap plugin.

Static Target Recipe

example.toml

#[log]
#    path = "-"
#    level = "debug"
[[inlets.file]]
    data = [
        '{"url":"https://tine.thingsme.xyz", "dst_path":"./chrome_snap_tine_docs.png"}', 
        '{"url":"https://github.com/OutOfBedlam/tine", "dst_path":"./chrome_snap_tine_github.png"}', 
    ]
    format = "json"
[[flows.chrome_snap]]
    url_field = "url"
    out_field = "snap"
    timeout = "15s"
[[outlets.image]]
    path_field = "dst_path"
    image_fields = ["snap"]
    overwrite = true

Run

$ ./tine run ./example.toml

Output

User Input Recipe

example.toml

#!/path/to/tine run

#[log]
#    path = "-"
#    level = "info"
[[inlets.args]]
[[flows.chrome_snap]]
    url_field = "url"
    out_field = "snap"
    timeout = "15s"
[[outlets.image]]
    path_field = "out"
    image_fields = ["snap"]
    overwrite = true

Run

$ chmod +x example.toml

$ ./example.toml -- url=https://github.com out=./out.png

$ ls -l out.png

Last updated