美文网首页服务端其他
[Crawl]Phantomjs传参

[Crawl]Phantomjs传参

作者: _小老虎_ | 来源:发表于2018-08-16 12:17 被阅读1次

配合NodeJS

var system = require('system');
console.log('phantom.args:',system.args);

// test.js
var page = require('webpage').create(),
  system = require('system'),
  address;
if (system.args.length === 1) {
  phantom.exit(1);
} else {
  address = system.args[1];
  page.open(address, function (status) {
    console.log(page.content);
    phantom.exit();
  });
}

相关文章

网友评论

    本文标题:[Crawl]Phantomjs传参

    本文链接:https://www.haomeiwen.com/subject/eiinbftx.html