diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeThrottlingDecrypter.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeThrottlingDecrypter.java index 9b154f008..48a8f64d2 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeThrottlingDecrypter.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeThrottlingDecrypter.java @@ -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