From 69f03144397da058b85cc4bf540e8f83f078a75a Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Tue, 10 Sep 2024 00:52:50 -0400 Subject: [PATCH] fix: Simplify fetch request hook --- .../youtube/patches/spoof/SpoofClientPatch.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/app/revanced/integrations/youtube/patches/spoof/SpoofClientPatch.java b/app/src/main/java/app/revanced/integrations/youtube/patches/spoof/SpoofClientPatch.java index e0bada0078..cbaaf0eefc 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/patches/spoof/SpoofClientPatch.java +++ b/app/src/main/java/app/revanced/integrations/youtube/patches/spoof/SpoofClientPatch.java @@ -4,8 +4,6 @@ import androidx.annotation.Nullable; -import org.chromium.net.UrlRequest; - import java.nio.ByteBuffer; import java.util.Map; import java.util.Objects; @@ -93,28 +91,25 @@ public static boolean isSpoofingEnabled() { /** * Injection point. */ - public static UrlRequest buildRequest(UrlRequest.Builder builder, String url, - Map playerHeaders) { + public static void fetchStreams(String url, Map requestHeaders) { if (SPOOF_STREAMING_DATA) { try { Uri uri = Uri.parse(url); String path = uri.getPath(); if (path != null && path.contains("player") && !path.contains("heartbeat")) { String videoId = Objects.requireNonNull(uri.getQueryParameter("id")); - StreamingDataRequest.fetchRequest(videoId, playerHeaders); + StreamingDataRequest.fetchRequest(videoId, requestHeaders); } } catch (Exception ex) { Logger.printException(() -> "buildRequest failure", ex); } } - - return builder.build(); } /** * Injection point. * Fix playback by replace the streaming data. - * Called after {@link #buildRequest(UrlRequest.Builder, String, Map)}. + * Called after {@link #fetchStreams(String, Map)}. */ @Nullable public static ByteBuffer getStreamingData(String videoId) {