| 
 | 
 
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册  
 
x
 
爬虫,遇到几个元素是js生成的,就复制过来然后execjs执行,结果报了错: 
- Traceback (most recent call last):
 
 -   File "C:/MyPythonProjects/WebSpideFile/EnglishPlayer.py", line 22, in <module>
 
 -     test = js.call('empty')
 
 -   File "C:\Users\fengu\AppData\Local\Programs\Python\Python38\lib\site-packages\execjs\_abstract_runtime_context.py", line 37, in call
 
 -     return self._call(name, *args)
 
 -   File "C:\Users\fengu\AppData\Local\Programs\Python\Python38\lib\site-packages\execjs\_external_runtime.py", line 92, in _call
 
 -     return self._eval("{identifier}.apply(this, {args})".format(identifier=identifier, args=args))
 
 -   File "C:\Users\fengu\AppData\Local\Programs\Python\Python38\lib\site-packages\execjs\_external_runtime.py", line 78, in _eval
 
 -     return self.exec_(code)
 
 -   File "C:\Users\fengu\AppData\Local\Programs\Python\Python38\lib\site-packages\execjs\_abstract_runtime_context.py", line 18, in exec_
 
 -     return self._exec_(source)
 
 -   File "C:\Users\fengu\AppData\Local\Programs\Python\Python38\lib\site-packages\execjs\_external_runtime.py", line 88, in _exec_
 
 -     return self._extract_result(output)
 
 -   File "C:\Users\fengu\AppData\Local\Programs\Python\Python38\lib\site-packages\execjs\_external_runtime.py", line 167, in _extract_result
 
 -     raise ProgramError(value)
 
 - execjs._exceptions.ProgramError: None
 
  复制代码 
这不是重点,重点是错误内容是None,None,None...... 
那我上哪里改正去? 
这是js代码: 
- var ma = /<(?:script|style|link)/i,
 
  
-     type = function(a) {
 
 -             return null == a ? a + "" : "object" == typeof a || "function" == typeof a ? h[i.call(a)] || "object" : typeof a
 
 -             },
 
 -     empty = function() {
 
 -             for (var a, b = 0; null != (a = this[b]); b++) {
 
 -                 1 === a.nodeType && m.cleanData(ua(a, !1));
 
 -                 while (a.firstChild)
 
 -                     a.removeChild(a.firstChild);
 
 -                 a.options && m.nodeName(a, "select") && (a.options.length = 0)
 
 -             }
 
 -             a = this
 
 -             return a
 
 -         },
 
  
-     m = function(a, b) {
 
 -         return new m.fn.init(a,b)
 
 -     },
 
 -     isFunction = function(a) {
 
 -             return "function" === type(a)
 
 -         },
 
 -     v = access = function(a, b, c, d, e, f, g) {
 
 -         var h = 0
 
 -           , i = a.length
 
 -           , j = null == c;
 
 -         if ("object" === type(c)) {
 
 -             e = !0;
 
 -             for (h in c)
 
 -                 access(a, b, h, c[h], !0, f, g)
 
 -         } else if (void 0 !== d && (e = !0,
 
 -         isFunction(d) || (g = !0),
 
 -         j && (g ? (b.call(a, d),
 
 -         b = null) : (j = b,
 
 -         b = function(a, b, c) {
 
 -             return j.call(m(a), c)
 
 -         }
 
 -         )),
 
 -         b))
 
 -             for (; i > h; h++)
 
 -                 b(a[h], c, g ? d : d.call(a[h], h, b(a[h], c)));
 
 -         return e ? a : j ? b.call(a) : i ? b(a[0], c) : f
 
 -     }
 
 - console.log(empty())
 
 - function n(a) {
 
 -         console.log(this)
 
 -         return v(this, function(a) {
 
 -             var b = this[0] || {}
 
 -               , c = 0
 
 -               , d = this.length;
 
 -             if (void 0 === a)
 
 -                 return 1 === b.nodeType ? b.innerHTML.replace(fa, "") : void 0;
 
 -             if (!("string" != typeof a || ma.test(a) || !true && ga.test(a) || !true && ha.test(a) || ra[(ja.exec(a) || ["", ""])[1].toLowerCase()])) {
 
 -                 a = a.replace(ia, "<$1></$2>");
 
 -                 try {
 
 -                     for (; d > c; c++)
 
 -                         b = this[c] || {},
 
 -                         1 === b.nodeType && (m.cleanData(ua(b, !1)),
 
 -                         b.innerHTML = a);
 
 -                     b = 0
 
 -                 } catch (e) {}
 
 -             }
 
 -             b && this.empty().append(a)
 
 -         }, null, a, arguments.length)
 
 - }
 
  复制代码 
哪一个会js的大佬来帮我看看哪里错了 |   
 
 
 
 |