Skip to content

Instantly share code, notes, and snippets.

@zweite
Created March 11, 2017 04:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zweite/5ae91f91b900afd61d56054170c34cef to your computer and use it in GitHub Desktop.
Save zweite/5ae91f91b900afd61d56054170c34cef to your computer and use it in GitHub Desktop.
"use strict";
var page = require('webpage').create(),
system = require('system'),
address, output, size;
address = system.args[1];
output = system.args[2];
page.onLoadFinished = function() {
}
page.settings.userAgent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) ALLL/537 (KHTML, like Gecko) Chrome/46.0.2924.87 Safari/537.36"
page.open(address, function (status) {
if (status !== 'success') {
console.log('Unable to load the address!');
phantom.exit(1);
} else {
setTimeout(function(){
page.render(output)
phantom.exit()
}, 5000)
}
});
// test
// phantomjs render.js http://www.tianyancha.com/company/270929355 tianyancha.png
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment