This document describes the Scrape functionality/endpoint, its associated HTTP header options, and possible error responses.
Endpoint: service.headless-render-api.com
Scrape Path: /scrape/$URL
Example URL:
https://service.headless-render-api.com/scrape/https://example.com/
The target $URL
is obviously part of the path, but do not re-encode or re-escape it beyond what you'd enter into a browser URL field. Both UTF-8 encoding and percent-encoding are acceptable.
Related links:
X-Prerender-Token
curl --header "X-Prerender-Token: secret-token"
A scraping API. Try it in your browser: service.headless-render-api.com/scrape/https://example.com
cURL
curl https://service.headless-render-api.com/scrape/https://example.com/ > out.html
Node.js client
// npm install prerendercloud
const { body, meta, screenshot, statusCode, headers } = await prerendercloud.scrape("https://example.com/", {
withMetadata: true,
withScreenshot: true,
});
prerender-wait-extra-long
{ waitUntil: 'networkidle' }
. Useful for
pages that depend on AJAX/XHR that fire late or IPFS hosted pagescurl --header "Prerender-Wait-Extra-Long: true"
prerender-dont-wait-for-web-sockets
curl --header "prerender-dont-wait-for-web-sockets: true"
prerender-block-cookies
curl --header "prerender-block-cookies: true"
prerender-follow-redirects
curl --header "Prerender-Follow-Redirects: true"
prerender-device-width
curl --header "prerender-device-width: 800"
prerender-device-height
curl --header "prerender-device-height: 600"
prerender-device-is-mobile
curl --header "prerender-device-is-mobile: true"
prerender-emulated-media
curl --header "Prerender-Emulated-Media: screen"
prerender-with-screenshot
This is useful for savings screenshots or injecting them as open graph
images. Often used with Prerender-With-Metadata
curl --header "Prerender-With-Screenshot: true"
prerender-with-metadata
This is useful for capturing SEO-relevant metadata during the pre-render.
curl --header "Prerender-With-Metadata: true"
400
content-type: application/octet-stream
429
500
502
503
504