0.1.0 • Published 6 years ago

@joegesualdo/get-youtube-subtitle-url-node v0.1.0

Weekly downloads
269
License
MIT
Repository
github
Last release
6 years ago

get-youtube-subtitle-url Build Status

Get the url for a youtube video's subtitles.

Install

$ npm install --save @joegesualdo/get-youtube-subtitle-url-node

Usage

import getYoutubeSubtitleUrl from '@joegesualdo/get-youtube-subtitle-url-node';

const videoId ='7W-d2gtis7k'
getYoutubeSubtitleUrl('TImPW-khOww')
.then((result) => {
  console.log(result)
  // {
  //   automaticallyGenerated: false,
  //   url: 'https://www.youtube.com/api/timedtext?lang=en&fmt=vtt&name=&v=TImPW-khOww'
  // }
})
.catch(err => {
  // Executed if subtitles are not available for this video.
})

API

getYoutubeSubtitleUrl(videoId, opts)

Fetches the url for the subtitles

NameTypeDescription
videoIdStringThe id of the youtube video

Returns: Object, with the url and whether or not the subtitles were automatically generated.

Options
NameTypeDefaultOptionsDescription
typeStringeitherauto, nonauto, eitherThe type of subtitles
import getYoutubeSubtitleUrl from '@joegesualdo/get-youtube-subtitle-url-node';

const videoId ='TImPW-khOww'
getYoutubeSubtitleUrl('TImPW-khOww', {type: 'nonauto'})
.then((result) => {
  console.log(result)
  // {
  //   automaticallyGenerated: false,
  //   url: 'https://www.youtube.com/api/timedtext?lang=en&fmt=vtt&name=&v=TImPW-khOww'
  // }
})
.catch(err => {
  // Executed if subtitles are not available for this video.
})

Test

$ npm test

License

MIT © Joe Gesualdo

0.1.0

6 years ago

0.0.16

8 years ago

0.0.15

8 years ago

0.0.13

8 years ago

0.0.12

8 years ago

0.0.10

8 years ago

0.0.9

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago