Adding removal of the braces
This commit is contained in:
parent
a9174f6b9f
commit
50a4b026f8
1 changed files with 13 additions and 1 deletions
|
@ -66,7 +66,19 @@ public class YoutubeThrottlingDecrypter {
|
||||||
|
|
||||||
private String parseDecodeFunctionName(final String playerJsCode)
|
private String parseDecodeFunctionName(final String playerJsCode)
|
||||||
throws Parser.RegexException {
|
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
|
@Nonnull
|
||||||
|
|
Loading…
Reference in a new issue