Skip to content
A custom JavaScript rendering engine based on puppeteer
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
public
scripts
src
.dockerignore
.env.example
.env.prod
.gitignore
Dockerfile
README.md
nodemon.json
package.json
release.config.js
renovate.json
test.js
tsconfig.json
yarn.lock

README.md

WARNING This project is not an officially maintained Algolia project. This repository should not be used for any production project. Bug reports and feature requests will most likely be ignored. If you'd like to use it, you most likely should check out GoogleChrome/rendertron instead.

Renderscript

An API to render a page inside a real Chromium (with JavaScript enabled) and send back the raw HTML.

This project is heavily inspired by Google's rendertron project. The aim is to make a more reliable and more flexible version for long-term use.

  • Security:
  • Performance:
    • Ignores useless resources for rendering HTML (e.g. images)
    • Has adblocking support backed in (thanks to Brave's ad-block) for huge resource consumption gains
  • Resilience:
    • Has a rolling system to spawn a new Chrome after a specific amount of pages processed to lower RAM usage
  • Features:
    • Allows for extension injection (discouraged - this requires running the browser in headful mode, which consumes way more resources)
  • Misc:
    • Bundles an optimized Dockerfile for easy deployment

API

POST /render

Main endpoint. Renders the page and dumps a JSON with all the page information.

Body parameters:

  • url: URL to render (for hash and query params support, use encodeURIComponent on it)

Returns application/json:

  • statusCode <number>: HTTP Status Code
  • headers <{ [key: string]: string }>: Page headers (keys are lowercase)
  • body <string>: Page raw HTML content

GET /render

Used for debug purposes. Dumps directly the HTML for easy inspection in your browser.

Query parameters:

  • url: URL to render (for hash and query params support, use encodeURIComponent on it)

Returns text/html. (CSP headers are set to prevent script execution on the rendered page)

Running it locally

Simply run:

docker run -p 23000:3000 algolia/renderscript
open http://localhost:3000/render?url=https%3A%2F%2Fwww.algolia.com

Parameters

See .env.prod to see which ones are installed by default (they still need to be provided to docker run to be enabled).

  • ADBLOCK_LISTS: Comma separated list of adblocking lists download link
    Example: https://easylist.to/easylist/easylist.txt
  • EXTENSIONS: Comma separated list of extensions download link (expects a .zip file)
    Example: https://github.com/gorhill/uBlock/releases/download/1.19.6/uBlock0_1.19.6.chromium.zip

Credits

This project is heavily inspired by GoogleChrome/rendertron. It is based on puppeteer-core.

You can’t perform that action at this time.