Skip to content

Commit 38e9da8

Browse files
AbduAmeenTobiGr
authored andcommitted
Adding removal of the braces
1 parent 36ebb63 commit 38e9da8

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,19 @@ public YoutubeThrottlingDecrypter() throws ParsingException {
6666

6767
private String parseDecodeFunctionName(final String playerJsCode)
6868
throws Parser.RegexException {
69-
return Parser.matchGroup1(FUNCTION_NAME_PATTERN, playerJsCode);
69+
String functionName = Parser.matchGroup1(FUNCTION_NAME_PATTERN, playerJsCode);
70+
int arrayStartBrace = functionName.indexOf("[");
71+
72+
if (arrayStartBrace > 0) {
73+
String arrayVarName = functionName.substring(0, arrayStartBrace);
74+
String order = functionName.substring(arrayStartBrace+1, functionName.indexOf("]"));
75+
int arrayNum = Integer.parseInt(order);
76+
Pattern ARRAY_PATTERN = Pattern.compile(String.format("var %s=\\[(.+?)\\];", arrayVarName));
77+
String arrayStr = Parser.matchGroup1(ARRAY_PATTERN, playerJsCode);
78+
String names[] = arrayStr.split(",");
79+
functionName = names[arrayNum];
80+
}
81+
return functionName;
7082
}
7183

7284
@Nonnull

0 commit comments

Comments
 (0)