From 4181625c2cfd41be6e3260a2f476df0f0930888f Mon Sep 17 00:00:00 2001 From: gechoto <124326167+gechoto@users.noreply.github.com> Date: Tue, 31 Dec 2024 16:50:14 +0100 Subject: [PATCH] add comment to throttling parameter deobfuscation function fixup --- .../youtube/YoutubeThrottlingParameterUtils.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeThrottlingParameterUtils.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeThrottlingParameterUtils.java index 1fa74a162..ef7a1d0d8 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeThrottlingParameterUtils.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeThrottlingParameterUtils.java @@ -239,10 +239,20 @@ final class YoutubeThrottlingParameterUtils { } /** + * Removes an early return statement from the code of the throttling parameter deobfuscation function. * - * @param function - * @return - * @throws Parser.RegexException + *
In newer version of the player code the function contains a check for something defined outside of the function. + * If that was not found it will return early. + * + *
The check can look like this (JS):
+ * if(typeof RUQ==="undefined")return p;
+ *
+ *
In this example RUQ will always be undefined when running the function as standalone. + * If the check is kept it would just return p which is the input parameter and would be wrong. + * For that reason this check and return statement needs to be removed. + * + * @param function the original throttling parameter deobfuscation function code + * @return the throttling parameter deobfuscation function code with the early return statement removed */ @Nonnull private static String fixupFunction(@Nonnull final String function)