youtube: return different error message if video doesn't exist

This commit is contained in:
dumbmoron 2024-05-29 08:28:17 +00:00
parent 44ecfeeea7
commit b7697268e5
No known key found for this signature in database

View file

@ -62,8 +62,12 @@ export default async function(o) {
try {
info = await yt.getBasicInfo(o.id, 'WEB');
} catch {
return { error: 'ErrorCantConnectToServiceAPI' };
} catch(e) {
if (e?.message === 'This video is unavailable') {
return { error: 'ErrorCouldntFetch' };
} else {
return { error: 'ErrorCantConnectToServiceAPI' };
}
}
if (!info) return { error: 'ErrorCantConnectToServiceAPI' };