Proxy Agent Help! #187
Unanswered
seomikewaltman
asked this question in
Q&A
Replies: 2 comments
-
Try this: import { ProxyAgent, fetch } from 'undici';
const youtube = await Innertube.create({
fetch: async (input, init) => {
const client = new ProxyAgent('http://x.x.x.x:13400')
return fetch(input, { ...init, dispatcher: client } )
}
}); YouTube.js already uses undici internally so you wont be adding another dependency. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Unfortunately it still just throws an error, but a different one :)
I'll keep fiddling around with it. I'm using the latest Node.js v18.9.0 on Mac. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What's the proper way to configure this new version for using a proxy to make requests? I've looked at the examples but they're a bit vague.
On the old library it was fairly easy to add a proxy agents since the session used Axios to make its requests.
I'm trying to follow from the examples in the documentation to do the same using the new create method and fetch option
My agent output is picked up
FetchError: request to https://www.youtube.com/sw.js_data failed, reason: read ECONNRESET
Even if I don't add a proxy and just pass through using node-fetch
const youtube = await Innertube.create({
fetch: async (input: RequestInfo, init: RequestInit) => {
return fetch(input, init)
}
});
it throws errors
Any help would be very appreciated!
Beta Was this translation helpful? Give feedback.
All reactions