get-youtube-subtitles-node icon indicating copy to clipboard operation
get-youtube-subtitles-node copied to clipboard

Error with the example

Open matiasbenedetto opened this issue 6 years ago • 5 comments

Hello, im trying to run this example, but im getting this error, with Node 8 LTS on Ubuntu:

var getYoutubeSubtitles = require('@joegesualdo/get-youtube-subtitles-node'); 
let videoId = 'q_q61B-DyPk' 
getYoutubeSubtitles(videoId)
.then(subtitles => {
  console.log(subtitles)
})
.catch(err => {
  console.log(err)
})

The error:

~/dev/subs $ nodejs app.js
/home/matias/dev/subs/node_modules/@joegesualdo/get-youtube-subtitles-node/index.js:7
  let type = options.type || 'either';
                     ^

TypeError: Cannot read property 'type' of undefined
    at getYoutubeSubtitles (/home/matias/dev/subs/node_modules/@joegesualdo/get-youtube-subtitles-node/index.js:7:22)
    at Object.<anonymous> (/home/matias/dev/subs/app.js:5:1)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:188:16)
    at bootstrap_node.js:609:3

matiasbenedetto avatar May 13 '18 19:05 matiasbenedetto

I have the same error. the function takes another parameter options which take one of the values : auto, nonauto, either. so you call the function like that : getYoutubeSubtitles('q_q61B-DyPk', {type: 'nonauto'})

hichammoad avatar Jun 25 '18 01:06 hichammoad

facing the same issue here !

rocktimsaikia avatar Mar 21 '19 16:03 rocktimsaikia

I have the same error.

bedcoding avatar Jan 21 '21 07:01 bedcoding

just pass empty object, for example getYoutubeSubtitles(videoId, {})

Jin-zakk avatar Mar 28 '21 11:03 Jin-zakk

I have tried both 'auto' and 'nonauto' as optional parameter. getYoutubeSubtitles(videoId, { type: 'nonauto' }) Unfortunately, I am always getting "Subtitles dont exist for video_id_goes_here" error?

shahriarhossain avatar Jan 07 '23 06:01 shahriarhossain