JavaScript rendering

We provide a complete solution that saves you from setting up proxies, browser fingerprinting, headless browsers, etc. Just set the render type in the header and you will receive a rendered result.

Rendering Type


You can choose between two rendering types:

  • png(raw bytes that can be saved as PNG)

  • html(The HTML of the rendered page)

Receives rendered page content in HTML format

curl --request POST --url https://unlocker-api.lunaproxy.com/request --header "Authorization: Bearer token" --header "content-type: application/json" --data "{\"url\":\"https://www.google.com/\",\"type\":\"html\",\"js_render\":\"False\"}" > google.html

Scrape the HTML of a website


In this example, we will render the YouTube homepage and scrape the page content. Typically, if the generic crawling API is used without JavaScript rendering, YouTube's homepage looks like this:

Enable Javascript rendering, and return the HTML of the rendered page:

curl --request POST --url https://unlocker-api.lunaproxy.com/request --header "Authorization: Bearer token" --header "content-type: application/json" --data "{\"url\":\"https://www.google.com/\",\"type\":\"html\",\"js_render\":\"True\"}" > google.html

Receive rendered page content in PNG format

The response will contain the raw bytes of an image that can be saved as a PNG format.

curl --request POST --url https://unlocker-api.lunaproxy.com/request --header "Authorization: Bearer token" --header "content-type: application/json" --data "{\"url\":\"https://www.google.com/\",\"type\":\"png\",\"js_render\":\"True\"}" > google.png

It can be saved in PNG format and opened as follows:

Enable JavaScript rendering


To activate JavaScript rendering, set js_render=true and we will use the browser to make the request.

curl --request POST --url 
https://unlocker-api.lunaproxy.com/request
 --header "Authorization: Bearer token" --header "content-type: application/json" --data "{\"url\":\"
https://www.google.com/\",\"type\":\"png\",\"js_render\":\"True\"}"
 > google.png

Last updated

Was this helpful?