-
Notifications
You must be signed in to change notification settings - Fork 803
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Download a private video youtube #1282
Comments
I think you have to go to YouTube.com when you're signed in then put this in the console to see your cookies:
But, I'm on a phone right now... so who knows. |
I got it to work but not using the cookie approach, but using the headers directly To get the headers using Chrome:
Hope this helped 😄, I'll add my code too, if this worked don't forget to close the issue This is my code: const ytdl = require('ytdl-core');
const path = require('path');
const fs = require('fs');
const videoID = "YOUR VIDEO ID";
const HEADERS = "YOUR HEADERS OBJECT";
const outputName = 'video.mp4';
const outputPath = path.resolve(__dirname, outputName);
const video = ytdl(videoID, {
requestOptions: {
headers: HEADERS
},
});
video.on('info', (info) => {
console.log('title:', info.videoDetails.title);
console.log('rating:', info.player_response.videoDetails.averageRating);
console.log('uploaded by:', info.videoDetails.author.name);
});
video.on('progress', (chunkLength, downloaded, total) => {
const percent = downloaded / total;
console.log('downloading', `${(percent * 100).toFixed(1)}%`);
});
video.on('end', () => {
console.log('saved to', outputName);
});
video.pipe(fs.createWriteStream(outputPath)); |
bro can u explain it a bit more to how to find these as i unable to find them |
Oh, that makes sense. you have to go to the network tab in developer tools if you’re confused |
ytdl-core: ^4.11.5
i try to use this example to download a private video youtube but not working.
https://github.com/fent/node-ytdl-core/blob/master/example/cookies.js
on this example should inject cookie and x-youtube-identity-token
so how can get cookie value ?
The text was updated successfully, but these errors were encountered: