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.
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:
- Leverages
puppeteer
'screateIncognitoBrowserContext
to isolate each page and prevent cookie sharing.
- Leverages
- 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
- Ignores useless resources for rendering HTML (e.g.
- 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
- Bundles an optimized
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, useencodeURIComponent
on it)
Returns application/json
:
statusCode <number>
: HTTP Status Codeheaders <{ [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, useencodeURIComponent
on it)
Returns text/html
.
(CSP headers are set to prevent script execution on the rendered page)
Simply run:
docker run -p 23000:3000 algolia/renderscript
open http://localhost:3000/render?url=https%3A%2F%2Fwww.algolia.com
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
This project is heavily inspired by GoogleChrome/rendertron
.
It is based on puppeteer-core
.