反爬虫之JS反编译:PyExecJS

PyExecJS是python运行JavaScript代码的包

安装: 

    pip install  PyExecJS (或者easy_install PyExecJS)

 

依赖: 

    需要有执行JS的程序,如:PyV8 , Node.js , PhantomJS等,请自行安装

 

事例: 

# encoding:utf-8
import execjs


def exec_js_function():
# 编译JS代码

ctx = execjs.compile("""
function lineupStudents(value){
return new Date;
}
""")
# 执行JS
jscode = ctx.call("lineupStudents", 'Date')
return jscode

print exec_js_function()

参考: https://github.com/doloopwhile/PyExecJS 

posted @ 2019-01-21 15:09  python许三多  阅读(1272)  评论(0编辑  收藏  举报