Archiv für den Tag: 11. August 2015

Batch-Screenshots mit Firefox

#!/bin/bash
# Makes screenshots from web directories
# List of URLs is contained in urls.txt (one url per line)
# Firefox needs the PRO version of the Pearl Crescent Page Server - Plugin
# The rename command at the end removes the sorting options in the filename
ACTDIR=`pwd`
SAVEDIR="/home/myuser/page-saver"
URLFILE="urls.txt"
for url in `cat $URLFILE`; do
    echo "$url"
    # clean filename (no https://, replace / with ., cut the querystring)
    name=`echo $url | cut -d "?" -f1 | sed "s~https://~~g" | sed "s~/~.~g"`
    echo $name
    wget --no-check-certificate --user-agent="Mozilla/5.0 compatible" "$url" -O "${SAVEDIR}/${name}html"
    # tmp folders break page saver - because of cropping - so do not picture the tmp folders
    part=`echo $name | cut -d "." -f4`
    echo $part
    if [[ "$part" != "tmp" ]]
    then
        firefox -saveimage "$url" -saveoptions format=png -saveas "$SAVEDIR/%u_%Y-%m-%d.png"
        sleep 15
    fi
done
cd "$SAVEDIR"
rename 's/-C=M;O=D_/_/' *.png
cd "$ACTDIR"

Voraussetzungen:

  • Firefox
  • Pearl Crescent Page Saver installiert (Firefox-Addon)
  • Datei „urls.txt“ im Verzeichnis des Scriptes (jeweils eine komplette URL pro Zeile)

Download-Urls:

https://addons.mozilla.org/de/firefox/addon/pagesaver/

http://pearlcrescent.com/products/pagesaver/