From 14f7ef1093ece92d81f8f7aed75de9ce90e9086d Mon Sep 17 00:00:00 2001 From: gechoto <124326167+gechoto@users.noreply.github.com> Date: Sun, 5 Jan 2025 20:39:53 +0000 Subject: [PATCH] YoutubeThrottlingParameterUtils: add back second regex and swap it with the third one --- .../YoutubeThrottlingParameterUtils.java | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 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 2947689fd..5f6997cf0 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 @@ -41,21 +41,6 @@ final class YoutubeThrottlingParameterUtils { + MULTIPLE_CHARS_REGEX + "]\\|\\|null\\)&&\\(" + MULTIPLE_CHARS_REGEX + "=(" + MULTIPLE_CHARS_REGEX + ")" + ARRAY_ACCESS_REGEX + "\\("), - /* - * This regex matches the following text, where we want Wma: - * - * a.D&&(b="nn"[+a.D],WL(a),c=a.j[b]||null)&&(c=SDa[0](c),a.set(b,c),SDa.length||Wma("") - * - * UPDATE: This is broken and Wma is not the function needed anymore. - * We need the function which is in SDa[0] instead. - */ -// Pattern.compile(SINGLE_CHAR_VARIABLE_REGEX + "=\"nn\"\\[\\+" + MULTIPLE_CHARS_REGEX -// + "\\." + MULTIPLE_CHARS_REGEX + "]," + MULTIPLE_CHARS_REGEX + "\\(" -// + MULTIPLE_CHARS_REGEX + "\\)," + MULTIPLE_CHARS_REGEX + "=" -// + MULTIPLE_CHARS_REGEX + "\\." + MULTIPLE_CHARS_REGEX + "\\[" -// + MULTIPLE_CHARS_REGEX + "]\\|\\|null\\).+\\|\\|(" + MULTIPLE_CHARS_REGEX -// + ")\\(\"\"\\)"), - /* * The second regex matches the following text, where we want SDa and the array index * accessed: @@ -70,7 +55,22 @@ final class YoutubeThrottlingParameterUtils { + MULTIPLE_CHARS_REGEX + ")" + ARRAY_ACCESS_REGEX), /* - * The third regex matches the following text, where we want rma: + * The third regex matches the following text, where we want Wma: + * + * a.D&&(b="nn"[+a.D],WL(a),c=a.j[b]||null)&&(c=SDa[0](c),a.set(b,c),SDa.length||Wma("") + * + * UPDATE: This is prone to find the wrong function on recent version of the player. + * For this reason a regex which finds the Array + index should be preferred / above. + */ + Pattern.compile(SINGLE_CHAR_VARIABLE_REGEX + "=\"nn\"\\[\\+" + MULTIPLE_CHARS_REGEX + + "\\." + MULTIPLE_CHARS_REGEX + "]," + MULTIPLE_CHARS_REGEX + "\\(" + + MULTIPLE_CHARS_REGEX + "\\)," + MULTIPLE_CHARS_REGEX + "=" + + MULTIPLE_CHARS_REGEX + "\\." + MULTIPLE_CHARS_REGEX + "\\[" + + MULTIPLE_CHARS_REGEX + "]\\|\\|null\\).+\\|\\|(" + MULTIPLE_CHARS_REGEX + + ")\\(\"\"\\)"), + + /* + * The fourth regex matches the following text, where we want rma: * * a.D&&(b="nn"[+a.D],c=a.get(b))&&(c=rDa[0](c),a.set(b,c),rDa.length||rma("") */ @@ -80,7 +80,7 @@ final class YoutubeThrottlingParameterUtils { + MULTIPLE_CHARS_REGEX + ")\\(\"\"\\)"), /* - * The fourth regex matches the following text, where we want rDa and the array index + * The fifth regex matches the following text, where we want rDa and the array index * accessed: * * a.D&&(b="nn"[+a.D],c=a.get(b))&&(c=rDa[0](c),a.set(b,c),rDa.length||rma("") @@ -91,7 +91,7 @@ final class YoutubeThrottlingParameterUtils { + MULTIPLE_CHARS_REGEX + "=(" + MULTIPLE_CHARS_REGEX + ")\\[(\\d+)]"), /* - * The fifth regex matches the following text, where we want BDa and the array index + * The sixth regex matches the following text, where we want BDa and the array index * accessed: * * (b=String.fromCharCode(110),c=a.get(b))&&(c=BDa[0](c) @@ -103,7 +103,7 @@ final class YoutubeThrottlingParameterUtils { + SINGLE_CHAR_VARIABLE_REGEX + "\\)"), /* - * The sixth regex matches the following text, where we want Yva and the array index + * The seventh regex matches the following text, where we want Yva and the array index * accessed: * * .get("n"))&&(b=Yva[0](b)