Skip to content

Commit

Permalink
Update info.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Luuk-Dev authored Jul 17, 2024
1 parent c700cab commit 5bbacd9
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,13 @@ function getInfo(ytstream, url, force = false){
reject(`The YouTube song has no initial player response`);
return;
}
var seperate = res.split(`,"uploadDate":`);
if(seperate.length < 2){
var seperate = res.split(/};[a-z]/);
try{
var data = JSON.parse(seperate[0]+"}");
} catch {
reject(`The YouTube song has no initial player response`);
return;
}
var uploadDateValue = seperate[1].split("}}")[0];
res = seperate[0] + `,"uploadDate":${uploadDateValue}}}}`;
var data = JSON.parse(res);
if (data.playabilityStatus.status !== 'OK'){
var error = data.playabilityStatus.errorScreen.playerErrorMessageRenderer ? data.playabilityStatus.errorScreen.playerErrorMessageRenderer.reason.simpleText : data.playabilityStatus.errorScreen.playerKavRenderer.reason.simpleText;

Expand Down

0 comments on commit 5bbacd9

Please sign in to comment.