Created
January 23, 2018 20:49
-
-
Save kasparsd/3985e31829e08b823c6b6a6f35ae09ee to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
> /tmp/cookies.txt | |
/usr/local/bin/phantomjs --cookies-file="/tmp/cookies.txt" --ssl-protocol=any --ignore-ssl-errors=true /usr/local/bin/screenshot.js $1 |
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 page = require('webpage').create(), | |
system = require('system'), | |
address = system.args[1]; | |
page.viewportSize = page.clipRect = { | |
width: 1280, | |
height: 960 | |
}; | |
page.onError = page.onConsoleMessage = function() {}; | |
page.customHeaders = { | |
"Referer": address | |
}; | |
page.onLoadStarted = function() { | |
window.setTimeout(function() { | |
phantom.exit(1); | |
}, 10000); | |
}; | |
page.open(address, function(status) { | |
page.evaluate(function() { | |
document.body.bgColor = 'white'; | |
}); | |
if (status == 'success') { | |
window.setTimeout(function() { | |
page.render('/dev/stdout'); | |
phantom.exit(0); | |
}, 300); | |
} else { | |
console.log('Page.open returned ' + page.reason); | |
phantom.exit(1); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment