add proxy support
russtee opened this issue · 2 comments
russtee commented
ytdl-core allows the ability to pass "requestOptions" to miniget which in turn allows the use of a proxy for all requests.
would it be possible to offer similar functionality with ytcog?
gatecrasher777 commented
All the objects have a common property which is sent to miniget for all the get and post requests. So per fent/node-miniget#56 you could just add something like this to it for now:
let proxy = new ProxyAgent(proxyUri);
let session = new Session();
session.common.agent = proxy;
session.fetch();
let video = new Video(session,{id:...});
video.common.agent = proxy;
video.fetch();
But you can't do that for media downloads. Also it would be tedious to have to define the proxy for every call in your code. So I can look at adding an options parameter to new Session() like this that will be applied to all session requests:
let session = new Session({ agent: new ProxyAgent(proxyUri), ... })
and that also gets sent to the downloader.
russtee commented
Great, I only need the metadata so this sounds perfect. Will give it a try.
… On 16 Oct 2021, at 13:16, gatecrasher777 ***@***.***> wrote:
let proxy = new ProxyAgent(proxyUri);
let session = new Session();
session.combine.agent = proxy;
session.fetch();
let video = new Video(session,{id:...});
video.combine.agent = proxy;
video.fetch();