From 537b440b53e095e4f5f6adabeccecd6043b55bd1 Mon Sep 17 00:00:00 2001 From: Kelvin <kelvin@futo.org> Date: Fri, 5 Jan 2024 17:04:19 +0100 Subject: [PATCH] Fixing wrong video errors and missing object case --- YoutubeConfig.json | 2 +- YoutubeScript.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/YoutubeConfig.json b/YoutubeConfig.json index 7d66bd7..e851b03 100644 --- a/YoutubeConfig.json +++ b/YoutubeConfig.json @@ -7,7 +7,7 @@ "sourceUrl": "https://plugins.grayjay.app/Youtube/YoutubeConfig.json", "repositoryUrl": "https://futo.org", "scriptUrl": "./YoutubeScript.js", - "version": 162, + "version": 163, "iconUrl": "./youtube.png", "id": "35ae969a-a7db-11ed-afa1-0242ac120002", diff --git a/YoutubeScript.js b/YoutubeScript.js index e1dc799..a023d18 100644 --- a/YoutubeScript.js +++ b/YoutubeScript.js @@ -356,7 +356,7 @@ source.getContentDetails = (url, useAuth) => { const initialData = getInitialData(html); let initialPlayerData = getInitialPlayerData(html); - if(initialPlayerData.playabilityStatus.status == "UNPLAYABLE") + if(initialPlayerData?.playabilityStatus?.status == "UNPLAYABLE") throw new UnavailableException("Video unplayable"); const jsUrlMatch = html.match("PLAYER_JS_URL\"\\s?:\\s?\"(.*?)\""); @@ -401,7 +401,7 @@ source.getContentDetails = (url, useAuth) => { url: url }, jsUrl); if(videoDetails == null) - return new UnavailableException("No video found"); + throw new UnavailableException("No video found"); if(!videoDetails.live && (videoDetails.video?.videoSources == null || videoDetails.video.videoSources.length == 0) && -- GitLab