proxy error
Closed this issue · 1 comments
timfong888 commented
Describe the bug
My logs show an error when trying to use the proxy agent suggesting that the example code (I basically used this) is wrong.
Debug File
Error in audio stream for jxXxT72tuU0: InvalidArgumentError: unsupported opts.agent. Did you mean opts.client?
2023-12-15 22:36:27.025 PST
videoIdToMP4aiu4uirmzozb at /workspace/node_modules/undici/index.js:86:13
2023-12-15 22:36:27.025 PST
videoIdToMP4aiu4uirmzozb at exports.request (/workspace/node_modules/@distube/ytdl-core/lib/utils.js:172:21)
2023-12-15 22:36:27.025 PST
videoIdToMP4aiu4uirmzozb at /workspace/node_modules/@distube/ytdl-core/lib/info.js:107:59
2023-12-15 22:36:27.025 PST
videoIdToMP4aiu4uirmzozb at Cache.getOrSet (/workspace/node_modules/@distube/ytdl-core/lib/cache.js:29:19)
2023-12-15 22:36:27.025 PST
videoIdToMP4aiu4uirmzozb at getWatchHTMLPageBody (/workspace/node_modules/@distube/ytdl-core/lib/info.js:107:33)
2023-12-15 22:36:27.025 PST
videoIdToMP4aiu4uirmzozb at getWatchHTMLPage (/workspace/node_modules/@distube/ytdl-core/lib/info.js:188:20)
2023-12-15 22:36:27.025 PST
videoIdToMP4aiu4uirmzozb at retryFunc (/workspace/node_modules/@distube/ytdl-core/lib/info.js:144:22)
2023-12-15 22:36:27.025 PST
videoIdToMP4aiu4uirmzozb at async exports.getBasicInfo (/workspace/node_modules/@distube/ytdl-core/lib/info.js:50:16) {
2023-12-15 22:36:27.025 PST
videoIdToMP4aiu4uirmzozb code: 'UND_ERR_INVALID_ARG'
2023-12-15 22:36:27.025 PST
videoIdToMP4aiu4uirmzozb }
This is my code:
const agent = ytdl.createProxyAgent({ uri: "https://xxxx:7000" });
....
const audioStream = ytdl(videoUrl, { quality: lowestQualityFormat.itag, requestOptions: { agent: agent } });
Environment
- @distube/ytdl-core version: "@distube/ytdl-core": "^4.13.3",
- Node.js version: "node": "18"
- Operating system: Linux on Firebase Functions
skick1234 commented
Read the example please https://github.com/distubejs/ytdl-core?tab=readme-ov-file#proxy-support
const ytdl = require("@distube/ytdl-core");
const agent = ytdl.createProxyAgent({ uri: "my.proxy.server" });
ytdl.getBasicInfo("http://www.youtube.com/watch?v=aqz-KE-bpKQ", { agent });
ytdl.getInfo("http://www.youtube.com/watch?v=aqz-KE-bpKQ", { agent });
It is agent
option (getBasicInfo(url, { agent: yourProxyAgent })
), not requestOptions: { agent }