yg

ytdl-getinfo

Gets video information using youtube-dl

Showing:

Popularity

Downloads/wk

52

Maintenance

No Maintenance Data Available

Package

Dependencies

1

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

ytdl-getinfo

Gets information on a video (or playlist) using youtube-dl.

Like the getInfo function of node-youtube-dl, but promisified and event-based.

Usage

const { getInfo } = require('ytdl-getinfo')

Examples

  • Basic example:

    getInfo('https://www.youtube.com/watch?v=v7BddpYYNGk').then(info => {
      // info.items[0] should contain the output of youtube-dl --dump-json
      console.log(info.items[0].title)
    })
    
  • Video Search:

    getInfo('Muzzy - Endgame').then(info => {
      // info.items[0] contains information of the first search result
      console.log(info.items[0].url)    
    })
    
  • Custom Arguments:

    getInfo('v7BddpYYNGk', ['--format=bestaudio']).then(info => {
      // ...
    })
    
  • Playlists (event based)

    getInfo('PLwiyx1dc3P2JR9N8gQaQN_BCvlSlap7re').then(info => {
      // info.partial is true for playlists
      if (info.partial) {
        info.on('video', v => console.log(v.title))
        info.on('done', () => console.log(`Playlist contains ${info.items.length} items.`))
      }
    })
    
  • Playlists (promise based)

    getInfo('PLwiyx1dc3P2JR9N8gQaQN_BCvlSlap7re', [], true).then(info => {
      // info.items contains all the playlist items
    })
    
  • Multiple queries at once (acts like a playlist)

    getInfo(['v7BddpYYNGk', 'BMhrBLD_B2U']).then(info => {
      // ...
    })
    

Manually updating the youtube-dl binary

require('ytdl-getinfo').update().then(version => {
  console.log(`youtube-dl updated to version ${version}`)
})

Determining the version of the youtube-dl binary

require('ytdl-getinfo').getVersion().then(version => {
  console.log(`Current youtube-dl version: ${version}`)
})

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial