Ad

Using Opensubtitles Api Node.js/Python Wrapper Behind A Proxy

- 1 answer

I'm trying to use opensubtitles-api node.js wrapper of opensubtitles api behind a proxy. Unfortunately there is no proxy option available. The library in turn uses node-xmlrpc to make RPC calls. But the underlying node-xmlrpc library also doesn't support proxy tunneling. My project also benefits from some python libraries and code. But python wrapper also seems not to handle proxies. What are my options?

Ad

Answer

Since node-xmlrpc is using http/https you can specify a proxy like this.

const xmlrpc  = require('xmlrpc');

const options = {
  host: "proxy_url",
  port: 8080, // proxy port
  path: "http://opensubtitles_url",
  headers: {
    Host: "opensubtitles_domain",
    "Proxy-Authorization": "Basic bXl1c2VyOm15cGFzc3dvcmQ=" // if needed
  }
};

const client  = xmlrpc.createClient(options);
Ad
source: stackoverflow.com
Ad