Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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,