From d7d424107210f9d13b6c5bf9432d0cdc8379324a Mon Sep 17 00:00:00 2001
From: Kelvin <kelvin@futo.org>
Date: Mon, 20 May 2024 15:41:13 +0200
Subject: [PATCH] Fix replies for authenticated user

---
 YoutubeConfig.json |  2 +-
 YoutubeScript.js   | 11 +++++++----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/YoutubeConfig.json b/YoutubeConfig.json
index 1ef252c..1f56192 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": 176,
+	"version": 177,
 	"iconUrl": "./youtube.png",
 	"id": "35ae969a-a7db-11ed-afa1-0242ac120002",
 
diff --git a/YoutubeScript.js b/YoutubeScript.js
index 2ab3b27..ef5c8f8 100644
--- a/YoutubeScript.js
+++ b/YoutubeScript.js
@@ -2837,10 +2837,10 @@ function requestCommentPager(contextUrl, continuationToken, useLogin, useMobile)
 								return;
 
 							const replyCount = (commentRenderer.replyCount ? commentRenderer?.replyCount : 0);
-							const replyContinuation = renderer.replies?.commentRepliesRenderer?.contents?.length == 1 ?
-								renderer.replies.commentRepliesRenderer.contents[0]?.continuationItemRenderer?.continuationEndpoint?.continuationCommand?.token :
+							let replyContinuation = renderer.replies?.commentRepliesRenderer?.contents?.length == 1 ?
+								(renderer.replies.commentRepliesRenderer.contents[0]?.continuationItemRenderer?.continuationEndpoint?.continuationCommand?.token
+									?? renderer.replies.commentRepliesRenderer.contents[0]?.continuationItemRenderer?.button?.buttonRenderer?.command?.continuationCommand?.token) :
 								null;
-
 							comments.push(extractCommentRenderer_Comment(contextUrl, commentRenderer, replyCount, replyContinuation, useLogin, useMobile));
 						},
 						commentRenderer(renderer) {
@@ -2879,7 +2879,10 @@ function requestCommentPager(contextUrl, continuationToken, useLogin, useMobile)
 				const cobj = commentObject?.payload?.commentEntityPayload ?? {};
 				const parent = parentItems.find(x=>x.commentThreadRenderer?.commentViewModel?.commentViewModel?.commentKey == commentObject.entityKey);
 				const replyContents = parent?.commentThreadRenderer?.replies?.commentRepliesRenderer?.contents;
-				const replyContinuation = ((replyContents?.length ?? 0) > 0) ? replyContents[0].continuationItemRenderer?.continuationEndpoint?.continuationCommand?.token : null;
+				const replyContinuation = ((replyContents?.length ?? 0) > 0) ? 
+					(replyContents[0].continuationItemRenderer?.continuationEndpoint?.continuationCommand?.token ??
+						replyContents[0].continuationItemRenderer?.button?.buttonRenderer?.command?.continuationCommand?.token) : 
+					null;
 				
 				const authorEndpoint = cobj.author?.channelCommand?.innertubeCommand?.commandMetadata?.webCommandMetadata?.url;
 				comments.push(new YTComment({
-- 
GitLab