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