(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p})('q g=g=\'["n\\/%0%6%4%0%1%7%8%3%2%0%1%a\\/%d%f%e%b%c%9\\/m.5","n\\/%0%6%4%0%1%7%8%3%2%0%1%a\\/%d%f%e%b%c%9\\/p.5","n\\/%0%6%4%0%1%7%8%3%2%0%1%a\\/%d%f%e%b%c%9\\/r.5","n\\/%0%6%4%0%1%7%8%3%2%0%1%a\\/%d%f%e%b%c%9\\/s.5","n\\/%0%6%4%0%1%7%8%3%2%0%1%a\\/%d%f%e%b%c%9\\/k.5","n\\/%0%6%4%0%1%7%8%3%2%0%1%a\\/%d%f%e%b%c%9\\/h.5","n\\/%0%6%4%0%1%7%8%3%2%0%1%a\\/%d%f%e%b%c%9\\/i.5","n\\/%0%6%4%0%1%7%8%3%2%0%1%a\\/%d%f%e%b%c%9\\/j.5","n\\/%0%6%4%0%1%7%8%3%2%0%1%a\\/%d%f%e%b%c%9\\/l.5","n\\/%0%6%4%0%1%7%8%3%2%0%1%a\\/%d%f%e%b%c%9\\/o.5","n\\/%0%6%4%0%1%7%8%3%2%0%1%a\\/%d%f%e%b%c%9\\/D.5","n\\/%0%6%4%0%1%7%8%3%2%0%1%a\\/%d%f%e%b%c%9\\/A.5","n\\/%0%6%4%0%1%7%8%3%2%0%1%a\\/%d%f%e%b%c%9\\/B.5","n\\/%0%6%4%0%1%7%8%3%2%0%1%a\\/%d%f%e%b%c%9\\/C.5","n\\/%0%6%4%0%1%7%8%3%2%0%1%a\\/%d%f%e%b%c%9\\/E.5","n\\/%0%6%4%0%1%7%8%3%2%0%1%a\\/%d%f%e%b%c%9\\/z.5","n\\/%0%6%4%0%1%7%8%3%2%0%1%a\\/%d%f%e%b%c%9\\/y.5","n\\/%0%6%4%0%1%7%8%3%2%0%1%a\\/%d%f%e%b%c%9\\/u-t.5","n\\/%0%6%4%0%1%7%8%3%2%0%1%a\\/%d%f%e%b%c%9\\/v.5","n\\/%0%6%4%0%1%7%8%3%2%0%1%a\\/%d%f%e%b%c%9\\/w.5","n\\/%0%6%4%0%1%7%8%3%2%0%1%a\\/%d%f%e%b%c%9\\/x.5"]\';',41,41,'E5|8F|90|88|B3|jpg|A5|8B|E6|9D|8C|E8|AF|E7|AC02|AC|pages|43|44|45|42|46|38||47|39|var|40|41|056|055|057|058|059|054|053|049|050|051|048|052'.split('|'),0,{})
就是这串代码,如何使用execjs去运行?求大佬给出详细代码
你说一下你运行这段js你入参是什么,调用js中哪个方法
js_obj = execjs.compile('你上述的js 代码')
res = execjs.call('方法名',入参)
#这个模块很久没跟新了不建议使用
#推荐直接nodejs运行js
你好,我知道可以直接使用nodejs运行,但是我后续的处理需要在py中,但是这个是js的自调用函数,所以不知道怎么写
@JKding233: 动动你的小脑瓜子不就能知道了
//js字符串
function test(){
把你那一大串丢进去
把结果return一下,太多了我也不想仔细看
}
#python脚本
js_obj = execjs.compile('你上述的js 代码')
res = execjs.call('test')
@JKding233: 至于node怎么调用我最近博客有发过你可以看看很简单,https://www.cnblogs.com/pythonywy/p/13221152.html,没什么时间总结应该不好找链接弄出来了自己看看
@JKding233:
你复制过去吧
//return 换成console
(function (p, a, c, k, e, d) {
e = function (c) {
return (c < a ? '' : e(parseInt(c / a))) + ((c = c % a) > 35 ? String.fromCharCode(c + 29) : c.toString(36))
};
if (!''.replace(/^/, String)) {
while (c--) {
d[e(c)] = k[c] || e(c)
}
k = [function (e) {
return d[e]
}];
e = function () {
return '\\w+'
};
c = 1
}
;
while (c--) {
if (k[c]) {
p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c])
}
}
console.log(p)
})('q g=g=\'["n\\/%0%6%4%0%1%7%8%3%2%0%1%a\\/%d%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, 41, 'E5|8F|90|88|B3|jpg|A5|8B|E6|9D|8C|E8|AF|E7|AC02|AC|pages|43|44|45|42|46|38||47|39|var|40|41|056|055|057|058|059|054|053|049|050|051|048|052'.split('|'), 0, {})
import os
a = os.popen('node aa.js').read()
print(a)
@小小咸鱼YwY: 感谢
@JKding233: 哈哈,爬虫很活的没那么死板