Sign in to confirm you’re not a bot
Closed this issue · 36 comments
I'm using it on aws vps and I'm getting an error message
UnrecoverableError: Sign in to confirm you’re not a bot
- @distube/ytdl-core version: 4.14.3
- Node.js version: v20.15.0
- Operating system: Ubuntu 22.04
i am facing same issue...
When I use the VPS, I face the same issue, but there is no problem on my local PC.
When I use the VPS, I face the same issue, but there is no problem on my local PC.
are you using free vps?
When I use the VPS, I face the same issue, but there is no problem on my local PC.
are you using free vps?
i'm using aws and free vps, the issue occurs on both
When I use the VPS, I face the same issue, but there is no problem on my local PC.
are you using free vps?
i'm using aws and free vps, the issue occurs on both
I think youtube blocked the free vps ip address in aws
maybe we could run the download thru tor socks5 proxy
Ok bro, Let me know if you find a solution
app.get('/stream', async (req, res) => {
const youtubeid = req.query.ytid;
if (!youtubeid) {
return res.status(400).send('YouTube ID is required');
}
try {
const proxyUrl = 'http://122.200.19.103:80';
const agent = new HttpsProxyAgent(proxyUrl);
const url = `http://www.youtube.com/watch?v=${youtubeid}`;
console.log(agent)
const info = await ytdl.getInfo(url, { requestOptions: { agent } });
const format = ytdl.chooseFormat(info.formats, { filter: 'audioonly' });
const contentLength = format.contentLength;
res.setHeader('Content-Type', 'audio/mp3');
res.setHeader('Content-Length', contentLength);
ytdl(url, { format: format, requestOptions: { agent } })
.pipe(res)
.on('error', (error) => {
console.error('Error piping the stream:', error);
res.status(500).send('An error occurred while processing the request');
});
} catch (error) {
console.error('Error:', error);
res.status(500).send('An error occurred while processing the request');
}
});
im trying this but it gives
Error: InvalidArgumentError: unsupported opts.agent. Did you mean opts.client?
at /rbd/pnpm-volume/dcc9b815-043a-452e-9859-e1e705677ea0/node_modules/@distube/ytdl-core/node_modules/undici/index.js:86:13
at Object.exports.request (/rbd/pnpm-volume/dcc9b815-043a-452e-9859-e1e705677ea0/node_modules/@distube/ytdl-core/lib/utils.js:178:21)
at /rbd/pnpm-volume/dcc9b815-043a-452e-9859-e1e705677ea0/node_modules/@distube/ytdl-core/lib/info.js:84:59
at Map.getOrSet (/rbd/pnpm-volume/dcc9b815-043a-452e-9859-e1e705677ea0/node_modules/@distube/ytdl-core/lib/cache.js:29:19)
at getWatchHTMLPageBody (/rbd/pnpm-volume/dcc9b815-043a-452e-9859-e1e705677ea0/node_modules/@distube/ytdl-core/lib/info.js:84:33)
at getWatchHTMLPage (/rbd/pnpm-volume/dcc9b815-043a-452e-9859-e1e705677ea0/node_modules/@distube/ytdl-core/lib/info.js:165:20)
at retryFunc (/rbd/pnpm-volume/dcc9b815-043a-452e-9859-e1e705677ea0/node_modules/@distube/ytdl-core/lib/info.js:121:22)
at runNextTicks (internal/process/task_queues.js:60:5)
at processTimers (internal/timers.js:497:9)
at async exports.getBasicInfo (/rbd/pnpm-volume/dcc9b815-043a-452e-9859-e1e705677ea0/node_modules/@distube/ytdl-core/lib/info.js:44:16) {
code: 'UND_ERR_INVALID_ARG'
}
app.get('/stream', async (req, res) => { const youtubeid = req.query.ytid;
if (!youtubeid) { return res.status(400).send('YouTube ID is required'); }
try { const proxyUrl = 'http://122.200.19.103:80'; const agent = new HttpsProxyAgent(proxyUrl);
const url = `http://www.youtube.com/watch?v=${youtubeid}`; console.log(agent) const info = await ytdl.getInfo(url, { requestOptions: { agent } }); const format = ytdl.chooseFormat(info.formats, { filter: 'audioonly' }); const contentLength = format.contentLength; res.setHeader('Content-Type', 'audio/mp3'); res.setHeader('Content-Length', contentLength); ytdl(url, { format: format, requestOptions: { agent } }) .pipe(res) .on('error', (error) => { console.error('Error piping the stream:', error); res.status(500).send('An error occurred while processing the request'); });
} catch (error) { console.error('Error:', error); res.status(500).send('An error occurred while processing the request'); } });
im trying this but it gives
Error: InvalidArgumentError: unsupported opts.agent. Did you mean opts.client? at /rbd/pnpm-volume/dcc9b815-043a-452e-9859-e1e705677ea0/node_modules/@distube/ytdl-core/node_modules/undici/index.js:86:13 at Object.exports.request (/rbd/pnpm-volume/dcc9b815-043a-452e-9859-e1e705677ea0/node_modules/@distube/ytdl-core/lib/utils.js:178:21) at /rbd/pnpm-volume/dcc9b815-043a-452e-9859-e1e705677ea0/node_modules/@distube/ytdl-core/lib/info.js:84:59 at Map.getOrSet (/rbd/pnpm-volume/dcc9b815-043a-452e-9859-e1e705677ea0/node_modules/@distube/ytdl-core/lib/cache.js:29:19) at getWatchHTMLPageBody (/rbd/pnpm-volume/dcc9b815-043a-452e-9859-e1e705677ea0/node_modules/@distube/ytdl-core/lib/info.js:84:33) at getWatchHTMLPage (/rbd/pnpm-volume/dcc9b815-043a-452e-9859-e1e705677ea0/node_modules/@distube/ytdl-core/lib/info.js:165:20) at retryFunc (/rbd/pnpm-volume/dcc9b815-043a-452e-9859-e1e705677ea0/node_modules/@distube/ytdl-core/lib/info.js:121:22) at runNextTicks (internal/process/task_queues.js:60:5) at processTimers (internal/timers.js:497:9) at async exports.getBasicInfo (/rbd/pnpm-volume/dcc9b815-043a-452e-9859-e1e705677ea0/node_modules/@distube/ytdl-core/lib/info.js:44:16) { code: 'UND_ERR_INVALID_ARG' }
https://github.com/distubejs/ytdl-core?tab=readme-ov-file#cookies-support
try this
The method of using OAuth tokens solves this problem, albeit in the short term. (I don't know if ytdl-core can do OAuth...) I tried to implement the following as a test, referring to @dylaniscool54's implementation, but it times out.
(The text was translated using a translator. Please understand.)
import ytdl from '@distube/ytdl-core';
const PROXY_URI = 'http://122.200.19.103',
AGENT = ytdl.createProxyAgent({ uri: PROXY_URI });
// Video: Never Gonna Give You Up
ytdl.getInfo('https://youtu.be/dQw4w9WgXcQ', {
agent: AGENT,
}).then(data => {
console.log(data);
}).catch(err => {
console.error('Error:', err);
});
app.get('/stream', async (req, res) => {
const youtubeid = req.query.ytid;
if (!youtubeid) {
return res.status(400).send('YouTube ID is required');
}
try {
const agent = ytdl.createProxyAgent({ uri: "http://152.26.229.66:9443" });
const url = `http://www.youtube.com/watch?v=${youtubeid}`;
const info = await ytdl.getInfo(url, { agent });
const format = ytdl.chooseFormat(info.formats, { filter: 'audioonly' });
const contentLength = format.contentLength;
res.redirect(format.url)
} catch (error) {
console.error('Error:', error);
res.status(500).send('An error occurred while processing the request');
}
});
i did this and it worked. i will make it change proxies now
Certainly this works! At the moment this appears to be the best method over the others.
But can you tell me about the IP addresses of the other proxies, as I think the IPs will be banned by YouTube at some point.
youtube are really annoying for doing this
PROXY_URI
Where can I get the PROXY_URI?
Same issue on koyeb
app.get('/stream', async (req, res) => { const youtubeid = req.query.ytid;
if (!youtubeid) { return res.status(400).send('YouTube ID is required'); }
try { const proxyUrl = 'http://122.200.19.103:80'; const agent = new HttpsProxyAgent(proxyUrl);const url = `http://www.youtube.com/watch?v=${youtubeid}`; console.log(agent) const info = await ytdl.getInfo(url, { requestOptions: { agent } }); const format = ytdl.chooseFormat(info.formats, { filter: 'audioonly' }); const contentLength = format.contentLength; res.setHeader('Content-Type', 'audio/mp3'); res.setHeader('Content-Length', contentLength); ytdl(url, { format: format, requestOptions: { agent } }) .pipe(res) .on('error', (error) => { console.error('Error piping the stream:', error); res.status(500).send('An error occurred while processing the request'); });
} catch (error) { console.error('Error:', error); res.status(500).send('An error occurred while processing the request'); } });
im trying this but it gives
Error: InvalidArgumentError: unsupported opts.agent. Did you mean opts.client? at /rbd/pnpm-volume/dcc9b815-043a-452e-9859-e1e705677ea0/node_modules/@distube/ytdl-core/node_modules/undici/index.js:86:13 at Object.exports.request (/rbd/pnpm-volume/dcc9b815-043a-452e-9859-e1e705677ea0/node_modules/@distube/ytdl-core/lib/utils.js:178:21) at /rbd/pnpm-volume/dcc9b815-043a-452e-9859-e1e705677ea0/node_modules/@distube/ytdl-core/lib/info.js:84:59 at Map.getOrSet (/rbd/pnpm-volume/dcc9b815-043a-452e-9859-e1e705677ea0/node_modules/@distube/ytdl-core/lib/cache.js:29:19) at getWatchHTMLPageBody (/rbd/pnpm-volume/dcc9b815-043a-452e-9859-e1e705677ea0/node_modules/@distube/ytdl-core/lib/info.js:84:33) at getWatchHTMLPage (/rbd/pnpm-volume/dcc9b815-043a-452e-9859-e1e705677ea0/node_modules/@distube/ytdl-core/lib/info.js:165:20) at retryFunc (/rbd/pnpm-volume/dcc9b815-043a-452e-9859-e1e705677ea0/node_modules/@distube/ytdl-core/lib/info.js:121:22) at runNextTicks (internal/process/task_queues.js:60:5) at processTimers (internal/timers.js:497:9) at async exports.getBasicInfo (/rbd/pnpm-volume/dcc9b815-043a-452e-9859-e1e705677ea0/node_modules/@distube/ytdl-core/lib/info.js:44:16) { code: 'UND_ERR_INVALID_ARG' }https://github.com/distubejs/ytdl-core?tab=readme-ov-file#cookies-support
try this
How can i get ip
app.get('/stream', async (req, res) => { const youtubeid = req.query.ytid;
if (!youtubeid) { return res.status(400).send('YouTube ID is required'); }
try { const proxyUrl = 'http://122.200.19.103:80'; const agent = new HttpsProxyAgent(proxyUrl);const url = `http://www.youtube.com/watch?v=${youtubeid}`; console.log(agent) const info = await ytdl.getInfo(url, { requestOptions: { agent } }); const format = ytdl.chooseFormat(info.formats, { filter: 'audioonly' }); const contentLength = format.contentLength; res.setHeader('Content-Type', 'audio/mp3'); res.setHeader('Content-Length', contentLength); ytdl(url, { format: format, requestOptions: { agent } }) .pipe(res) .on('error', (error) => { console.error('Error piping the stream:', error); res.status(500).send('An error occurred while processing the request'); });
} catch (error) { console.error('Error:', error); res.status(500).send('An error occurred while processing the request'); } });
im trying this but it gives
Error: InvalidArgumentError: unsupported opts.agent. Did you mean opts.client? at /rbd/pnpm-volume/dcc9b815-043a-452e-9859-e1e705677ea0/node_modules/@distube/ytdl-core/node_modules/undici/index.js:86:13 at Object.exports.request (/rbd/pnpm-volume/dcc9b815-043a-452e-9859-e1e705677ea0/node_modules/@distube/ytdl-core/lib/utils.js:178:21) at /rbd/pnpm-volume/dcc9b815-043a-452e-9859-e1e705677ea0/node_modules/@distube/ytdl-core/lib/info.js:84:59 at Map.getOrSet (/rbd/pnpm-volume/dcc9b815-043a-452e-9859-e1e705677ea0/node_modules/@distube/ytdl-core/lib/cache.js:29:19) at getWatchHTMLPageBody (/rbd/pnpm-volume/dcc9b815-043a-452e-9859-e1e705677ea0/node_modules/@distube/ytdl-core/lib/info.js:84:33) at getWatchHTMLPage (/rbd/pnpm-volume/dcc9b815-043a-452e-9859-e1e705677ea0/node_modules/@distube/ytdl-core/lib/info.js:165:20) at retryFunc (/rbd/pnpm-volume/dcc9b815-043a-452e-9859-e1e705677ea0/node_modules/@distube/ytdl-core/lib/info.js:121:22) at runNextTicks (internal/process/task_queues.js:60:5) at processTimers (internal/timers.js:497:9) at async exports.getBasicInfo (/rbd/pnpm-volume/dcc9b815-043a-452e-9859-e1e705677ea0/node_modules/@distube/ytdl-core/lib/info.js:44:16) { code: 'UND_ERR_INVALID_ARG' }https://github.com/distubejs/ytdl-core?tab=readme-ov-file#cookies-support
try thisI tried to change vps ip address in aws it didn't work
How can i get ip
I am currently selecting valid proxy IPs from https://github.com/Mini0001/proxylist/blob/main/http.txt, and at this time there are two valid IPs
- 152.26.229.66:9443
- 152.26.229.42:9443
0|app | Error: UnrecoverableError: Sign in to confirm you’re not a bot
0|app | at exports.playError (/home/ubuntu/ytube2d/node_modules/@distube/ytdl-core/lib/utils.js:164:12)
0|app | at exports.getBasicInfo (/home/ubuntu/ytube2d/node_modules/@distube/ytdl-core/lib/info.js:46:25)
0|app | at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
i got this error
my code is
exports.getData = async (req, res) => {
try {
const { url } = req.body;
const proxyAgent = ytdl.createProxyAgent({ uri: 'http://localhost:5000' });
const info = await ytdl.getInfo(url, { proxyAgent });
if (!info) {
throw new Error("No such info found");
}
res.status(200).json({ success: true, info });
} catch (error) {
console.error("Error:", error);
res.status(500).json({ success: false, message: "Server error" });
}
};
for proxy I do set up on AWS
server {
server_name api.ytube2d.com;
location / {
proxy_pass http://localhost:5000; # Assuming your Node.js app is running on port 3000
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
in my local it's working fine but in AWS server it is not working
Maybe the AWS IP is blocked from YouTube.
Changing the ytdl.createProxyAgent
part as follows should work.
ytdl.createProxyAgent({ uri: '152.26.229.66:9443' });
Ehtimol, AWS IP YouTube-dan bloklangan. Qismni quyidagi tarzda o'zgartirish ishlashi kerak.
ytdl.createProxyAgent
ytdl.createProxyAgent({ uri: '152.26.229.66:9443' });
thanks it worked but http://152.26.229.66:9443 where can i get this
thanks it worked but http://152.26.229.66:9443 where can i get this
You can find valid IP addresses at https://github.com/Mini0001/proxylist/blob/main/http.txt and other lists of proxy IP addresses. However, there are very few valid IP addresses, only two at this time.
As a way to find a valid IP address, I have set up a test server in Glitch and have been testing IP addresses at random.
thanks it worked but http://152.26.229.66:9443 where can i get this
You can find valid IP addresses at https://github.com/Mini0001/proxylist/blob/main/http.txt and other lists of proxy IP addresses. However, there are very few valid IP addresses, only two at this time. As a way to find a valid IP address, I have set up a test server in Glitch and have been testing IP addresses at random.
If a good thread has a lot of addresses and uses them randomly, won't this problem occur later?
Yes, I think it will continue to work fine if nothing else.
However, if YouTube bans your IP or something, the error may happen again.
Yes, I think it will continue to work fine if nothing else. However, if YouTube bans your IP or something, the error may happen again.
How to avoid youtube ban?, whether to set limits for sending requests?
Yes, I think the best solution is to keep the request volume to an appropriate amount that is not too large. You can also provide many proxy IPs to distribute the requests.
Well, ultimately it depends on YouTube's mood...
The following is a list of valid proxy IP addresses as of 08/07/2024 at 22:00 for resolving this issue.
- 152.26.229.42:9443
- 152.26.229.66:9443
- 152.26.229.88:9443
- 152.26.231.42:9443
- 152.26.231.77:9443
- 152.26.231.86:9443
- 177.234.241.25:999
- 177.234.241.26:999
- 177.234.241.27:999
- 177.234.241.30:999
Array: ['152.26.229.66:9443', '152.26.229.42:9443', '152.26.229.88:9443', '152.26.231.42:9443', '152.26.231.86:9443', '152.26.231.77:9443', '152.26.229.88:9443', '177.234.241.27:999', '177.234.241.30:999', '177.234.241.26:999', '177.234.241.25:999']
This problem should be due to invalid cookies. I added some warnings to the docs. Duplicated #21
Quyida ushbu muammoni hal qilish uchun 08.07.2024 yil soat 22:00 holatiga koʻra amaldagi proksi IP manzillar roʻyxati keltirilgan.
- 152.26.229.42:9443
- 152.26.229.66:9443
- 152.26.229.88:9443
- 152.26.231.42:9443
- 152.26.231.77:9443
- 152.26.231.86:9443
- 177.234.241.25:999
- 177.234.241.26:999
- 177.234.241.27:999
- 177.234.241.30:999
Massiv: ['152.26.229.66:9443', '152.26.229.42:9443', '152.26.229.88:9443', '152.26.231.42:9443', '1521.2.2.' 31,77:9443' , '152.26.229.88:9443', '177.234.241.27:999', '177.234.241.30:999', '177.234.241.26:999', '1729923.'
Thank you for your great help bro
app.get('/stream', async (req, res) => { const youtubeid = req.query.ytid;
if (!youtubeid) { return res.status(400).send('YouTube ID is required'); }
try { const agent = ytdl.createProxyAgent({ uri: "http://152.26.229.66:9443" });
const url = `http://www.youtube.com/watch?v=${youtubeid}`; const info = await ytdl.getInfo(url, { agent }); const format = ytdl.chooseFormat(info.formats, { filter: 'audioonly' }); const contentLength = format.contentLength; res.redirect(format.url)
} catch (error) { console.error('Error:', error); res.status(500).send('An error occurred while processing the request'); } });
i did this and it worked. i will make it change proxies now
How to get valid proxy
The following is a list of valid proxy IP addresses as of 08/07/2024 at 22:00 for resolving this issue.
- 152.26.229.42:9443
- 152.26.229.66:9443
- 152.26.229.88:9443
- 152.26.231.42:9443
- 152.26.231.77:9443
- 152.26.231.86:9443
- 177.234.241.25:999
- 177.234.241.26:999
- 177.234.241.27:999
- 177.234.241.30:999
Array: ['152.26.229.66:9443', '152.26.229.42:9443', '152.26.229.88:9443', '152.26.231.42:9443', '152.26.231.86:9443', '152.26.231.77:9443', '152.26.229.88:9443', '177.234.241.27:999', '177.234.241.30:999', '177.234.241.26:999', '177.234.241.25:999']
How di you get this validproxy
thanks it worked but http://152.26.229.66:9443 where can i get this
You can find valid IP addresses at https://github.com/Mini0001/proxylist/blob/main/http.txt and other lists of proxy IP addresses. However, there are very few valid IP addresses, only two at this time. As a way to find a valid IP address, I have set up a test server in Glitch and have been testing IP addresses at random.
How to get valid proxy
thanks it worked but http://152.26.229.66:9443 where can i get this
You can find valid IP addresses at https://github.com/Mini0001/proxylist/blob/main/http.txt and other lists of proxy IP addresses. However, there are very few valid IP addresses, only two at this time. As a way to find a valid IP address, I have set up a test server in Glitch and have been testing IP addresses at random.
How to get valid proxy
Test everything.
thanks it worked but http://152.26.229.66:9443 where can i get this
You can find valid IP addresses at https://github.com/Mini0001/proxylist/blob/main/http.txt and other lists of proxy IP addresses. However, there are very few valid IP addresses, only two at this time. As a way to find a valid IP address, I have set up a test server in Glitch and have been testing IP addresses at random.
How to get valid proxy
Test everything.
I test but I get some valid ip but that's isn't making connection to @distube/ytdl-core to get YouTube audio video
Did anyone find a solution? If anyone found, please let me know.