From: James Bunton Date: Thu, 8 Oct 2015 11:13:49 +0000 (+1100) Subject: added window.location.hash X-Git-Url: https://code.delx.au/youtube-cgi/commitdiff_plain/7ef9dbee4cc61c62ae0f97050a4b8a5035c18771 added window.location.hash --- diff --git a/youtube.cgi b/youtube.cgi index 3149343..7d39357 100755 --- a/youtube.cgi +++ b/youtube.cgi @@ -165,11 +165,14 @@ def decode_signature(js_url, signature): stdout=subprocess.PIPE ) js_decode_script = (""" - var vm = require("vm"); + var vm = require('vm'); var sandbox = { window: { - location: {}, + location: { + hash: '', + href: '' + }, history: { pushState: function(){} }, @@ -181,8 +184,9 @@ def decode_signature(js_url, signature): transformed_signature: null }; - var execstring = ";transformed_signature = %(func_name)s(signature);"; - vm.runInNewContext(%(code)s + execstring, sandbox); + var code_string = %(code)s + ';'; + var exec_string = 'transformed_signature = %(func_name)s(signature);'; + vm.runInNewContext(code_string + exec_string, sandbox); console.log(sandbox.transformed_signature); """ % params)