Learn R Programming

screenshotbase (version 0.1.0)

screenshotbase_take: Take a website screenshot

Description

Renders a website and returns raw image bytes.

Usage

screenshotbase_take(
  url,
  format = NULL,
  quality = NULL,
  full_page = NULL,
  viewport_width = NULL,
  viewport_height = NULL,
  apikey = NULL
)

Value

A raw vector of the image content.

Arguments

url

URL of the website to render (required).

format

Image format: one of "png", "jpg", "jpeg", "gif".

quality

Integer quality for jpg/jpeg (defaults to 80 on server if not set).

full_page

Logical; capture full page.

viewport_width, viewport_height

Integers for viewport size in pixels.

apikey

Optional API key to override the session key.

Examples

Run this code
if (FALSE) {
set_api_key("YOUR-API-KEY")
bytes <- screenshotbase_take("https://bbc.com", format = "png", full_page = TRUE)
writeBin(bytes, "screenshot.png")
}

Run the code above in your browser using DataLab