so I'm making a project using YTDL-core
I had a question, how can I get the file size of each resolution without downloading it
my code so far
const { getInfo } = require("ytdl-core");
const ytdl = require("ytdl-core")
const url = 'https://www.youtube.com/watch?v=FOwXlANwerI'
const vid = ytdl(url)
ytdl.getInfo(url).then(info =>{
console.log("Video Title : "+ info.videoDetails.title)
})
Iwant to make like
console.log("144p" + 144 p size)
console.log("240p" + 240 p size)
console.log("360p" + 360 p size)
console.log("480p" + 480 p size)
how can i do that ?
Use
formats.contentLength
.formats[]
is an array populated with details for every format found, obtained for example calling ytdl.getBasicInfo()This is an extract of a typical JSON response: