Closed badDevelopper closed 2 months ago
Which video URL is causing that problem? Please provide the code you are implementing.
y just try in local pc. dont wok more, an also run im my vps ubuntu, and not work....
const videoUrl = https://www.youtube.com/watch?v=${videoId}
;
ytdown(videoUrl, { format: 'json' }).then((response) => {
const videoMp4Url = response.data.video; // URL do vídeo em MP4
res.header('Content-Disposition', 'attachment; filename="video.mp4"');
axios({
url: videoMp4Url,
method: 'GET',
responseType: 'stream'
}).then(videoResponse => {
videoResponse.data.pipe(res);
}).catch(error => {
console.log(error)
res.status(500).send('Erro ao baixar o vídeo.');
});
}
).catch(error => { console.log(error) res.status(500).send('Erro ao processar o vídeo.'); });
You can specify poToken and visitorData as the second argument of the function. Use https://github.com/fsholehan/scrape-youtube to generate poToken and visitorData. It would still be helpful if you could give us the exact video URL.
// Like this
ytdl.getInfo(VIDEO_URL, {
poToken: 'PO_TOKEN',
visitorData: 'VISITOR_DATA',
});
I have the same error but only on my ubuntu server. On my ubuntu desktop and windows works fine.
/root/test/node_modules/@ybd-project/ytdl-core/package/info.js:326
throw new Error(`All player APIs responded with an error. (Clients: ${options.clients.join(', ')})`);
^
Error: All player APIs responded with an error. (Clients: web_creator, ios, android)
at _getBasicInfo (/root/test/node_modules/@ybd-project/ytdl-core/package/info.js:326:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async _getInfo (/root/test/node_modules/@ybd-project/ytdl-core/package/info.js:362:18)
Emitted 'error' event on PassThrough instance at:
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Node.js v20.13.1
this is my test script
const ytdl = require('@ybd-project/ytdl-core');
// TypeScript: import ytdl from '@ybd-project/ytdl-core'; with --esModuleInterop
// TypeScript: import * as ytdl from '@ybd-project/ytdl-core'; with --allowSyntheticDefaultImports
// TypeScript: import ytdl = require('@ybd-project/ytdl-core'); with neither of the above
// Download a video
ytdl('http://www.youtube.com/watch?v=aqz-KE-bpKQ', { poToken: xxx', visitorData: 'xxx' }).pipe(require('fs').createWriteStream('video.mp4'));
Resolved by generate new poToken with https://github.com/YunzheZJU/youtube-po-token-generator
Didn't work on my vps. Fetching info works, but the download returns that error even when passing a poToken and visitorData from youtube-po-token-generator
.
Didn't work on my vps. Fetching info works, but the download returns that error even when passing a poToken and visitorData from
youtube-po-token-generator
.
We are currently aware of this issue. Basically, if fetching information works, then downloading should also work.
Update: I was using the distubejs/ytdl-core library for info fetching. Replaced it with this one and it throws the same error on both methods.
Code
info = await ytdl.getInfo(`http://www.youtube.com/watch?v=${id}`, {
agent,
poToken: player.trustedTokens?.PO_TOKEN || undefined,
visitorData: player.trustedTokens?.VISITOR_DATA || undefined,
})
ytdl(`http://youtube.com/watch?v=${id}`, {
filter: 'audioonly',
quality: 'highestaudio',
dlChunkSize: 0,
highWaterMark: 1 << 62,
liveBuffer: 1 << 62,
poToken: player.trustedTokens?.PO_TOKEN || undefined,
visitorData: player.trustedTokens?.VISITOR_DATA || undefined,
})
Error
AudioPlayerError: All player APIs responded with an error. (Clients: web_creator, ios, android)
at _getBasicInfo (/app/node_modules/@ybd-project/ytdl-core/src/info.ts:452:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at _getInfo (/app/node_modules/@ybd-project/ytdl-core/src/info.ts:504:34) {
resource: AudioResource {
playStream: OggDemuxer {
_events: [Object],
_readableState: [ReadableState],
_writableState: [WritableState],
allowHalfOpen: true,
_maxListeners: undefined,
_eventsCount: 6,
_remainder: null,
_head: null,
_bitstream: null,
[Symbol(shapeMode)]: true,
[Symbol(kCapture)]: false,
[Symbol(kCallback)]: null
},
edges: [ [Object], [Object] ],
metadata: null,
volume: undefined,
encoder: undefined,
audioPlayer: AudioPlayer {
_events: [Object: null prototype],
_eventsCount: 3,
_maxListeners: undefined,
_state: [Object],
subscribers: [Array],
behaviors: [Object],
debug: [Function (anonymous)],
[Symbol(shapeMode)]: false,
[Symbol(kCapture)]: false
},
playbackDuration: 0,
started: false,
silencePaddingFrames: 5,
silenceRemaining: -1
}
}
I don't know if this will improve things, but try adding clients: ['web_creator', 'ios', 'android', 'tv_embedded']
as an argument.
ytdl(`http://youtube.com/watch?v=${id}`, {
filter: 'audioonly',
quality: 'highestaudio',
dlChunkSize: 0,
highWaterMark: 1 << 62,
liveBuffer: 1 << 62,
poToken: player.trustedTokens?.PO_TOKEN || undefined,
visitorData: player.trustedTokens?.VISITOR_DATA || undefined,
clients: ['web_creator', 'ios', 'android', 'tv_embedded'],
})
I don't know if this will improve things, but try adding
clients: ['web_creator', 'ios', 'android', 'tv_embedded']
as an argument.ytdl(`http://youtube.com/watch?v=${id}`, { filter: 'audioonly', quality: 'highestaudio', dlChunkSize: 0, highWaterMark: 1 << 62, liveBuffer: 1 << 62, poToken: player.trustedTokens?.PO_TOKEN || undefined, visitorData: player.trustedTokens?.VISITOR_DATA || undefined, clients: ['web_creator', 'ios', 'android', 'tv_embedded'], })
Same issue
Error: All player APIs responded with an error. (Clients: web_creator, ios, android, tv_embedded)
Same issue
Error: All player APIs responded with an error. (Clients: web_creator, ios, android, tv_embedded)
I understand. Then does the problem occur with all videos?
Same issue
Error: All player APIs responded with an error. (Clients: web_creator, ios, android, tv_embedded)
I understand. Then does the problem occur with all videos?
Yup, locally seems to be working fine (I don't even need poToken or cookies when running locally). The issue arises when using my aws vps.
On my test Glitch server, it works fine with the PoToken setting, so it is possible that the AWS VPS IP address is banned. I plan to have the next version output the details of the error.
On the digitalocean vps with the PoToken. onFailed Error: All player APIs responded with an error. (Clients: web_creator, ios, android) at _getBasicInfo (/usr/src/app/node_modules/@ybd-project/ytdl-core/package/info.js:326:15) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async _getInfo (/usr/src/app/node_modules/@ybd-project/ytdl-core/package/info.js:362:18)
I got the same issue when running it at AWS lambda function but no problem in local machine too
A few bug fixes and functions related to error logging have been added. (v5.0.14)
Please try npm install @ybd-project/ytdl-core@latest
.
For debugging logs, specify the environment variable “YTDL_DEBUG=true”.
A few bug fixes and functions related to error logging have been added. (v5.0.14) Please try
npm install @ybd-project/ytdl-core@latest
. For debugging logs, specify the environment variable “YTDL_DEBUG=true”.
digitalocean vps
Reason: Error: Status Code: 400
Reason: Error: Status Code: 400
Reason: Error: Status Code: 400 RequestError: Status Code: 400 at Object.request (/usr/src/app/node_modules/@ybd-project/ytdl-core/package/utils.js:193:19) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async playerAPI (/usr/src/app/node_modules/@ybd-project/ytdl-core/package/info.js:209:19) at async fetchSpecifiedPlayer (/usr/src/app/node_modules/@ybd-project/ytdl-core/package/info.js:268:12) at async Promise.allSettled (index 0) at async _getBasicInfo (/usr/src/app/node_modules/@ybd-project/ytdl-core/package/info.js:318:34) at async _getInfo (/usr/src/app/node_modules/@ybd-project/ytdl-core/package/info.js:367:18) { statusCode: 400 } onFailed Error: All player APIs responded with an error. (Clients: web_creator, ios, android) at _getBasicInfo (/usr/src/app/node_modules/@ybd-project/ytdl-core/package/info.js:331:15) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async _getInfo (/usr/src/app/node_modules/@ybd-project/ytdl-core/package/info.js:367:18)
digitalocean vps
Thanks for providing the logs. I think the status code 400 means that the IP is banned.
could anyone tell me what is the best reliable way to work around the server's IP being banned?
could anyone tell me what is the best reliable way to work around the server's IP being banned?
With a proxy, but it's not reliable at all and might have the same issues later on.
I agree vehemently. I used to use a proxy but it was not stable with occasional errors. I think the best way to get around the IP ban is to use serverless functions.
We are currently working on OAuth2 token support. Once this becomes possible, IP restrictions will be less likely than they are now.
OAuth2 tokens are now supported. Please install (npm i @ybd-project/ytdl-core@5.0.16
) the new version (v5.0.16).
See README for usage.
OAuth2 tokens are now supported. Please install (
npm i @ybd-project/ytdl-core@5.0.15
) the new version (v5.0.15). See README for usage.
tested and worked for me in aws Lambda function. Just wondering how to automate the refreshing access token in the future instead of manual work.
tested and worked for me in aws Lambda function. Just wondering how to automate the refreshing access token in the future instead of manual work.
I have implemented access token refresh, but I don't have expired tokens so I'd like to test it.
Well I was trying to run it with the oauth2 token on an Oracle Free Tier server and it got
UnrecoverableError: This live event will begin in 33 hours.
when runnint getInfo method.
Well I was trying to run it with the oauth2 token on an Oracle Free Tier server and it got
UnrecoverableError: This live event will begin in 33 hours.
when runnint getInfo method.
As you can see from the text, this error means that the video has not yet been released. Since videos that have not yet been released are not available, you will need to try again in 33 hours.
The original ytdl-core always provided video info or basic info even if the stream was scheduled in future
The original ytdl-core always provided video info or basic info even if the stream was scheduled in future
I see. That is the first time I have heard of that. Please wait while we implement it so that you can get the minimum information without error.
We are currently working on improving all Player API requests, etc., and this issue will be substantially remedied. A version implementing this will be released later today. This version will be the last update before the minor update.
A new version v5.0.20 has been released with improved requests to the player API and other improvements. Maybe this version will solve most of this problem.
@ybd-project my getInfo problem is resolved now. Still can't download my live streams with ytarchive. But that's not issue of your project.
@ybd-project my getInfo problem is resolved now. Still can't download my live streams with ytarchive. But that's not issue of your project.
Good. We are currently working on v5.1.0, so please be patient.
btw. the getFullInfo() method returns a lot less information than the getInfo() method from the node-ytdl-core package. Is this intentional or did youtube change ?
btw. the getFullInfo() method returns a lot less information than the getInfo() method from the node-ytdl-core package. Is this intentional or did youtube change ?
What specific information is this? I deleted data that I thought was unnecessary, so that may be the reason.
I used the whole videoDetails
I have a backend application monitoring given channels, I get pubsubhub notifications on new upcoming videos. I fetch videoDetails with ytdl-code and plan, schedule, etc. the recording of live events based on the data in this container.
I think the information in the videoDetails conforms to the original as much as possible. What information is missing from the videoDetails?
hmm... I'll test again to check it out.
hmm... I'll test again to check it out.
If possible, please let me know what specific information you would like to retrieve.
Quick check and I'm missing data for upcoming live events (example https://www.youtube.com/watch?v=PzfyPxadxVY) This lacks:
Quick check and I'm missing data for upcoming live events (example https://www.youtube.com/watch?v=PzfyPxadxVY) This lacks:
- videoDetails.isLiveContent
- videoDetails.liveBroadcastDetails
- videoDetails.videoId
- videoDetails.title
Thank you, this will help us improve v5.1.0.
Is it okay like this?
looks great. thnx
any ETA on the 5.1.0 version?
any ETA on the 5.1.0 version?
Is the v5.1.0 release? Or is it about the download progress?
No no its about the expected release time of v 5.1.0
No no its about the expected release time of v 5.1.0
Then, I still have two more things to do, so the earliest I can do that is tomorrow.
v5.1.0 has been released. Please refer to the README as significant changes have been made since the previous version.
Is the problem resolved? If no progress is made, close as not necessary to correct.
Describe the bug
Error: All player APIs responded with an error. (Clients: web_creator, ios, android) at _getBasicInfo (/home/container/node_modules/@ybd-project/ytdl-core/package/info.js:326:15) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async _getInfo (/home/container/node_modules/@ybd-project/ytdl-core/package/info.js:362:18) Emitted 'error' event on Client instance at: at emitUnhandledRejectionOrErr (node:events:402:10) at process.processTicksAndRejections (node:internal/process/task_queues:84:21)
Node.js v20.16.0