const yt = require('youtube-transcript'); yt.YoutubeTranscript.fetchTranscript('https://www.youtube.com/watch?v=D98UJl6Ea6o') .then(res => console.log('Length:', res.map(t => t.text).join(' ').length)) .catch(console.error);