Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/focabot/ytdl-getinfo
Gets video information using youtube-dl
https://github.com/focabot/ytdl-getinfo
Last synced: 27 days ago
JSON representation
Gets video information using youtube-dl
- Host: GitHub
- URL: https://github.com/focabot/ytdl-getinfo
- Owner: FocaBot
- Created: 2017-04-12T04:19:50.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-04-18T09:46:57.000Z (over 1 year ago)
- Last Synced: 2024-04-26T11:20:31.851Z (9 months ago)
- Language: JavaScript
- Size: 84 KB
- Stars: 9
- Watchers: 2
- Forks: 4
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ytdl-getinfo ![](https://travis-ci.org/TheBITLINK/ytdl-getinfo.svg?branch=master)
Gets information on a video (or playlist) using youtube-dl.
Like the getInfo function of `node-youtube-dl`, but promisified and event-based.
## Usage
```javascript
const { getInfo } = require('ytdl-getinfo')
```## Examples
- Basic example:
```javascript
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:
```javascript
getInfo('Muzzy - Endgame').then(info => {
// info.items[0] contains information of the first search result
console.log(info.items[0].url)
})
```- Custom Arguments:
```javascript
getInfo('v7BddpYYNGk', ['--format=bestaudio']).then(info => {
// ...
})
```- Playlists (event based)
```javascript
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)
```javascript
getInfo('PLwiyx1dc3P2JR9N8gQaQN_BCvlSlap7re', [], true).then(info => {
// info.items contains all the playlist items
})
```- Multiple queries at once (acts like a playlist)
```javascript
getInfo(['v7BddpYYNGk', 'BMhrBLD_B2U']).then(info => {
// ...
})
```## Manually updating the youtube-dl binary
```javascript
require('ytdl-getinfo').update().then(version => {
console.log(`youtube-dl updated to version ${version}`)
})
```## Determining the version of the youtube-dl binary
```javascript
require('ytdl-getinfo').getVersion().then(version => {
console.log(`Current youtube-dl version: ${version}`)
})
```