|
3 | 3 | import com.grack.nanojson.JsonArray; |
4 | 4 | import com.grack.nanojson.JsonObject; |
5 | 5 | import com.grack.nanojson.JsonParser; |
| 6 | +import org.jsoup.Jsoup; |
| 7 | +import org.jsoup.nodes.Document; |
| 8 | +import org.jsoup.nodes.Element; |
| 9 | +import org.jsoup.select.Elements; |
6 | 10 | import org.mozilla.javascript.Context; |
7 | 11 | import org.mozilla.javascript.Function; |
8 | 12 | import org.mozilla.javascript.ScriptableObject; |
@@ -633,7 +637,7 @@ public String getErrorMessage() { |
633 | 637 | private static final String FORMATS = "formats"; |
634 | 638 | private static final String ADAPTIVE_FORMATS = "adaptiveFormats"; |
635 | 639 | private static final String HTTPS = "https:"; |
636 | | - private static final String DEOBFUSCATION_FUNC_NAME = "decrypt"; |
| 640 | + private static final String DEOBFUSCATION_FUNC_NAME = "deobfuscate"; |
637 | 641 |
|
638 | 642 | private final static String[] REGEXES = { |
639 | 643 | "(?:\\b|[^a-zA-Z0-9$])([a-zA-Z0-9$]{2})\\s*=\\s*function\\(\\s*a\\s*\\)\\s*\\{\\s*a\\s*=\\s*a\\.split\\(\\s*\"\"\\s*\\)", |
@@ -790,7 +794,7 @@ private EmbeddedInfo getEmbeddedInfo() throws ParsingException, ReCaptchaExcepti |
790 | 794 |
|
791 | 795 | } catch (IOException e) { |
792 | 796 | throw new ParsingException( |
793 | | - "Could load deobfuscation code form restricted video for the Youtube service.", e); |
| 797 | + "Could not load deobfuscation code from YouTube video embed", e); |
794 | 798 | } |
795 | 799 | } |
796 | 800 |
|
@@ -835,8 +839,8 @@ private String deobfuscateSignature(String obfuscatedSig, String deobfuscationCo |
835 | 839 | final Object result; |
836 | 840 | try { |
837 | 841 | final ScriptableObject scope = context.initSafeStandardObjects(); |
838 | | - context.evaluateString(scope, deobfuscationCode, "decryptionCode", 1, null); |
839 | | - final Function deobfuscateFunc = (Function) scope.get("decrypt", scope); |
| 842 | + context.evaluateString(scope, deobfuscationCode, "deobfuscationCode", 1, null); |
| 843 | + final Function deobfuscateFunc = (Function) scope.get(DEOBFUSCATION_FUNC_NAME, scope); |
840 | 844 | result = deobfuscateFunc.call(context, scope, scope, new Object[]{obfuscatedSig}); |
841 | 845 | } catch (Exception e) { |
842 | 846 | throw new DeobfuscateException("Could not get deobfuscate signature", e); |
|
0 commit comments