Created
July 15, 2014 16:22
-
-
Save chaosmail/d4998e9e204701195ac6 to your computer and use it in GitHub Desktop.
Simple PhantomJS Crawler
This file contains hidden or 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 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