Fetching rendered DOM easily and simply. Like cURL. Using Headless Chromium.
So this library provides simplicity in these cases:
- Crawlers
- Text browsers
- Command line interface like curl wget
published on npm
$ npm install rendering-proxy
$ yarn add rendering-proxy
$ pnpm add rendering-proxy
$ rendering-proxy --help
rendering-proxy <command>
Commands:
rendering-proxy cli [url] CLi mode
rendering-proxy server Server mode
Options:
--version Show version number [boolean]
--help Show help [boolean]
$ yarn run rendering-proxy cli https://example.com/
<html><head>
...
</body></html>
$ yarn run rendering-proxy server --port=8080
$ curl http://localhost:8080/https://example.com/
<html><head>
...
</body></html>
When -e
, --evaluate
is specified, JavaScript code is evaluated before getting DOM.
$ yarn run rendering-proxy cli https://example.com/ -e 'document.title = "updated"' -e 'document.title += " twice"'
<!DOCTYPE html><html><head>
<title>updated twice</title>
...
Send the options via request header X-Rendering-Proxy
(case-insensitive).
Receive the results via request header X-Rendering-Proxy
(case-insensitive).
curl -H 'X-Rendering-Proxy: {"evaluates": ["1 + 1"], "waitUntil": "load"}' --include http://localhost:8080/https://example.com/
HTTP/1.1 200 OK
...
x-rendering-proxy: [{"success":true,"result":2,"script":"1 + 1"}]
...
<!DOCTYPE html><html><head>
<title>Example Domain</title>
The 3-Clause BSD License. See also LICENSE file.