Get the subtitles of a youtube video.
Get the subtitles of a youtube video.
$ npm install --save @joegesualdo/get-youtube-subtitles-node
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)
})
$ npm test
getYoutubeSubtitles(youtubeVideoId, options)
Returns a promise that passes the resulting subtitles json.
Name | Type | Description |
---|---|---|
youtubeVideoId | Number |
The id of the video you want to get the subtitles for |
Name | Type | Default | Options | Description |
---|---|---|---|---|
type | String |
either |
auto , nonauto , either
|
The id of the video you want to get the subtitles for |
Returns: Promise
, that passes the resulting subtitles.
var getYoutubeSubtitles = require('@joegesualdo/get-youtube-subtitles-node');
let videoId = 'q_q61B-DyPk'
getYoutubeSubtitles(videoId, {type: 'nonauto'})
.then(subtitles => {
console.log(subtitles)
})
.catch(err => {
console.log(err)
})
$ npm run build
MIT © Joe Gesualdo