Skip to content

Instantly share code, notes, and snippets.

@szupie
Last active April 17, 2024 22:32
Show Gist options
  • Save szupie/adb79f049966234c622f46ecd8342b81 to your computer and use it in GitHub Desktop.
Save szupie/adb79f049966234c622f46ecd8342b81 to your computer and use it in GitHub Desktop.
Bash script to save full-page screenshots of a list of URLs, using Firefox in headless mode
#!/bin/bash
# Script to save full-page screenshots of a list of URLs, using Firefox in headless mode
# Run with path to file containing list of URLs as first argument:
# sh ./path/to/screenshotter.sh ./path/to/urls.txt
# Screenshots will be saved to a folder named the specified width
# Change these to desired screenshot width and path to Firefox
WIDTH=1440
FIREFOX_PATH="/Applications/Firefox.app/Contents/MacOS/firefox"
mkdir $WIDTH
for url in $(cat $1); do
FILENAME=$(basename $url)
FILENAME="./${WIDTH}/${FILENAME}-$(date +%s)-${WIDTH}.png"
$FIREFOX_PATH -P default -screenshot $url --window-size=$WIDTH
mv ./screenshot.png $FILENAME
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment