Skip to main content

Screenshots

OmniScrape can return a screenshot of the fully rendered page, which is useful for visual monitoring, archiving, and verifying what a page looked like at scrape time. Screenshots require a browser, so they run in js_rendering.

Capturing a screenshot

Set screenshot: true. The image comes back as a base64-encoded PNG in data.screenshot.

{
"url": "https://example.com",
"mode": "js_rendering",
"screenshot": true,
"screenshot_type": "fullpage"
}

Screenshot types

screenshot_typeCaptures
viewport (default)Just the visible viewport
fullpageThe entire scrollable page
elementA single element (pair with a selector)

Saving the image

import base64, os, requests

resp = requests.post(
"https://api.omniscrape.io/v1/scrape",
headers={"X-API-Key": os.environ["OMNISCRAPE_KEY"]},
json={
"url": "https://example.com",
"mode": "js_rendering",
"screenshot": True,
"screenshot_type": "fullpage",
},
timeout=120,
)

img = resp.json()["data"]["screenshot"]
with open("page.png", "wb") as f:
f.write(base64.b64decode(img))

Combining with data extraction

You can capture a screenshot and extract fields in the same request — handy for monitoring where you want both the numbers and visual proof.

{
"url": "https://shop.example.com/p/1",
"mode": "js_rendering",
"css_selectors": { "price": ".price-amount" },
"screenshot": true
}
note

Full-page screenshots of long pages produce large base64 strings. If you only need the top of the page, viewport is much smaller and faster.