Skip to content

Instantly share code, notes, and snippets.

@chaosmail
Created July 15, 2014 16:22
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 chaosmail/d4998e9e204701195ac6 to your computer and use it in GitHub Desktop.
Save chaosmail/d4998e9e204701195ac6 to your computer and use it in GitHub Desktop.
Simple PhantomJS Crawler
var system = require('system');
var fs = require('fs');
var args = system.args;
if (args.length === 1) {
console.log("Please write url as argument");
phantom.exit();
}
console.log('Loading', args[1]);
var page = require('webpage').create();
var url = args[1];
page.open(url, function (status) {
console.log(status);
page.render('page.png');
fs.write('page.html', page.content, 'w');
// Output
// console.log(page.content);
phantom.exit();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment