Skip to content

Instantly share code, notes, and snippets.

@mfr
Last active December 28, 2015 05:39
Show Gist options
  • Save mfr/7451435 to your computer and use it in GitHub Desktop.
Save mfr/7451435 to your computer and use it in GitHub Desktop.
var page = require('webpage').create();
var system = require('system');
var cur_date = new Date();
var folder = cur_date.getFullYear() + '-' + (cur_date.getMonth()+1) + '-' + cur_date.getDate();// +'_'+ cur_date.getHours() +cur_date.getMinutes();
var url = system.args[1];
var filename = url.replace(/[^a-z0-9]/gi, '_').toLowerCase();
page.open(url, function () {
page.render(folder+'/'+filename+'.png');
system.stdout.writeLine('done : '+ url);
phantom.exit(0);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment