Screenshot

overview page of web interface
Screenshot tab of log inspection
This feature require Javascript Rendering enabled

Introduction

You can take multiple screenshot of a webpage. You have choice between full page or specific zone via css selector.

Screenshot feature work beside the scraper, it means you can still scrape as regular and use screenshots features. The upstream response is not altered with screenshot.

Screenshot can help you to debug, track visual changes, generate thumbnail of website.

You can take a maximum of 10 different screenshots per scrape.

Example

In this example, we take 3 screenshots. One full page, and two others via css selector

Interactive Example: Amazon Example
openapi openapi Amazon Example Sign in
            curl -X GET https://api.scrapfly.io/scrape?key=__API_KEY__&url=https%3A%2F%2Fwww.amazon.fr%2FMikroTik-CRS305-1G-4S-Interrupteur-Ethernet-routerOS%2Fdp%2FB07LFKGP1L&render_js=true&screenshots%5Bfull-page%5D=fullpage&screenshots%5Bsimilarities%5D=.similarities-widget&screenshots%5Bprice%5D=%23price
        
HTTP Call Pretty Print
https://api.scrapfly.io/scrape?key=&url=https%3A%2F%2Fwww.amazon.fr%2FMikroTik-CRS305-1G-4S-Interrupteur-Ethernet-routerOS%2Fdp%2FB07LFKGP1L&render_js=true&screenshots%5Bfull-page%5D=fullpage&screenshots%5Bsimilarities%5D=.similarities-widget&screenshots%5Bprice%5D=%23price

key
=
url
= https%3A%2F%2Fwww.amazon.fr%2FMikroTik-CRS305-1G-4S-Interrupteur-Ethernet-routerOS%2Fdp%2FB07LFKGP1L
render_js
= true
screenshots[full-page]
= fullpage
screenshots[similarities]
= .similarities-widget
screenshots[price]
= %23price
openapi openapi Amazon Result Example | Json
            {
    ...
    "result": {
        ...
        "screenshots": {
            "main": {
                "extension": "png",
                "format": "fullpage",
                "css_selector": null,
                "size": 2867974,
                "url": "https://scrapfly.io/4d1b8e8f-3803-4aa6-88fa-39d5aa81b6b3/scrape/screenshot/db475202-a7c0-4d7b-9179-98089901fce3/main"
            },
            "similarities": {
                "extension": "png",
                "format": "element",
                "css_selector": ".similarities-widget",
                "size": 109817,
                "url": "https://scrapfly.io/4d1b8e8f-3803-4aa6-88fa-39d5aa81b6b3/scrape/screenshot/db475202-a7c0-4d7b-9179-98089901fce3/similarities"
            },
            "price": {
                "extension": "png",
                "format": "element",
                "css_selector": "#price",
                "size": 10364,
                "url": "https://scrapfly.io/4d1b8e8f-3803-4aa6-88fa-39d5aa81b6b3/scrape/screenshot/db475202-a7c0-4d7b-9179-98089901fce3/price"
            }
        }
        ...
    }
    ...
}

        

Errors

In some situation, screenshot system wont be able to take it. For many reason:

  • Huge page : Require a large amount of memory - to keep our service stable we prefer shutdown the rendering
  • Broken script : For unknown reason at time, when web pages contains bugged / no well scripted javascript, rendering system might crash

In case of error API will return you error code : ERR::SCRAPE::UNABLE_TO_TAKE_SCREENSHOT

Integration