How to use the ytdl-core.getInfoAsync function in ytdl-core

To help you get started, we’ve selected a few ytdl-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rem-bot-industries / rem-v2 / src / modules / resolver / youtubeResolver.js View on Github external
async resolve(url) {
        // console.log(url);
        let info = await ytdl.getInfoAsync(url);
        if (info.live_playback === '1') {
            try {
                // console.log(info);
                let info = await this.resolveLiveStream(url);
                info.loaderUrl = `https://www.youtube.com/watch?v=${info.video_id}`;
                let streamUrl = this.filterLiveStreams(info.formats);
                if (!streamUrl) {
                    return Promise.reject({message: 'No suitable format found!'});
                } else {
                    return new Song({
                        id: info.video_id,
                        title: info.title,
                        duration: 'live',
                        type: types.youtube_live,
                        url: info.loaderUrl,
                        streamUrl: streamUrl,