Skip to content

Commit 070cd92

Browse files
authored
Merge pull request #387 from wb9688/init-safe-standard-objects
Use initSafeStandardsObjects()
2 parents de8edbe + 7657c2e commit 070cd92

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,6 @@ public String getErrorMessage() {
627627
"yt\\.akamaized\\.net/\\)\\s*\\|\\|\\s*.*?\\s*c\\s*&&\\s*d\\.set\\([^,]+\\s*,\\s*(:encodeURIComponent\\s*\\()([a-zA-Z0-9$]+)\\(",
628628
"\\bc\\s*&&\\s*d\\.set\\([^,]+\\s*,\\s*(:encodeURIComponent\\s*\\()([a-zA-Z0-9$]+)\\("
629629
};
630-
;
631630

632631
private volatile String decryptionCode = "";
633632

@@ -788,16 +787,16 @@ private String loadDecryptionCode(String playerUrl) throws DecryptException {
788787
}
789788

790789
private String decryptSignature(String encryptedSig, String decryptionCode) throws DecryptException {
791-
Context context = Context.enter();
790+
final Context context = Context.enter();
792791
context.setOptimizationLevel(-1);
793-
Object result;
792+
final Object result;
794793
try {
795-
ScriptableObject scope = context.initStandardObjects();
794+
final ScriptableObject scope = context.initSafeStandardObjects();
796795
context.evaluateString(scope, decryptionCode, "decryptionCode", 1, null);
797-
Function decryptionFunc = (Function) scope.get("decrypt", scope);
796+
final Function decryptionFunc = (Function) scope.get("decrypt", scope);
798797
result = decryptionFunc.call(context, scope, scope, new Object[]{encryptedSig});
799798
} catch (Exception e) {
800-
throw new DecryptException("could not get decrypt signature", e);
799+
throw new DecryptException("Could not get decrypt signature", e);
801800
} finally {
802801
Context.exit();
803802
}

0 commit comments

Comments
 (0)