Closed kimgh06 closed 3 months ago
Thank you for your report. We are currently identifying the cause of the bug and fixing it. We would appreciate it if you could provide us with the URL of the video in which the bug is occurring.
Version v5.0.4, which appears to fix this bug, is now available. Please try it.
Ok, I tried it and another bug appears.
Unhandled Rejection: InvalidArgumentError: invalid url
at /var/task/node_modules/undici/index.js:57:13
at Object.f [as request] (/var/task/.next/server/app/api/get_video/route.js:6:4436)
at /var/task/.next/server/app/api/get_video/route.js:6:217
at i.getOrSet (/var/task/.next/server/app/api/get_video/route.js:1:7818)
at O (/var/task/.next/server/app/api/get_video/route.js:6:172)
at Object.D [as decipherFormats] (/var/task/.next/server/app/api/get_video/route.js:6:851)
at L (/var/task/.next/server/app/api/get_video/route.js:3:848)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: 'UND_ERR_INVALID_ARG'
}
Node.js process exited with exit status: 128. The logs above can help with debugging the issue.
That has been fixed in v5.0.4. Please try a fresh install.
Oh, I will
Also, v5.0.4 contains useless logs and data. v5.0.5 should be installed.
Checked it.
Checked it.
Is it working?
No, another bug appears on vercel.
Unhandled Rejection: Error: This video is unavailable
at y (/var/task/.next/server/app/api/get_video/route.js:1:20233)
at /var/task/.next/server/app/api/get_video/route.js:1:22211
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Node.js process exited with exit status: 128. The logs above can help with debugging the issue.
What is the video URL?
And here are warning messages.
What is the video URL?
https://www.youtube.com/watch?v=oMfMUfgjiLg G N R - Sweet child o' mine
And here are warning messages.
It is normal. Currently, iOS and Android players will output that log because of the error.
What is the video URL?
https://www.youtube.com/watch?v=oMfMUfgjiLg G N R - Sweet child o' mine
Do you specify a poToken
?
Yes, I did.
const poToken = process.env.NEXT_PUBLIC_PO_TOKEN
const visitorData = process.env.NEXT_PUBLIC_VISITOR_DATA
const stream = ytdl(`https://youtube.com/watch?v=${url}`, {
agent,
filter: 'audioonly',
quality: 'highestaudio',
format: 'mp3',
poToken,
visitorData
}).on('error', e => {
console.log(e, 'error at get_video')
throw e;
});
Try generating a new one. Also, what is specified in the agent?
The agent for cookies.
const cookies = [{
"domain": ".youtube.com",
"expirationDate": 1956442831.220501,
"hostOnly": false,
"httpOnly": true,
"name": "__Secure-1PSID",
"path": "/",
"sameSite": "unspecified",
"secure": true,
"session": false,
"storeId": "0",
"value": "g.a000mAgEOqoSd3RlbdBjNWAGnCWmcFtdOYwMaAYNJhfnnAyqaONtGaKgncRerL0dDxPwwp8sGQACgYKAZcSARUSFQHGX2MiaMV9LPBojznMJKAJiJcXyBoVAUF8yKqTxm8uenq1M5aIWXtBZrX00076",
"id": 2
},]
const agent = ytdl.createAgent(cookies)
and I try generate new token and will reply.
Please do not specify cookies.
Ok.
I applied my new token on serverless environment variables, but same error appears on logs.
Unhandled Rejection: Error: This video is unavailable
at y (/var/task/.next/server/app/api/get_video/route.js:1:19869)
at /var/task/.next/server/app/api/get_video/route.js:1:21847
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Node.js process exited with exit status: 128. The logs above can help with debugging the issue.
Glitch and Vercel Functions do not generate errors, so it is possible that the poToken
and visitorData
are incorrect, either due to geographical factors or because the poToken
and visitorData
are incorrect.
Vercel: https://ytdl-core-test.vercel.app/api/v3/info/full/?videoUrl=https://youtu.be/oMfMUfgjiLg Glitch: http://marsh-numerous-oak.glitch.me/stream/basic/?ytid=oMfMUfgjiLg
The issue has been resolved and the issue is closed.
My Biggest mistake.
And I edited my variable. Thanks!
That was good to know :)
Describe the bug
When I try to get a video via ytdl() on serverless deployments.
Debug File
Environment