gatecrasher777/ytcog

add proxy support

russtee opened this issue · 2 comments

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?

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.