Phantomjs关于Pinterest的问题:TypeError:undefined不是构造函数

问题描述

我在Centos 7,Ubuntu和Windows 10上测试了以下代码。每次都遇到以下错误。我也尝试过像babel-polyfill这样的插件。但是总有一个错误。 Instagram和Facebook等地方的代码可以正常工作。我该怎么办?

    var webPage = require('webpage');
var page = webPage.create();
page.settings.loadImages = true;
page.settings.userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.4 (KHTML,like Gecko) Chrome/22.0.1229.94 Safari/537.4";
page.customHeaders = {
    "Connection": "keep-alive"
};


page.viewportSize = {
  width: 2560,height: 1440
};



page.open('https://www.pinterest.com/',function(status) {

  var interval = setInterval(function () {



      clearInterval(interval);
      var content = page.content;
      //console.log(content);
      page.render('pinterest.png');
      phantom.exit();
   
  },5000);
});

相同错误(我在JS上不太好):

    TypeError: undefined is not a constructor (evaluating 'Object.entries')

  https://s.pinimg.com/webapp/js/bugsnag-7f81b4fffe3d2ba91458.js:1
TypeError: undefined is not a constructor (evaluating 'Object.entries')

  https://s.pinimg.com/webapp/js/bugsnag-7f81b4fffe3d2ba91458.js:1
ReferenceError: Can't find variable: Map

  https://s.pinimg.com/webapp/js/vendor-react-1b06d0a8393a465f33a6.js:1 in yl30
  https://s.pinimg.com/webapp/js/runtime-49702767d1d6841f486c.js:1 in n
  https://s.pinimg.com/webapp/js/vendor-react-1b06d0a8393a465f33a6.js:1 in i8i4
  https://s.pinimg.com/webapp/js/runtime-49702767d1d6841f486c.js:1 in n
  https://s.pinimg.com/webapp/js/vendor-react-1b06d0a8393a465f33a6.js:1 in /MKj
  https://s.pinimg.com/webapp/js/runtime-49702767d1d6841f486c.js:1 in n
  https://s.pinimg.com/webapp/js/entryChunk-www-unauth-e79eb14095d515cee228.js:1 in XyaC
  https://s.pinimg.com/webapp/js/runtime-49702767d1d6841f486c.js:1 in n
  https://s.pinimg.com/webapp/js/entryChunk-www-unauth-e79eb14095d515cee228.js:1 in TLuc
  https://s.pinimg.com/webapp/js/runtime-49702767d1d6841f486c.js:1 in n
  https://s.pinimg.com/webapp/js/entryChunk-www-unauth-e79eb14095d515cee228.js:1
  https://s.pinimg.com/webapp/js/runtime-49702767d1d6841f486c.js:1 in n
  https://s.pinimg.com/webapp/js/runtime-49702767d1d6841f486c.js:1 in o
  https://s.pinimg.com/webapp/js/runtime-49702767d1d6841f486c.js:1 in a

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...