@@ -581,14 +581,21 @@ public String getErrorMessage() {
581581 private static final String HTTPS = "https:" ;
582582 private static final String DECRYPTION_FUNC_NAME = "decrypt" ;
583583
584- private final static String DECRYPTION_SIGNATURE_FUNCTION_REGEX =
585- "([\\ w$]+)\\ s*=\\ s*function\\ ((\\ w+)\\ )\\ {\\ s*\\ 2=\\ s*\\ 2\\ .split\\ (\" \" \\ )\\ s*;" ;
586- private final static String DECRYPTION_SIGNATURE_FUNCTION_REGEX_2 =
587- "\\ b([\\ w$]{2})\\ s*=\\ s*function\\ ((\\ w+)\\ )\\ {\\ s*\\ 2=\\ s*\\ 2\\ .split\\ (\" \" \\ )\\ s*;" ;
588- private final static String DECRYPTION_AKAMAIZED_STRING_REGEX =
589- "yt\\ .akamaized\\ .net/\\ )\\ s*\\ |\\ |\\ s*.*?\\ s*c\\ s*&&\\ s*d\\ .set\\ ([^,]+\\ s*,\\ s*(:encodeURIComponent\\ s*\\ ()([a-zA-Z0-9$]+)\\ (" ;
590- private final static String DECRYPTION_AKAMAIZED_SHORT_STRING_REGEX =
591- "\\ bc\\ s*&&\\ s*d\\ .set\\ ([^,]+\\ s*,\\ s*(:encodeURIComponent\\ s*\\ ()([a-zA-Z0-9$]+)\\ (" ;
584+ private final static String [] REGEXES = {
585+ "\\ b[cs]\\ s*&&\\ s*[adf]\\ .set\\ ([^,]+\\ s*,\\ s*encodeURIComponent\\ s*\\ (\\ s*([a-zA-Z0-9$]+)\\ (" ,
586+ "\\ b[a-zA-Z0-9]+\\ s*&&\\ s*[a-zA-Z0-9]+\\ .set\\ ([^,]+\\ s*,\\ s*encodeURIComponent\\ s*\\ (\\ s*([a-zA-Z0-9$]+)\\ (" ,
587+ "\\ b([a-zA-Z0-9$]{2})\\ s*=\\ s*function\\ (\\ s*a\\ s*\\ )\\ s*\\ {\\ s*a\\ s*=\\ s*a\\ .split\\ (\\ s*\" \" \\ s*\\ )" ,
588+ "([a-zA-Z0-9$]+)\\ s*=\\ s*function\\ (\\ s*a\\ s*\\ )\\ s*\\ {\\ s*a\\ s*=\\ s*a\\ .split\\ (\\ s*\" \" \\ s*\\ )" ,
589+ // Obsolete patterns
590+ "[\" ']signature[\" ']\\ s*,\\ s*([a-zA-Z0-9$]+)\\ (" ,
591+ "\\ .sig\\ |\\ |([a-zA-Z0-9$]+)\\ (" ,
592+ "yt\\ .akamaized\\ .net/\\ )\\ s*\\ |\\ |\\ s*.*?\\ s*[cs]\\ s*&&\\ s*[adf]\\ .set\\ ([^,]+\\ s*,\\ s*(?:encodeURIComponent\\ s*\\ ()?\\ s*([a-zA-Z0-9$]+)\\ (" ,
593+ "\\ b[cs]\\ s*&&\\ s*[adf]\\ .set\\ ([^,]+\\ s*,\\ s*([a-zA-Z0-9$]+)\\ (" ,
594+ "\\ b[a-zA-Z0-9]+\\ s*&&\\ s*[a-zA-Z0-9]+\\ .set\\ ([^,]+\\ s*,\\ s*([a-zA-Z0-9$]+)\\ (" ,
595+ "\\ bc\\ s*&&\\ s*a\\ .set\\ ([^,]+\\ s*,\\ s*\\ ([^)]*\\ )\\ s*\\ (\\ s*([a-zA-Z0-9$]+)\\ (" ,
596+ "\\ bc\\ s*&&\\ s*[a-zA-Z0-9]+\\ .set\\ ([^,]+\\ s*,\\ s*\\ ([^)]*\\ )\\ s*\\ (\\ s*([a-zA-Z0-9$]+)\\ (" ,
597+ "\\ bc\\ s*&&\\ s*[a-zA-Z0-9]+\\ .set\\ ([^,]+\\ s*,\\ s*\\ ([^)]*\\ )\\ s*\\ (\\ s*([a-zA-Z0-9$]+)\\ ("
598+ };
592599
593600 private volatile String decryptionCode = "" ;
594601
@@ -765,20 +772,15 @@ private String decryptSignature(String encryptedSig, String decryptionCode) thro
765772 return result == null ? "" : result .toString ();
766773 }
767774
768- private String getDecryptionFuncName (String playerCode ) throws DecryptException {
769- String [] decryptionFuncNameRegexes = {
770- DECRYPTION_SIGNATURE_FUNCTION_REGEX_2 ,
771- DECRYPTION_SIGNATURE_FUNCTION_REGEX ,
772- DECRYPTION_AKAMAIZED_SHORT_STRING_REGEX ,
773- DECRYPTION_AKAMAIZED_STRING_REGEX
774- };
775+ private String getDecryptionFuncName (final String playerCode ) throws DecryptException {
775776 Parser .RegexException exception = null ;
776- for (String regex : decryptionFuncNameRegexes ) {
777+ for (final String regex : REGEXES ) {
777778 try {
778779 return Parser .matchGroup1 (regex , playerCode );
779780 } catch (Parser .RegexException re ) {
780- if (exception == null )
781+ if (exception == null ) {
781782 exception = re ;
783+ }
782784 }
783785 }
784786 throw new DecryptException ("Could not find decrypt function with any of the given patterns." , exception );
0 commit comments