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
#!/usr/local/bin/zsh | |
if [[ -z $1 ]]; then | |
echo 'syntax: shootphantom URL [name] (.png will be added for you)' | |
echo 'if NAME is empty a name will be attempted to be guessed' | |
return 1 | |
fi | |
DATE=`date +%s` | |
URL=$1 | |
echo 'url is:' $URL | |
if [[ ! -z $2 ]];then | |
echo 'using provided name' | |
NAME=$2.$DATE | |
else | |
echo 'using guessed name' | |
URL_SPLIT=("${(s./.)URL}") | |
if [[ "${#URL_SPLIT[-1]}" == 0 ]];then | |
if [[ "$URL_SPLIT[-1]" == "$URL_SPLIT[2]" ]];then | |
ENDPART='index' | |
else | |
ENDPART=$URL_SPLIT[-2] | |
fi | |
else | |
ENDPART=$URL_SPLIT[-1] | |
echo 'wut' | |
fi | |
if [[ "$ENDPART" == "$URL_SPLIT[2]" ]];then | |
ENDPART='index' | |
fi | |
NAME=$URL_SPLIT[2].$ENDPART.$DATE | |
fi | |
NAME=$NAME | |
echo $NAME | |
phantomjs /home/pronto/bin/shootphantom.js $URL $NAME | |
echo $URL_SPLIT | |
echo $#URL_SPLIT | |
echo $URL_SPLIT[3] | |
echo "http://freebsd.crackthat.pw/a/screens/$NAME.png" |
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(); | |
// page.settings.userAgent='Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36'; | |
//page.settings.userAgent='Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)'; | |
page.settings.userAgent='Mozilla/5.0 (X11; Linux x86_64; rv:28.0) Gecko/20100101 Firefox/28.0 Iceweasel/28.0'; | |
page.viewportSize = {height:1300, width: 1300 }; | |
var url = phantom.args[0] | |
var name = phantom.args[1] | |
page.open(url, function(status) { | |
window.setTimeout(function () { | |
page.render(output); | |
phantom.exit(); | |
}, 200); | |
page.render('/path/to/the/place/you/want/things/saved/'+name+'.png'); | |
phantom.exit(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment