Introduction: Js2py Installation Library Now many Web sites have started to use JS encryption technology, so this library must be learned, or you will not be able to play with the tutorial js2py execute a single statement JS2PY executive function Summary: Now many of the Web site is writing crawlers to use JS encryption technology, so this library must learn ..
Executes the JS code in the JS file
The code in the JS file
function enString(data){
var key1 = "YHXWWLKJYXGS";
var key2 = "ZFCHHYXFL10C";
var key3 = "DES";
var enchex = key1+key2+key3+data
return enchex;
}
Python code
import js2py
data=open(‘sjtest.js‘,‘r‘,encoding= ‘utf8‘).read()
print(type(data))
data=js2py.eval_js(data)
print(data(‘1234569‘))
result:
<class ' str ' >
yhxwwlkjyxgszfchhyxfl10cdes1234569
Summary: In order to achieve their own crawler spring and Autumn Dream, I also a resistance to the end.
Python3 execute JavaScript script, js2py tutorial