Skip to main content

Rendering JavaScript

Rendering JavaScript is disabled by default. This way, scraping goes faster but sometimes you actually do want to wait for JS to render.

To enable JavaScript rendering, just add render_js=true query parameter:

import requests

payload = {
"api_key": "[your API key]",
"url": "https://example.com",
"render_js": "true",
}

response = requests.get("https://scraping.narf.ai/api/v1/", params=payload)
print(response.content)

For all requested URLs, without exceptions, we render the content using our cluster of real browsers customized and specialized to bypass anti-bot detection systems like Cloudflare, DataDome, Akamai, Imperva, etc. You do not have to enable JavaScript rendering to use a real browser for your request.

For many URLs, the resulting HTML will look exactly the same with and without JS rendering. In Scraping Fish, enabled JavaScript rendering means that we wait until there are no network connections for at least 500 ms. You can use it if you want to let the website dynamically load additional data.

tip

You do not pay anything extra for requests with JavaScript rendering enabled. We strive to make our pricing clear and the cost of each request is the same regardless of which features of the API you use.

Another reason why you might want to try enabling JS rendering is to bypass anti-bot detection mechanisms which sometimes run JS for browser fingerprint check, etc. In case you happen to consistently experience high rate of 500 errors or timeouts, we encourage you to enable JS rendering.

note

The request with JS rendering enabled might take slightly more time as it needs to render the JS.