Skip to content

Instantly share code, notes, and snippets.

@goromlagche
Created August 11, 2014 13:20
Show Gist options
  • Save goromlagche/54af90d42997e90850d7 to your computer and use it in GitHub Desktop.
Save goromlagche/54af90d42997e90850d7 to your computer and use it in GitHub Desktop.
a phantom script to fetch pages
var fs = require('fs');
var system = require('system');
var url = system.args[1];
var page = require('webpage').create();
page.settings.userAgent = 'Baiduspider';
page.open(url, function () {
try {
fs.write(system.args[2], page.content, 'w');
} catch(e) {
console.log(e);
}
phantom.exit();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment