Skip to content

Commit

Permalink
Unideal patch for #7, hopefully the api will be updated.
Browse files Browse the repository at this point in the history
  • Loading branch information
CombustibleToast committed Jul 25, 2023
1 parent 0a5d096 commit 3d5b5cc
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions lib/musicFunctions/enqueueQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,20 @@ async function getQuery(query) {
const pushVideoInfo = async (url) => {
//There's a bug that prevents the below line from working in the base repo.
//Use `npm i ytdl-core@npm:@distube/ytdl-core` instead
const videoInfo = await ytdl.getInfo(url);
result.push({ title: videoInfo.videoDetails.title, url: videoInfo.videoDetails.video_url });

//getInfo() is also causing this issue:https://github.com/CombustibleToast/CAROLINE/issues/7
//So i'm adding the try catch
let videoInfo;
try{
console.log(`Getting ${url}`);
videoInfo = await ytdl.getInfo(url);
console.log(`Enqueued ${url} (${videoInfo.videoDetails.title})`);
}
catch(e){
console.log(`MUSIC - [WARN] ytdl.getInfo() error:\n${e.message}`);
}
if(videoInfo)
result.push({ title: videoInfo.videoDetails.title, url: videoInfo.videoDetails.video_url });
}

//Testing for playlist URL
Expand Down

0 comments on commit 3d5b5cc

Please sign in to comment.