Rayobyte Documentation
  • Web Scraper API
    • Getting Started
    • Features
      • Proxy Geolocation
      • JavaScript Rendering
      • Custom Headers and Cookies
    • Billing & Usage
      • How We Charge You
      • Statistics
    • Reference
      • Response Codes
      • Timeout Settings
Powered by GitBook
On this page
  • JavaScript Rendering
  • How to Enable JavaScript Rendering
  • The Details: Why Use JavaScript Rendering?
  • When Should You Use JavaScript Rendering?
  • Important Things to Know 🚨
  1. Web Scraper API
  2. Features

JavaScript Rendering

JavaScript Rendering

When you’re scraping a website that relies on JavaScript to load data dynamically, a simple HTTP request often won’t cut it. That’s where JavaScript rendering comes into play. With Rayobyte's Scraping API, you can unlock the full content of JavaScript-powered websites effortlessly—no need to wrestle with headless browsers yourself. 🎉

How to Enable JavaScript Rendering

Using JavaScript rendering is super simple: just add the render=true parameter to your API query. This tells the system to fully render the page, loading all the dynamic content you’d see if you visited the page in your browser.

Example Requests:

curl 'https://api.scraping.rayobyte.com/?token=YOUR_TOKEN&render=true&url=https://tools-api.rayobyte.com/free-ip-lookup/1.2.3.4'
const axios = require('axios');

// Define the API URL and parameters
const url = 'https://api.scraping.rayobyte.com/';
const params = {
    token: 'YOUR_TOKEN',
    render: 'true',
    url: 'https://tools-api.rayobyte.com/free-ip-lookup/1.2.3.4'
};

// Make the GET request
axios.get(url, { params })
    .then(response => {
        console.log("Response:", response.data);
    })
    .catch(error => {
        if (error.response) {
            console.error(`Error: ${error.response.status} - ${error.response.data}`);
        } else {
            console.error(`Error: ${error.message}`);
        }
    });
https://api.scraping.rayobyte.com/?token=YOUR_TOKEN&render=true&url=https://tools-api.rayobyte.com/free-ip-lookup/1.2.3.4
import requests

# Define the API URL and parameters
url = "https://api.scraping.rayobyte.com/"
params = {
    "token": "YOUR_TOKEN",
    "render": "true",
    "url": "https://tools-api.rayobyte.com/free-ip-lookup/1.2.3.4"
}

# Make the GET request
response = requests.get(url, params=params)

# Check and print the response
if response.status_code == 200:
    print("Response:", response.json())
else:
    print(f"Error: {response.status_code} - {response.text}")

That’s it! The API will return the fully rendered HTML of the page, including all the JavaScript-generated content.


The Details: Why Use JavaScript Rendering?

JavaScript rendering ensures you’re capturing all the data visible on a page—even when it’s dynamically injected by JavaScript. Think of it as flipping on the light switch to reveal the full picture.

What’s Happening Behind the Scenes?

When you enable rendering:

  1. The API loads the page as if it were in a browser.

  2. It processes JavaScript, executes API calls, and loads the final DOM.

  3. VoilĂ ! You get a fully-rendered HTML response, ready to scrape.


When Should You Use JavaScript Rendering?

Here are some situations where JavaScript rendering is a must:

  • The content is loaded dynamically via JavaScript (e.g., single-page applications).

  • Critical data doesn’t appear in the raw HTML source code.

Important Things to Know 🚨

  1. Rendering Takes Time

    1. Rendering a page with JavaScript is more resource-intensive than a standard HTTP request. Be sure to account for this when setting your Timeout parameters. ⏱️ 👉 Learn more about Timeout settings here.

  2. Efficiency First

    1. To save bandwidth and boost efficiency, our system avoids loading unnecessary assets like large images or videos unless they’re required for rendering.

  3. Automatic Rendering

PreviousProxy GeolocationNextCustom Headers and Cookies

Last updated 5 months ago

For particularly tricky domains, our system might auto-enable rendering to ensure you get accurate results. If you want to override this, please .

contact support