captora

1.1.0 • Public • Published

node-captora

JavaScript library for Captora's API (node)

This library supports downloading Captora CDM widgets as HTML fragments for inclusion on other pages.

Install

Available on NPM.

npm install captora

Additionally, this library requires that the CAPTORA_API_KEY and the CAPTORA_DOMAIN variables are present in the environment.

Usage

This library can be used with Promises/A+ or with node-style callbacks.

    const captora = require("captora");
    
    // the URL of the page where the CDM widget HTML will be included
    let url = "https://www.example.com/";
    
    // Promise based
    captora.widget.download(url)
        .then(html => console.log(html))
        .catch(console.error);
    
    // error-first, node-style callback
    captora.widget.download(url, function (err, html) {
    
        if (err) {
            throw err;
        }
        console.log(html);
    
    });

Usage with a Proxy

To proxy HTTP(S) requests, then set the appropriate npm config variables.

npm config set https-proxy http://proxy.example.com:3128/
npm config set proxy http://proxy.example.com:3128/

If the npm config variables are not found, then these environment variables will be used.

HTTPS_PROXY=http://proxy.example.com:3128/
HTTP_PROXY=http://proxy.example.com:3128/

Change log

v1.1.0 — February 13, 2017

  • added support HTTP(S) proxy

v1.0.0 — February 6, 2017

  • Initial version
  • supports downloading Captora CDM widget HTML

License

node-captora is available under the MIT License.

Package Sidebar

Install

npm i captora

Weekly Downloads

2

Version

1.1.0

License

MIT

Last publish

Collaborators

  • keithws