JS Rendering

js_render: boolean | false;

What's This?

Websites can display content in two main ways: static content that's always there when the page loads, and dynamic content that appears or changes due to JavaScript. The js_render option determines how our scraper views this content.

How Does it Work?

  • Default (js_render=false): The scraper quickly retrieves the website's initial content without processing any JavaScript. This method is efficient and less demanding.

  • With Rendering (js_render=true): The scraper processes the website's JavaScript, ensuring it captures all content, including the dynamic parts. This approach is thorough but might take a bit more time.

When Should I Use This?

Activate js_render if you're dealing with websites that use JavaScript to show or modify their content, especially if you notice missing information in your scraped data.

Methods

useJsRendering(boolean)

Sets the js rendering option

Initializing Scraper:

const GeonodeScraperApi = require('geonode-scraper-api');
const scraper = new GeonodeScraperApi('<Your_username>', '<Your_password>');

Using Method

scraper.useJsRendering(true);
scraper.scrape('https://example.com/');

Using Configuration Object

const config = { js_render: true };
scraper.scrape('https://example.com/', config);