在代理后面使用opensubtitles api Node.js / Python包装器

时间:2019-01-10 13:10:19

标签: python node.js proxy xml-rpc subtitle

我正在尝试在代理后面使用opensubtitles-api opensubtitles api的node.js包装器。不幸的是,没有可用的代理选项。该库又使用node-xmlrpc进行RPC调用。但是底层的node-xmlrpc库也不支持代理隧道。我的项目还受益于一些python库和代码。但是python包装器似乎也不处理代理。我有什么选择?

1 个答案:

答案 0 :(得分:1)

由于node-xmlrpc使用的是http / https,因此您可以指定这样的代理。

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);