Skip to content

Commit 4181625

Browse files
gechotoStypox
authored andcommitted
add comment to throttling parameter deobfuscation function fixup
1 parent e0d39b6 commit 4181625

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeThrottlingParameterUtils.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,20 @@ private static String validateFunction(@Nonnull final String function) {
239239
}
240240

241241
/**
242+
* Removes an early return statement from the code of the throttling parameter deobfuscation function.
242243
*
243-
* @param function
244-
* @return
245-
* @throws Parser.RegexException
244+
* <p>In newer version of the player code the function contains a check for something defined outside of the function.
245+
* If that was not found it will return early.
246+
*
247+
* <p>The check can look like this (JS):<br>
248+
* if(typeof RUQ==="undefined")return p;
249+
*
250+
* <p>In this example RUQ will always be undefined when running the function as standalone.
251+
* If the check is kept it would just return p which is the input parameter and would be wrong.
252+
* For that reason this check and return statement needs to be removed.
253+
*
254+
* @param function the original throttling parameter deobfuscation function code
255+
* @return the throttling parameter deobfuscation function code with the early return statement removed
246256
*/
247257
@Nonnull
248258
private static String fixupFunction(@Nonnull final String function)

0 commit comments

Comments
 (0)