From ab9989d41f64e1fe5b8eba4bda3bab3401504a63 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Tue, 26 Sep 2023 13:05:25 +0400 Subject: [PATCH] chore(YouTube - Client spoof): add logging. fix fall over logic if android client call fails --- .../patches/spoof/SpoofSignaturePatch.java | 3 --- .../spoof/requests/StoryboardRendererRequester.java | 12 ++++++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/app/revanced/integrations/patches/spoof/SpoofSignaturePatch.java b/app/src/main/java/app/revanced/integrations/patches/spoof/SpoofSignaturePatch.java index 452150e1..4c3fbaa6 100644 --- a/app/src/main/java/app/revanced/integrations/patches/spoof/SpoofSignaturePatch.java +++ b/app/src/main/java/app/revanced/integrations/patches/spoof/SpoofSignaturePatch.java @@ -50,9 +50,6 @@ public class SpoofSignaturePatch { private static volatile Future rendererFuture; - @Nullable - private static volatile StoryboardRenderer renderer; - @Nullable private static StoryboardRenderer getRenderer() { if (rendererFuture != null) { diff --git a/app/src/main/java/app/revanced/integrations/patches/spoof/requests/StoryboardRendererRequester.java b/app/src/main/java/app/revanced/integrations/patches/spoof/requests/StoryboardRendererRequester.java index 105772ef..d2b79e8d 100644 --- a/app/src/main/java/app/revanced/integrations/patches/spoof/requests/StoryboardRendererRequester.java +++ b/app/src/main/java/app/revanced/integrations/patches/spoof/requests/StoryboardRendererRequester.java @@ -63,9 +63,8 @@ public class StoryboardRendererRequester { @Nullable private static StoryboardRenderer getStoryboardRendererUsingBody(@NonNull String innerTubeBody) { final JSONObject playerResponse = fetchPlayerResponse(innerTubeBody); - Objects.requireNonNull(playerResponse); - - if (isPlayabilityStatusOk(playerResponse)) return getStoryboardRendererUsingResponse(playerResponse); + if (playerResponse != null && isPlayabilityStatusOk(playerResponse)) + return getStoryboardRendererUsingResponse(playerResponse); return null; } @@ -100,8 +99,13 @@ public class StoryboardRendererRequester { Objects.requireNonNull(videoId); var renderer = getStoryboardRendererUsingBody(String.format(ANDROID_INNER_TUBE_BODY, videoId)); - if (renderer == null) + if (renderer == null) { + LogHelper.printDebug(() -> videoId + " not available using android client"); renderer = getStoryboardRendererUsingBody(String.format(TV_EMBED_INNER_TUBE_BODY, videoId, videoId)); + if (renderer == null) { + LogHelper.printDebug(() -> videoId + " not available using tv embedded client"); + } + } return renderer; } catch (Exception ex) {