Created
March 11, 2017 04:10
-
-
Save zweite/5ae91f91b900afd61d56054170c34cef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"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