Created
August 11, 2014 13:20
-
-
Save goromlagche/54af90d42997e90850d7 to your computer and use it in GitHub Desktop.
a phantom script to fetch pages
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
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