Imrpoved error handling for youtube fetches.
This commit is contained in:
parent
9d9aa5672f
commit
a71f1d6cc0
|
|
@ -53,6 +53,8 @@ queuedProperties.methods.rehydrate = function(){
|
|||
this.id,
|
||||
this.type,
|
||||
this.duration,
|
||||
//We don't save raw links that are stored seperate from the standard URL as they tend to expire.
|
||||
null,
|
||||
this.startTime,
|
||||
this.startTimeStamp,
|
||||
this.earlyEnd,
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ module.exports.socketExceptionHandler = function(socket, err){
|
|||
module.exports.localExceptionHandler(err);
|
||||
|
||||
//if not yell at the browser for fucking up
|
||||
return module.exports.socketErrorHandler(socket, "Server Error!", "An unexpected server crash was just prevented. You should probably report this to an admin.");
|
||||
return module.exports.socketErrorHandler(socket, "An unexpected server crash was just prevented. You should probably report this to an admin.", "Server");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,9 +30,20 @@ const regexUtils = require('../regexUtils.js');
|
|||
const loggerUtils = require('../loggerUtils.js')
|
||||
|
||||
module.exports.fetchYoutubeVideoMetadata = async function(id, title){
|
||||
const media = await fetchMetadata(`youtu.be/${id}`, title,'yt');
|
||||
try{
|
||||
//Try to pull media from youtube id
|
||||
const media = await fetchMetadata(`https://youtu.be/${id}`, title,'yt');
|
||||
|
||||
return media;
|
||||
//Return found media
|
||||
return media;
|
||||
//If something went wrong
|
||||
}catch(err){
|
||||
//If our IP was banned by youtube
|
||||
if(err.message.match("Sign in to confirm you’re not a bot.")){
|
||||
//Make our own error with blackjack and hookers
|
||||
throw loggerUtils.exceptionSmith("The server's IP address has been banned by youtube. Please contact your server's administrator.", "queue");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Generic YTDLP function meant to be used by service-sepecific fetchers which will then be used to fetch video metadata
|
||||
|
|
|
|||
Loading…
Reference in a new issue