diff options
Diffstat (limited to 'lib/httracker')
-rw-r--r-- | lib/httracker/functions | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/lib/httracker/functions b/lib/httracker/functions index ce3dd29..36286d5 100644 --- a/lib/httracker/functions +++ b/lib/httracker/functions @@ -67,13 +67,24 @@ function httracker_get { fi # Get a screenshot - if [ "$WEBKIT2PNG" == "1" ]; then - $DIRNAME/webkit2png/webkit2png/webkit2png.py -o $TARGET/screenshot.png "$url" + # https://github.com/paulhammond/webkit2png/ + # https://github.com/adamn/python-webkit2png + # https://snippets.aktagon.com/snippets/504-how-to-generate-screenshots-on-debian-linux-with-python-webkit2png + if [ "$WEBKIT2PNG" == "1" ] && which xvfb-run &> /dev/null; then + xvfb-run -a $DIRNAME/webkit2png/webkit2png/webkit2png.py -o $TARGET/screenshot.png "$url" fi # Build a PDF - if [ "$WKHTMLTOPDF" == "1" ] && which wkhtmltopdf &> /dev/null; then - wkhtmltopdf "$url" $TARGET/screenshot.pdf + if [ "$WKHTMLTOPDF" == "1" ] && which xvfb-run &> /dev/null && which wkhtmltopdf &> /dev/null; then + xvfb-run -a wkhtmltopdf "$url" $TARGET/screenshot.pdf + fi + + # See https://www.insecure.ws/linux/serverless_screenshot.html + # http://gfdsa.gfdsa.org/2012/08/15/making-web-pages-screenshots-with-webkit2png-flash-included/ + if [ ! -d "$TARGET/screenshot.pdf" ]; then + if [ "$WEBKIT2PDF" == "1" ] && which xvfb-run &> /dev/null && which webkit2pdf &> /dev/null; then + ( cd $TARGET && xvfb-run -a webkit2pdf "$url" && mv 0000.pdf screenshot.pdf ) + fi fi # Fix permissions again |