@@ -583,21 +583,14 @@ public String getErrorMessage() {
583583 private static final String HTTPS = "https:" ;
584584 private static final String DECRYPTION_FUNC_NAME = "decrypt" ;
585585
586- private final static String [] REGEXES = {
587- "\\ b[cs]\\ s*&&\\ s*[adf]\\ .set\\ ([^,]+\\ s*,\\ s*encodeURIComponent\\ s*\\ (\\ s*([a-zA-Z0-9$]+)\\ (" ,
588- "\\ b[a-zA-Z0-9]+\\ s*&&\\ s*[a-zA-Z0-9]+\\ .set\\ ([^,]+\\ s*,\\ s*encodeURIComponent\\ s*\\ (\\ s*([a-zA-Z0-9$]+)\\ (" ,
589- "\\ b([a-zA-Z0-9$]{2})\\ s*=\\ s*function\\ (\\ s*a\\ s*\\ )\\ s*\\ {\\ s*a\\ s*=\\ s*a\\ .split\\ (\\ s*\" \" \\ s*\\ )" ,
590- "([a-zA-Z0-9$]+)\\ s*=\\ s*function\\ (\\ s*a\\ s*\\ )\\ s*\\ {\\ s*a\\ s*=\\ s*a\\ .split\\ (\\ s*\" \" \\ s*\\ )" ,
591- // Obsolete patterns
592- "[\" ']signature[\" ']\\ s*,\\ s*([a-zA-Z0-9$]+)\\ (" ,
593- "\\ .sig\\ |\\ |([a-zA-Z0-9$]+)\\ (" ,
594- "yt\\ .akamaized\\ .net/\\ )\\ s*\\ |\\ |\\ s*.*?\\ s*[cs]\\ s*&&\\ s*[adf]\\ .set\\ ([^,]+\\ s*,\\ s*(?:encodeURIComponent\\ s*\\ ()?\\ s*([a-zA-Z0-9$]+)\\ (" ,
595- "\\ b[cs]\\ s*&&\\ s*[adf]\\ .set\\ ([^,]+\\ s*,\\ s*([a-zA-Z0-9$]+)\\ (" ,
596- "\\ b[a-zA-Z0-9]+\\ s*&&\\ s*[a-zA-Z0-9]+\\ .set\\ ([^,]+\\ s*,\\ s*([a-zA-Z0-9$]+)\\ (" ,
597- "\\ bc\\ s*&&\\ s*a\\ .set\\ ([^,]+\\ s*,\\ s*\\ ([^)]*\\ )\\ s*\\ (\\ s*([a-zA-Z0-9$]+)\\ (" ,
598- "\\ bc\\ s*&&\\ s*[a-zA-Z0-9]+\\ .set\\ ([^,]+\\ s*,\\ s*\\ ([^)]*\\ )\\ s*\\ (\\ s*([a-zA-Z0-9$]+)\\ (" ,
599- "\\ bc\\ s*&&\\ s*[a-zA-Z0-9]+\\ .set\\ ([^,]+\\ s*,\\ s*\\ ([^)]*\\ )\\ s*\\ (\\ s*([a-zA-Z0-9$]+)\\ ("
600- };
586+ private final static String DECRYPTION_SIGNATURE_FUNCTION_REGEX =
587+ "([\\ w$]+)\\ s*=\\ s*function\\ ((\\ w+)\\ )\\ {\\ s*\\ 2=\\ s*\\ 2\\ .split\\ (\" \" \\ )\\ s*;" ;
588+ private final static String DECRYPTION_SIGNATURE_FUNCTION_REGEX_2 =
589+ "\\ b([\\ w$]{2})\\ s*=\\ s*function\\ ((\\ w+)\\ )\\ {\\ s*\\ 2=\\ s*\\ 2\\ .split\\ (\" \" \\ )\\ s*;" ;
590+ private final static String DECRYPTION_AKAMAIZED_STRING_REGEX =
591+ "yt\\ .akamaized\\ .net/\\ )\\ s*\\ |\\ |\\ s*.*?\\ s*c\\ s*&&\\ s*d\\ .set\\ ([^,]+\\ s*,\\ s*(:encodeURIComponent\\ s*\\ ()([a-zA-Z0-9$]+)\\ (" ;
592+ private final static String DECRYPTION_AKAMAIZED_SHORT_STRING_REGEX =
593+ "\\ bc\\ s*&&\\ s*d\\ .set\\ ([^,]+\\ s*,\\ s*(:encodeURIComponent\\ s*\\ ()([a-zA-Z0-9$]+)\\ (" ;
601594
602595 private volatile String decryptionCode = "" ;
603596
@@ -774,15 +767,20 @@ private String decryptSignature(String encryptedSig, String decryptionCode) thro
774767 return result == null ? "" : result .toString ();
775768 }
776769
777- private String getDecryptionFuncName (final String playerCode ) throws DecryptException {
770+ private String getDecryptionFuncName (String playerCode ) throws DecryptException {
771+ String [] decryptionFuncNameRegexes = {
772+ DECRYPTION_SIGNATURE_FUNCTION_REGEX_2 ,
773+ DECRYPTION_SIGNATURE_FUNCTION_REGEX ,
774+ DECRYPTION_AKAMAIZED_SHORT_STRING_REGEX ,
775+ DECRYPTION_AKAMAIZED_STRING_REGEX
776+ };
778777 Parser .RegexException exception = null ;
779- for (final String regex : REGEXES ) {
778+ for (String regex : decryptionFuncNameRegexes ) {
780779 try {
781780 return Parser .matchGroup1 (regex , playerCode );
782781 } catch (Parser .RegexException re ) {
783- if (exception == null ) {
782+ if (exception == null )
784783 exception = re ;
785- }
786784 }
787785 }
788786 throw new DecryptException ("Could not find decrypt function with any of the given patterns." , exception );
0 commit comments