diff --git a/YoutubeConfig.json b/YoutubeConfig.json index edc1f7a0ad41a4ea79848f15f3956011a5b10700..514df09bf49a9f47c24529e6c32987d2343e1ad7 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": 154, + "version": 155, "iconUrl": "./youtube.png", "id": "35ae969a-a7db-11ed-afa1-0242ac120002", diff --git a/YoutubeScript.js b/YoutubeScript.js index c0b85b85615fcde23ba8e6b7a786779bec7c36a9..4487157695e723a572a2c2da8a5ba44ee062d17b 100644 --- a/YoutubeScript.js +++ b/YoutubeScript.js @@ -3597,9 +3597,15 @@ function ytLangIdToLanguage(id) { if(!id) return Language.UNKNOWN; const langParts = id?.split("."); - const langPart = (langParts && langParts.length > 0) ? langParts[0] : ""; + let langPart = (langParts && langParts.length > 0) ? langParts[0] : ""; if(ytLangMap[langPart]) - return ytLangMap[langPart]; + return ytLangMap[langPart]; //Backwards compat + if(langPart.indexOf("-") > 0) + langPart = langPart.split("-")[0].trim(); + if(ytLangMap[langPart]) + return ytLangMap[langPart]; //Backwards compat + if(langPart && langPart.length > 0) + return langPart.trim(); return Language.UNKNOWN; }