From b32f7ba26ecc44e3dd5c907058673e671c4b243c Mon Sep 17 00:00:00 2001
From: Kelvin <kelvin@futo.org>
Date: Sun, 30 Jun 2024 17:10:54 +0200
Subject: [PATCH] Fallback trending

---
 YoutubeConfig.json | 2 +-
 YoutubeScript.js   | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/YoutubeConfig.json b/YoutubeConfig.json
index fac48d5..1e61780 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": 182,
+	"version": 183,
 	"iconUrl": "./youtube.png",
 	"id": "35ae969a-a7db-11ed-afa1-0242ac120002",
 
diff --git a/YoutubeScript.js b/YoutubeScript.js
index 21acf07..7531cdc 100644
--- a/YoutubeScript.js
+++ b/YoutubeScript.js
@@ -239,6 +239,12 @@ source.getTrending = () => {
         if(bridge.devSubmit) bridge.devSubmit("getTrending - No tabs found..", JSON.stringify(initialData));
 		throw new ScriptException("No tabs found..");
 	}
+	let tab = tabs[0];
+	if (tab.videos.length === 0) {
+		if (tab.shelves.length > 0) {
+			tab = tab.shelves[0];
+		}
+	}
 	return new RichGridPager(tabs[0], {}, USE_MOBILE_PAGES, false);
 };
 
-- 
GitLab