File tree Expand file tree Collapse file tree
extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -48,6 +48,9 @@ public final class YoutubeThrottlingDecrypter {
4848 private static final String DECRYPT_FUNCTION_BODY_REGEX =
4949 "=\\ s*function([\\ S\\ s]*?\\ }\\ s*return [\\ w$]+?\\ .join\\ (\" \" \\ )\\ s*\\ };)" ;
5050
51+ private static final String DECRYPT_FUNCTION_ARRAY_OBJECT_TYPE_DECLARATION_REGEX = "var " ;
52+ private static final String FUNCTION_NAMES_IN_DECRYPT_ARRAY_REGEX = "\\ s*=\\ s*\\ [(.+?)][;,]" ;
53+
5154 private static final Map <String , String > N_PARAMS_CACHE = new HashMap <>();
5255 private static String decryptFunction ;
5356 private static String decryptFunctionName ;
@@ -117,7 +120,8 @@ private static String parseDecodeFunctionName(final String playerJsCode)
117120
118121 final int arrayNum = Integer .parseInt (matcher .group (2 ));
119122 final Pattern arrayPattern = Pattern .compile (
120- "var " + Pattern .quote (functionName ) + "\\ s*=\\ s*\\ [(.+?)];" );
123+ DECRYPT_FUNCTION_ARRAY_OBJECT_TYPE_DECLARATION_REGEX + Pattern .quote (functionName )
124+ + FUNCTION_NAMES_IN_DECRYPT_ARRAY_REGEX );
121125 final String arrayStr = Parser .matchGroup1 (arrayPattern , playerJsCode );
122126 final String [] names = arrayStr .split ("," );
123127 return names [arrayNum ];
You can’t perform that action at this time.
0 commit comments