Adding removal of the braces

This commit is contained in:
Abdu Ameen 2022-01-31 23:52:31 -08:00 committed by TobiGr
parent 36ebb633a4
commit 38e9da8d44
1 changed files with 13 additions and 1 deletions

View File

@ -66,7 +66,19 @@ public class YoutubeThrottlingDecrypter {
private String parseDecodeFunctionName(final String playerJsCode)
throws Parser.RegexException {
return Parser.matchGroup1(FUNCTION_NAME_PATTERN, playerJsCode);
String functionName = Parser.matchGroup1(FUNCTION_NAME_PATTERN, playerJsCode);
int arrayStartBrace = functionName.indexOf("[");
if (arrayStartBrace > 0) {
String arrayVarName = functionName.substring(0, arrayStartBrace);
String order = functionName.substring(arrayStartBrace+1, functionName.indexOf("]"));
int arrayNum = Integer.parseInt(order);
Pattern ARRAY_PATTERN = Pattern.compile(String.format("var %s=\\[(.+?)\\];", arrayVarName));
String arrayStr = Parser.matchGroup1(ARRAY_PATTERN, playerJsCode);
String names[] = arrayStr.split(",");
functionName = names[arrayNum];
}
return functionName;
}
@Nonnull