【发布时间】:2018-04-25 05:20:57
【问题描述】:
我已经在我的 Windows 8.1 电脑上安装了 phantomjs,并通过从命令提示符执行 js 文件进行了一些抓取。现在的问题是我如何在共享主机中运行 phantomjs 程序。我在网上寻找解决方案,我能找到的只是“我建议将 PhantomJS 二进制文件移动到你的主目录。在那里,你可以通过简单地指向文件来执行 PhantomJS:~/phantomjs -v。” .但我不明白“~/ phantomjs -v”是什么意思。我在哪里以及如何编写和运行此代码?这里要明确的是javascript文件
var page = new WebPage()
var fs = require('fs');
page.onLoadFinished = function() {
console.log("page load finished");
page.render('export.png');
fs.write('1.html', page.content, 'w');
phantom.exit();
};
page.open("https://url", function() {
page.evaluate(function() {
});
});
现在我如何在我的共享主机上运行这个文件(linux 64 位) 什么是“~/phantomjs -v”?
【问题讨论】:
标签: javascript html web-scraping phantomjs shared-hosting